Jump to content
  • Advertisement
Sign in to follow this  
Slider38

Mouse problem solved

This topic is 4843 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 posted a while back because I was having trouble getting some game code in progress to run on my new pc. I finally upgraded from an old 900 mgh machine to a new 3 gig one. But my mouse was jumping all over the place. I previously had code within do loops that looked partially like this: // get the input from the mouse lpdimouse->GetDeviceState(sizeof(DIMOUSESTATE), (LPVOID)&mouse_state); // move the mouse cursor mouse_x+=(mouse_state.lX); mouse_y+=(mouse_state.lY); This worked fine on my old machine, but not the new one. It basically tracked the mouse cursor in order to determine which button the user pressed. I couldn't figure out what was going on. Through some trial and error, I found the addition of this line solved my problem: // get the input from the mouse lpdimouse->GetDeviceState(sizeof(DIMOUSESTATE), (LPVOID)&mouse_state); // move the mouse cursor mouse_x+=(mouse_state.lX); mouse_y+=(mouse_state.lY); SetCursorPos(mouse_x, mouse_y); By re-setting the cursor position everytime through the loop, the mouse now moves as it should without jumping around the screen. I'm still not exactly sure why the old code didn't work on the new box, but maybe this might save someone else some grief. I hope so. Slider

Share this post


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