Grabbing the mouse and not letting go

Started by
3 comments, last by AIRmichael 17 years, 7 months ago
In games like Quake 3 or whatever, they capture the mouse to the window so that the pointer cannot go outside its borders when you're moving the mouse to spin the camera or whatnot. Can anyone tell me what I would need to do to get that sort of functionality in my OpenGL/GLUT program? Or is it OS-specific? If so, how would I tell Windows to capture the mouse in that manner? (I'm trying to be as OS-agnostic as possible for now). Thanks!
-=-=-=-=-=-=-=-"We are the Dyslexia of Borg. Your ass will be laminated. Futertility is resistant.""SWEET LADY FREEDOM! LET'S MAKE OUT!!"
Advertisement
set mouse position to window position + window width/2, window height/2 each frame, after you get the mouse deltas. Usually only if the app has focus or it can be very annoying.
Quote:Original post by DrEvil
set mouse position to window position + window width/2, window height/2 each frame, after you get the mouse deltas. Usually only if the app has focus or it can be very annoying.


Okay, thanks. I know Windows has SetCursorPos() to do that, but are there any more OS-independent options (such as in opengl/GLUT or something)?
-=-=-=-=-=-=-=-"We are the Dyslexia of Borg. Your ass will be laminated. Futertility is resistant.""SWEET LADY FREEDOM! LET'S MAKE OUT!!"
SDL
glutWarpPointer(x,y)

there you go:)

This topic is closed to new replies.

Advertisement