Game Development Community

RC1: Mouse binding not working

by Mike Lilligreen · in Torque Game Builder · 06/01/2006 (10:03 am) · 3 replies

I followed the setup mentioned in the Input Interaction PDF for using .bind with mouse0 with the example xaxis function. However, xaxis (or buttons) are not providing any feedback regardless of whether the level editor is enabled or not.

Anything keyboard related works fine and the console sees mouse0 when the window loses/regains focus.

Is there something I am missing getting this to work via script or was mouse binding disabled in favor of using callbacks exclusively?

#1
02/07/2007 (12:24 pm)
Hi guys, i'm having the same problem here using 1.1.3. I've "binded" like following:

moveMap.bind( mouse0, "xaxis", "mouseX");
   moveMap.bind( mouse0, "yaxis", "mouseY");

But i dont get any feedback. I notice that my mouse icon is beeing rendered in the game, before it was not.

Is this a bug?
#2
02/08/2007 (11:38 am)
Hi, Gustavo. You need to call hideCursor to get input directly from the mouse.

Try this:

hideCursor();
   moveMap.bind( mouse0, "xaxis", "mouseX");
   moveMap.bind( mouse0, "yaxis", "mouseY");


function mouseX(%val)
   {
      echo(%val);
   }

You should get the mouse X value spammed into the console. Note that if you open the console, it will showCursor, so you might want to do something to avoid this, like checking if the cursor is visible in your main loop.

if (Canvas.isCursorOn())
      hideCursor();

Hope this helps.
#3
02/08/2007 (12:52 pm)
Hi Thomas! Thank you very much, it worked very well!