Jump to content
  • Advertisement
Sign in to follow this  
Mybowlcut

SDL Event & SDL_KEYDOWN

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

Hey. I'm wondering why whenever I produce a SDL_KEYDOWN event (in this case for example, the key m), the event_.motion.x equals 50?
SDL_Rect mouse = {event_.motion.x, event_.motion.y};
In my PollEvent loop, after I press the key m, ...motion.x is equal to 50 ALWAYS and ...motion.y is equal to 0 ALWAYS. Normally I wouldn't care but in this case pressing m displays the co-ordinates of the mouse for my program... Cheers.

Share this post


Link to post
Share on other sites
Advertisement
you can use SDL_MouseMotionEvent and pass the x and y positions by reference. then use the SDL_KeyDown event to active the display of the current mouse position, and have it display the values of the x and y that you passed to the mouse motion event.

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!