My question is, is this wise from a performance standpoint? I haven't seen a big drop in framerate yet, but that is without any game logic at all, but it *does* work.
The other solution I came up with but have not tried is to create a dynamic draw function in the dragging component that renders the component at its drag location and pass that function out to the UI manager to draw last, but as I am unused to Lua's handling of reference passing, I don't know if the variables would retain their value. Here's an example of what I mean:
Code: Select all
function component:draw()
--normal draw stuff
if (self.dragging) then
uimanager.draggingitem = function()
-- vars in question, what will their value be? A mystery...
local dragitem = self
local dragX, dragY = self.dragX, dragY
love.graphics.draw(dragitem.image, dragX, dragY)
end
end
end
Help is, as always, greatly appreciated