How would one "lock" the mouse to a certain OpenGL window. Sort of like how it is done in Minecraft. Is GameDev a better place to ask?
Asked
Active
Viewed 809 times
1
-
4OpenGL doesn't handle user input, as input is platform-dependent. A very simple solution is to just hide the cursor and set it's position to the center of the window every frame. However, this will leave you with less accurate and OS-accelerated mouse values. The other solutions will depend on which platform you're using. – Robert Rouhani Jul 06 '12 at 04:19
2 Answers
0
A similar question has been asked here, where a programmer used a class called robot to change the mouse position.
Code: Robot.moveMouse(x,y)
This code was written in java, however, There are several classes like robot that can do the trick!
One option is to constantly move the mouse to the center of the screen or wherever you want it.

Adrian Mole
- 49,934
- 160
- 51
- 83

Noel Augustine
- 11
- 1