|
Unlimited mouse movement |
count
Member #5,401
January 2005
|
Note: I'm using openlayer for my program. I want my program to scroll when the rightmouse button is pressed. I'm using this code: int mouseXMovement, mouseYMovement; get_mouse_mickeys( &mouseXMovement, &mouseYMovement ); if( mouse_b == 2 ) { worldX += mouseXMovement; worldY += mouseYMovement; }
But when the mouse cursor reaches the DESKTOP Borders the mouse stops moving and the mickeys will stay at zero. This happens WINDOWED and FULLSCREEN. I can't remember, but i think this method worked with plain allegro.
|
gnolam
Member #2,030
March 2002
|
int mouseXMovement, mouseYMovement; get_mouse_mickeys( &mouseXMovement, &mouseYMovement ); position_mouse(SCREEN_W/2, SCREEN_H/2); if( mouse_b == 2 ) { worldX += mouseXMovement; worldY += mouseYMovement; }
-- |
count
Member #5,401
January 2005
|
Easy and effective!
|
Richard Phipps
Member #1,632
November 2001
|
Just be careful if you want to Alt-tab away because if your program isn't paused your mouse will not be properly movable. |
count
Member #5,401
January 2005
|
Hmm.. true. Just changed the code to this: if( mouse_b == 2 ) { int mouseXMovement, mouseYMovement; get_mouse_mickeys( &mouseXMovement, &mouseYMovement ); position_mouse(SCREEN_W/2, SCREEN_H/2); worldX += mouseXMovement; worldY += mouseYMovement; } So the code still works and the alt-tab problem is solved. Thank you for noting that!
|
|