Mouse cursor problems
by Richard Preziosi · in General Discussion · 04/16/2008 (5:07 pm) · 4 replies
After a few hours I could not resolve this myself nor has anyone else resolved it that i could find through my searches.
I've been able to successfully bind a right mouse look option in my game. However, I have not been able to bind a cursor toggle with this.
Example: hold the right mouse button to look around, release it to click different parts of the interface with the cursor.
The mission editor does exactly what I am trying to achieve. However if i put a show cursor in with my "freelook" function I can get the cursor to show, but can't get it to go away when i hold the right mouse button.
my basic code that works for the right click look that i came up with is:
moveMap.bind( mouse, button1, FreeLook);
function FreeLook(%val)
{
if (%val)
{
echo("pressed.......");
moveMap.bind( mouse, xaxis, yaw );
moveMap.bind( mouse, yaxis, pitch );
}
else
{
echo("released.....");
moveMap.bind( mouse, xaxis, "");
moveMap.bind( mouse, yaxis, "");
}
}
I've tried putting in cursoroff/on() canvas.setcursor() and things like that, but i just can't get it to work. Like i said i get the initial working, but as soon as i let go and the cursor comes up, i'm stuck. Any help is appreciated, thanks.
I've been able to successfully bind a right mouse look option in my game. However, I have not been able to bind a cursor toggle with this.
Example: hold the right mouse button to look around, release it to click different parts of the interface with the cursor.
The mission editor does exactly what I am trying to achieve. However if i put a show cursor in with my "freelook" function I can get the cursor to show, but can't get it to go away when i hold the right mouse button.
my basic code that works for the right click look that i came up with is:
moveMap.bind( mouse, button1, FreeLook);
function FreeLook(%val)
{
if (%val)
{
echo("pressed.......");
moveMap.bind( mouse, xaxis, yaw );
moveMap.bind( mouse, yaxis, pitch );
}
else
{
echo("released.....");
moveMap.bind( mouse, xaxis, "");
moveMap.bind( mouse, yaxis, "");
}
}
I've tried putting in cursoroff/on() canvas.setcursor() and things like that, but i just can't get it to work. Like i said i get the initial working, but as soon as i let go and the cursor comes up, i'm stuck. Any help is appreciated, thanks.
#2
Thanks,
Tannayr
03/02/2009 (12:52 am)
I've been away for a while, and recently came back, but through searching I see that nobody has achieved this effect as of yet, or atleast that I could find. So I wanted to reopen this and see if anyone had any new ideas.Thanks,
Tannayr
#3
www.garagegames.com/community/resources/view/16527
03/02/2009 (1:24 am)
As per our IRC conversation, here is the solution to your problem:www.garagegames.com/community/resources/view/16527
#4
03/02/2009 (1:24 am)
^
Torque Owner Richard Preziosi
WinterLeaf Entertainment
moveMap.bind( mouse, button1, FreeLook); moveMap.bind( keyboard, m, toggleMouse); function FreeLook(%val) { if (%val) { echo("pressed......."); cursorOff(); moveMap.bind( mouse, xaxis, yaw ); moveMap.bind( mouse, yaxis, pitch ); } else { echo("released....."); moveMap.bind( mouse, xaxis, ""); moveMap.bind( mouse, yaxis, ""); CursorOn(); } } function toggleMouse() { if (Canvas.isCursorOn()) CursorOff(); else CursorOn(); }