Jump to content
  • Advertisement
Sign in to follow this  
Renran

SDL_MOUSEMOTION Problem

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

Hello, In my program : switch (event.type) { case SDL_QUIT: bQuit = true; break; case SDL_MOUSEMOTION: newx = event.motion.x; // get x and y value from mouse newy = event.motion.y; break; case SDL_KEYDOWN: keyboard(&(event.key)); if (event.key.keysym.sym == SDLK_ESCAPE) bQuit = true; The problem is: When I press a key on the keyboard, then newx and newy get an input that is not their actually place on the screen. This input can be 20000 .... -2 or something, anything. Why is this happening? Greetings RenRan

Share this post


Link to post
Share on other sites
Advertisement
Probably because (a) you don't have a 'break' after your key handling code, and (b) something else in your switch statement after that point does something with newx and newy. Unfortunately you didn't post the whole statement so I can only guess.

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!