What I want: Be able to read current mouse position in one of my drawing functions (called from DrawWorld). Now, I'm only supposed to be drawing that if my widget is in a certain state, but that state is triggered by pressing on a chili button, therefor I cannot do a "return true" in MousePress to get mouse control, because it never gets called.
So I'm looking for a way to either get current mouse positions in an arbitrary function (that isn't a Mouse* call-in) or for a way to gain mouse control from an arbitrary function so my MouseDraw would be called.
Sample of what I want to do:
Code:
function widget:DrawWorld() if internalState == "drawUnit" then -- not even sure if this is a way to draw a unit, but whatevs gl.PushMatrix() -- these unitDraw_* variables should be either set in a MouseDraw or fetched by some unsynced read... gl.Translate(unitDraw_x, unitDraw_y, unitDraw_z) gl.UnitShape(selUnitDef, teamId) gl.PopMatrix() end end
-- and somewhere I have a chili button function widget:initialize() window = Chili.Window:New { parent = screen0, children = { Chili.Button:New { caption = "clicky", OnClick = { function() internalState = "drawUnit" end } } } } end
Users browsing this forum: No registered users and 0 guests
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum