Mouse Movement

Started by
2 comments, last by Ructions 19 years, 12 months ago
i am making an arkanoid type game and am using the mouse to move the paddle. i have it set up that if the mouse points goes past a certain point that it goes back to the center of the screen to that the paddle will move all the way across. but its not working right. i was wonder what other ways is there to do this. Please Help. Thanks in Advance Ructions
Advertisement
what i did is getting the mouse pos at startup and after each movement-check i''d reset it''s position (GetCursorPos and SetCursorPos), then just hide the mouse cursor and you''re done.

WWW.TREEPENGUIN.TK
Would You Have Some Sample Code of That Please.

Thanks In Advance
Ructions
At startup:

POINT p;
GetCursorPos(&p);

the initial cursor pos is now stored in p
when you want to check the mouse movement:

POINT cp;
GetCursorPos(&cp);

the current cursor pos is now stored in cp
movementx = cp.x-p.x
movementy = cp.y-p.y

you now know the mouse movement, reset the cursor pos:

SetCursorPos(&p);


WWW.TREEPENGUIN.TK

This topic is closed to new replies.

Advertisement