Enable Mouse Cursor
by Shawn Kennedy · in Torque 3D Professional · 12/07/2010 (2:42 pm) · 2 replies
I'm in the middle of doing some prototyping some GUI stuff for a project, and I can't seem to figure out how or where to enable the mouse cursor. I assume I can do it via script, but what I need to do, and in which script I need to do it are unknown to me at the moment.
Specifically, I'm working with a default, "Empty Room" project. I added some controls to the "playGui" and I would like to have the mouse cursor so I can interact with them, but when it gets into the "Empty Room level", the cursor disappears.
Any ideas? Any help is appreciated.
Specifically, I'm working with a default, "Empty Room" project. I added some controls to the "playGui" and I would like to have the mouse cursor so I can interact with them, but when it gets into the "Empty Room level", the cursor disappears.
Any ideas? Any help is appreciated.
Torque Owner Henry Todd
Atomic Walrus
To accomplish this I have a function in scripts/client/default.bind.cs that looks like this:
function toggleMouseLook(%val) { if(%val) { if(Canvas.isCursorOn()) Canvas.CursorOff(); else Canvas.CursorOn(); } }And in the same file you can manually bind that to a key like this:Or else add it to the bind list so players can choose their own key. In core/scripts/gui/optionsDlg.cs around line 400 you'll find a list of binds that look like the code below. Add this one anywhere inside that list (they'll be listed in that order in the options, so put it somewhere that seems appropriate):
Make sure that wherever you put it is after the previous bind's "$RemapCount++;" (unless you're adding it as the first bind). You can then hit ctrl-o, go to controls, and should see "Toggle Cursor" in the list.
Note that you shouldn't do both (manually bind it in default.bind.cs and add it to the bind list).