Trouble turning on and off cursor()
by Isaac Dutton · in Torque Game Engine · 02/23/2006 (2:31 pm) · 6 replies
I am curious if it is possible to right code for when the mouse is down and then when it is released?
The reason I am doing this is because I want to use mouse look only when the right mouse button is down, other times I want to show the cursor (ya ya you guessed it I am doing an rpg) I have looked around the forum and around the docs and really cant find anything, any ideas or out look on this would be awesome!
Thanks
Isaac
The reason I am doing this is because I want to use mouse look only when the right mouse button is down, other times I want to show the cursor (ya ya you guessed it I am doing an rpg) I have looked around the forum and around the docs and really cant find anything, any ideas or out look on this would be awesome!
Thanks
Isaac
About the author
#2
02/23/2006 (3:21 pm)
If statements?
#3
something like
if rightmouse == 1
But I am not sure what to use for checking the right mouse button lols!
For instance I know I can make a function to handle it and then just bind the right mouse button to that function
but that meens they would have to press the mouse button move the camera and then press it again to lock it in place, I am looking for something that I could run code when the button is pressed, and then again when the button is released
02/23/2006 (3:24 pm)
I relise how an if statement works and stuff like that.. what I am having problems with is finding the variable that the right mouse button uses if it is down and upsomething like
if rightmouse == 1
But I am not sure what to use for checking the right mouse button lols!
For instance I know I can make a function to handle it and then just bind the right mouse button to that function
but that meens they would have to press the mouse button move the camera and then press it again to lock it in place, I am looking for something that I could run code when the button is pressed, and then again when the button is released
#4
02/23/2006 (3:49 pm)
moveMap.bind( mouse, button1, mouseRight ); // button1 is the right mouse button
function mouseRight(%val)
{
if(%val)
{
$mouseRightDown = true;
}
else
{
$mouseRightDown = false;
}
}
function checkMouse()
{
if($mouseRightDown $= true)
{
callThisFunction();
}
else
{
//do nothing
}
}
#6
This is the code I am using right now to show and hide the mouse cursor when the right mouse button is clicked, sadly after the mouse button is shown, the right click I think goes to it instead of the scene. Any ideas here, to hide the cursor when the right button is released!
02/23/2006 (4:18 pm)
function mouseRight(%val)
if(%val)
{
$mouseRightDown = true;
CursorOff();
}
else
{
$mouseRightDown = false;
CursorOn();
}This is the code I am using right now to show and hide the mouse cursor when the right mouse button is clicked, sadly after the mouse button is shown, the right click I think goes to it instead of the scene. Any ideas here, to hide the cursor when the right button is released!
Torque Owner Isaac Dutton
I am not looking for the source code, I can write the code to do all this, I am just looking for how I would go about running code when the mouse is down, and then running code when its up!
thanks again
Isaac