Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Ructions

Mouse Movement

This topic is 5264 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!