PDA

View Full Version : warping cursor



07-21-2006, 03:46 PM
Hi, I'm writing a first person shooter game and need to warp the mouse pointer back to a certain spot every time it is moved. I've done this using glut before but this time im going to use windows, does anyone know how to do this?

zeoverlord
07-21-2006, 05:26 PM
i use this

tagPOINT lpPoint;

GetCursorPos(&lpPoint);
SetCursorPos(300,300);

mousex=(int)lpPoint.x-300;
mousey=(int)lpPoint.y-300;

07-21-2006, 07:10 PM
just what i was looking for thanks!

k_szczech
07-22-2006, 08:04 AM
Little hint - use the SetCursorPos only if your application is in the foreground or do it in response to WM_MOUSEMOVE. It's just nice to have the ability do pause the game and switch to another application.

07-22-2006, 04:36 PM
tanks for the tip, definitly worth keeping in mind