PDA

View Full Version : Cross-platform Setting Cursor Position



Omariko
03-04-2008, 10:24 AM
Hi all,
I am developing a game using OpenGL and GLUT(fps), but I am facing a problem with the mouse cursor. The player rotates around based on the mouse cursor movement on the screen. The problem is, once the mouse reaches the screen border, the player can't turn anymore.

Now, my question is, is there a cross-platform way to reset the cursor position? (i know i can use #include <windows> and use its functions, but I don't want to include windows because it's bulky and not cross-platform)

Thanks

ZbuffeR
03-04-2008, 10:31 AM
Use GLFW (http://glfw.sourceforge.net/) instead of GLUT.
Much more game-oriented than glut, and still cross-platform.

Omariko
03-05-2008, 12:15 PM
Thanx Zbuffer.
I went through the GLFW Reference Manual and I found exactly what I was looking for!

The function is:
glfwSetMousePos( int xpos, int ypos )

Thanx again! :)

OneSadCookie
03-05-2008, 12:57 PM
GLUT has glutWarpPointer too...

Omariko
03-05-2008, 01:17 PM
hmmm...interesting...
I guess as I am half way through development using GLUT, am gonna stick to it and use glutWarpPointer(), but am definitely switching to GLFW for future projects.
Thanx, all!