SetMousePosition vs windows environment cursor position
by Jason Howard · in Torque Game Builder · 05/14/2006 (1:13 pm) · 1 replies
I'm using the following code:
It works great with single-monitor full screen... but in windowed mode, you lose mouse control of the paddle when the mouse leaves the T2D window and becomes the windows mouse cursor outside the application. Trying a trickly little hack like adding "sceneWindow2D.setMousePosition("0, 0");" at the end of the function doesn't solve the problem, because it doesn't reset the mouse position from a Windows environment point of view.
So, is there a way to force the mouse to stay inside the T2D applications & take it completely away from windows? I tried setting sceneWindow2D.lockMouse to true, to no avail. I also tried calling "sceneWindow2D.setLockMouse(true);"...
I'm sure I'm just missing something obvious.
function sceneWindow2D::onMouseMove(%this, %modifier, %worldPosition, %mouseClicks)
{
%newPaddleX = getWord(%worldPosition, 0); // get new mouse X position
%newPaddleX = getWord(%worldPosition, 0); // get new mouse X position
%deltaX = %newPaddleX - $oldPaddleX; // see how far it's moved in the X direction
movePlayerPaddle(%deltaX); // move the player
$oldPaddleX = %newPaddleX; // remember where the mouse was at for future comparisons
}It works great with single-monitor full screen... but in windowed mode, you lose mouse control of the paddle when the mouse leaves the T2D window and becomes the windows mouse cursor outside the application. Trying a trickly little hack like adding "sceneWindow2D.setMousePosition("0, 0");" at the end of the function doesn't solve the problem, because it doesn't reset the mouse position from a Windows environment point of view.
So, is there a way to force the mouse to stay inside the T2D applications & take it completely away from windows? I tried setting sceneWindow2D.lockMouse to true, to no avail. I also tried calling "sceneWindow2D.setLockMouse(true);"...
I'm sure I'm just missing something obvious.
About the author
Torque Owner Jason Howard
Default Studio Name