Sign in to follow this  
Mybowlcut

SDL Event & SDL_KEYDOWN

Recommended Posts

Mybowlcut    176
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
Feralrath    163
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

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