Sign in to follow this  

SDL Event & SDL_KEYDOWN

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

This topic is 3677 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this