Mouse Movement
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
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
WWW.TREEPENGUIN.TK
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
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
Popular Topics
Advertisement