View Full Version : Getting and setting cursor position

01-13-2008, 03:51 PM
Hi. Do you know how to get and set cursor position?
I know this can be done using GetCursorPos and SetCursorPos from Win32 Api but I want it to work on several OS so I cant use Win32 specific functions. Thanks.

01-13-2008, 03:56 PM
Platform specific. You need to use native APIs to do that, so you need to use #if/#else.

01-13-2008, 04:19 PM
Use the ncurses library if you want a degree of portability in your console applications, and want more than what printf/cout can manage.

01-13-2008, 04:32 PM
@Elysia : how to do this using linux API?

@Salem : Im making a 3D FPS using OpenGL so ncurses may not be that usefull

01-13-2008, 05:09 PM


01-13-2008, 05:11 PM
I love it when people are really specific about what they're trying to achieve :rolleyes:
Even more so when they spam the same vagueness over several forums.

01-13-2008, 05:13 PM
why are you giving this link about mapping fonts?

Well Im making a 3D spacesim first person shooter in OpenGL. I want to be able to rotate with the mouse passive motion but when the mouse goes out of the game window, thinks start going wrong. I found a program where this issue was handled and the guy was using GetCursorPos and SetCursorPos from Win32 API so I want to do the same without using Win32 API because my game must be working on linux.

Sorry for explaining badly what I want to do, english is not my native language... and sorry for spamming too, no excuse.

So I have to use linux's API but can you tell me where to look? witch functions to use? never used platform specific API before. Thanks.

01-13-2008, 07:23 PM
XQueryPointer() (http://www.xfree86.org/4.4.0/XQueryPointer.3.html)
XWarpPointer() (http://www.xfree86.org/4.4.0/XWarpPointer.3.html)
The Xlib Manual (http://tronche.com/gui/x/xlib/)


01-14-2008, 05:27 AM