Jump to content
  • Advertisement


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


Stopping the mouse

This topic is 5800 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

Ok, heres the thing. In my game I''ve got everythign set up and I''m just about ready to start on A.I. and stuff, but the mouse won''t stop at the edge of the screen. I''ve tested for hitting the bounds of the screen, and even out to 30 pixels away from the edge on the top and bottom, but the mouse moves more than 30 pixels per frame. So I was wondering if there was some technique I didn''t know about or something. Thanks. Hibiki Wheres the any key?

find your element at mutedfaith.com. <º>

Share this post

Link to post
Share on other sites
If you''re talking about your in-game cursor, why not something like
if(cursor.x_pos > screen_max_x_pos)
cursor.x_pos = screen_max_x_pos;

If Win32 cursor, you can grab the current mouse pos at the beginning and use SetCursorPos (IIRC) to set it back to that position every frame, taking the difference between that point and where it has moved to and using those coordinates as the movement vector.

Ask if you need implementation details.


//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links

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!