
In C++, maybe Java, I remember using a Robot to change the location of the mouse on the screen. My intention is to do something like in an FPS game where the mouse is always centered to make sure it doesn't run into the edges of the screen. How can I do that in Haskell? I'm using OpenGL, so if there is a utility that specifically works with OpenGL then I believe that would be the most helpful. -Eitan

On Thu, Aug 12, 2010 at 10:50 PM, Eitan Goldshtrom
In C++, maybe Java, I remember using a Robot to change the location of the mouse on the screen. My intention is to do something like in an FPS game where the mouse is always centered to make sure it doesn't run into the edges of the screen. How can I do that in Haskell? I'm using OpenGL, so if there is a utility that specifically works with OpenGL then I believe that would be the most helpful.
This is to do with your choice of windowing for OpenGL. This is often either SDL or GLUT. In GLUT, you'd use glutWarpPointer(). Looking in the Hackage documentation, you can find a function called pointerPosition: http://hackage.haskell.org/packages/archive/GLUT/2.2.2.0/doc/html/Graphics-U... --------------------- pointerPosition :: SettableStateVar Position Source Setting pointerPosition warps the window system's pointer to a new location relative to the origin of the current window by the specified pixel offset, which may be negative. The warp is done immediately. If the pointer would be warped outside the screen's frame buffer region, the location will be clamped to the nearest screen edge. The window system is allowed to further constrain the pointer's location in window system dependent ways. --------------------- Steve

Thanks. That is exactly what I was looking for. I really appreciate the help. -Eitan
participants (2)
-
Eitan Goldshtrom
-
Stephen Sinclair