Game Development Community

OnMouseMove(...) not being called

by Gustavo Boni · in Torque Game Builder · 02/07/2007 (6:49 pm) · 7 replies

Hey guys,

The onMouseMove callback is not being called in my game. I've called
sceneWindow2D.setUseWindowMouseEvents(true);
in starGame() function in game.cs but it still not working.

Its how i declared the callback:

function sceneWindow2D::onMouseMove(%this, %modifier, %worldPosition, %clicks)
{
   echo("Move");
}

Its driving me nuts!

Thanks

#1
02/07/2007 (6:54 pm)
@Gustavo -- did you set "useMouseEvents = 1" in the object creation?
#2
02/08/2007 (1:04 am)
As well, make sure that you have onMouseDragged as well because if a mouse button is down, the MouseMove will become a MouseDrag event and stop firing MouseMove events.
#3
02/08/2007 (4:20 am)
@David: yes, i did like i said in my post above. I used: sceneWindow2D.setUseWindowMouseEvents(true); i it the same thing or not?

@Marc: i have only onMouseMove in my code, should i add onMouseDragged? I'm not pressing any button.
#4
02/08/2007 (6:59 am)
@Gustavo -- both the scenewindow AND the object have to listen for mouseevents -- when you create the object through script, there is a field called "UseMouseEvents" which is set to 1 or 0 -- when creating in the level editor, there is a "Use Mouse Events" checkbox ...

You can also enable mouse events on an object through script "after" creation with "%obj.setUseMouseEvents(true)"

If the object is not listening, it won't respond.
#5
02/08/2007 (7:20 am)
@David: i have set this field yet.

I solved the problem. I'm using Adventure kit o create my game, and it uses a gui called PlayScreenGui instead the default MainscreenGui. Its the reason to not get the onMouse callbacks working. Just replaced it and got it working.

Thanks all!
#6
02/08/2007 (8:23 am)
@Gustavo -- how did the "main screen" GUI make a difference?
#7
02/08/2007 (10:24 am)
@David: maybe because the PlayScreenGui in AK is a GuiChunkedBitmapCtrl and MainScreenGui a GuiControl. I think it doenst matter too, both should work, but its not.