• Advertisement
Sign in to follow this  

SDL_MOUSEMOTION

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

First post ever woop!

 

Let's say I use SDL_MOUSEMOTION. If I run the application and never move my mouse over my SDL window. Are the mouse coordinates 0, 0 by default? So if I have a player that would "follow" the mouse, would that player move towards 0,0 automatically? Even though I never really made a mouse motion.

Share this post


Link to post
Share on other sites
Advertisement

Well considering SDL_MOUSEMOTION is an event, then the event would get triggered whenever your mouse is moved.  There shouldn't be a mousemove event popping up when the application first starts up (unless you move the mouse of course).  I'm not sure what the default x and y of the mouse would be (I'd assume it would be wherever the mouse currently is within your app) but if you want a specific starting point, you can have a variable that is initialized to what you want.

 

Worst case scenario, just make small sdl program that prints out the mouse value to cout or something.  Then you'll have your answer.

Share this post


Link to post
Share on other sites

Thank you for the reply.

 

The reason i'm asking is, my "player" starts drifting off to 0,0 when the application starts if I never move the mouse inside of the sdl window. If I move the mouse inside of the window "player" starts to follow the mouse just fine. It's like there is magic invisible mouse at 0,0. :D

Share this post


Link to post
Share on other sites

Thank you for the reply.

 

The reason i'm asking is, my "player" starts drifting off to 0,0 when the application starts if I never move the mouse inside of the sdl window. If I move the mouse inside of the window "player" starts to follow the mouse just fine. It's like there is magic invisible mouse at 0,0. biggrin.png

 

Does your own local mouse-position variables start at (0,0)? When do you tell your character to start moving? If your character is always moving, and your local mouse position variables are (0,0), then your character would likely move towards that.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement