Game Development Community

Disable crossHair and enable cursor

by gamer · in Torque Game Engine · 06/16/2006 (6:31 pm) · 2 replies

In my fps, initially there's only crossHair and no mouse cursor, I want to let the cursor reappear and then move it over to the control panel by the click of a key, so I did the following to enable the mouse cursor:
function gotoControlPanel()
{
	error("goto control");
	//moveMap.pop();
	PlayGui.noCursor="0";
	ControlPanel.noCursor="0";
	%pos=ControlPanelCtrl.position;
	
	Canvas.setCursorPos(%pos);
}

the problem is that the cursor doesn't really appear until the I move the crossHair to a collidable body, and then the crossHair is disabled and cursor appears.
so what else do I need to do besides set PlayGui.noCursor ="0" in order to disable the crossHair and enable the cursor dynamically.
thanks!

#1
06/16/2006 (6:37 pm)
Another problem is that if I call Canvas.setCursorPos(%pos); and then I move the mouse again, the mouse goes back to the original position before I made the call.
so how should I move the mouse cursor?
thanks!!
#2
06/16/2006 (7:48 pm)
Here you go...this will give you a cursor by pressing the "m" key:

add the following to your defaultbinds.cs

function toggleMouseLook(%val)
{
   if(%val)
   {
      if(Canvas.isCursorOn())
         CursorOff();
      else
         CursorOn();
   }
}

moveMap.bind(keyboard, "m",  "toggleMouseLook");

It wont kill the crosshair, but it is probably more efficient and can be built upon.