Game Development Community

1.1.1 Mouse movement bind broken? (fixed)

by J. Alan Atherton · in Torque Game Builder · 08/14/2006 (11:09 am) · 4 replies

My project binds the mouse movement to a function thusly:
moveMap.bind(mouse0, "xaxis", mouseX); 
   moveMap.bind(mouse0, "yaxis", mouseY);
and the functions:
function mouseX(%val) {
   pointer.setImpulseForce(%val*$mouse::moveScale[$mouse::moveStackIndex] SPC 0);
   echo("movex");
}

function mouseY(%val) {
   pointer.setImpulseForce(0 SPC %val*$mouse::moveScale[$mouse::moveStackIndex]);
}

When the level loads, I call hideCursor(); In 1.1, this worked just fine. Now in 1.1.1, it is not working. I have tried a variety of things, including lockMouse(true), sceneWindow2D.setLockMouse(true), enableMouse(), Canvas.hideCursor, and changing the LBPlayLevel.ed.gui noCursor to 0. None of these had any visible effect.

#1
08/15/2006 (8:20 am)
This is known. The functionality has been removed from the 1.1.1 build for stability issues. These threads should help:

www.garagegames.com/mg/forums/result.thread.php?qt=26532
www.garagegames.com/mg/forums/result.thread.php?qt=48344

-Unk
#2
08/15/2006 (9:27 am)
Unk,

Thanks for the pointers, but it doesn't seem like the functionality has been removed intentionally. The changelist for 1.1.1 says:
- Disallowed the use of mouse axes with bindCmd - this was crashing the engine.

bindCmd is different from bind.

Perhaps they went overboard, in which case I guess I will have to wait for the next release, or for someone who knows what code would affect this functionality. Hopefully they really didn't remove mouse axis binding, and someone just knows the magic word.
#3
08/15/2006 (12:16 pm)
Ok, I figured it out. I don't know exactly what changes were made in the engine or tools code, but here is one way to fix it. I noticed that the GuiCanvas::checkCursor function checks the noCursor field of a gui and all of the controls inside the gui to see if noCursor=true. If the field doesn't exist, or if it is false for any of the child controls or the gui, then it shows the cursor and bails. It also appears to check the parent. I don't fully understand the pipeline, but I found by debugging that somewhere something didn't have noCursor=true, so the cursor was unlocked and shown whenever a dialog was pushed or popped (including the console window).

To fix it, open up the mainScreen.gui inside your particular project (in the gui folder), and add noCursor=true; to every control in there (in my case, there are two).

As near as I can tell, this is all it needs to work. I'm sure a better-placed hideCursor call would work also, but it does not work when placed in onLevelLoaded. Something pushes a dialog after that. If you find that it does not work with those changes, post here and I'll try to retrace my steps better.
#4
08/24/2006 (5:32 pm)
@J. Alan - Yes, this does indeed work.

I find it works if you run your game and type this in the console:

'mainScreenGui.nocursor=true;'

Thanks for tracking this down.

www.hallofworlds.com/how.ico Hall Of Worlds - For Gamers
EdM|GPGT