Skip to main content
GameDev.net gamedev.net
🔒 Locked

Mouse Movement

Started by Ructions Apr 22, 2004 at 4:53 AM 2 replies 500+ views
Original Post
Ructions
Ructions
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
Tree Penguin
Tree Penguin
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
Ructions
Ructions
Would You Have Some Sample Code of That Please.

Thanks In Advance
Ructions
Tree Penguin
Tree Penguin
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

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.