Jump to content
  • Advertisement
Sign in to follow this  
Grain

Resetting the mouse pointer.

This topic is 4992 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 a first person style game but I have a problem looking around. When I move the mouse to far it hits the edge of the screen and I can’t turn any more. How can I avoid this problem so I can turn freely? I was thinking that I could some how reset the pointer to the center of the screen on every WM_MOUSEMOVE. But how do I do that? I spent 3 hours searching through MSDN to no avail.

Share this post


Link to post
Share on other sites
Advertisement
You can use SetCursorPos(X,Y) to set the cursor. So if your resolution was say 640x480, at the beginning of every frame just check if X>320 or X<320 and then call SetCursorPos(320,240) at the end of the frame.

Edit: Damn Prototype beat me to it.

Share this post


Link to post
Share on other sites
I can't offer you exact advice, but if you take a look at Time Based Movement, they make a camera that always centers the cursor. I'm sure they do use SetCursorPos, but there are additional things they do as well. Have a look adn good luck!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!