Jump to content

View more

Image of the Day

Boxes as reward for our ranking mode. ヾ(☆▽☆)
#indiedev #gamedev #gameart #screenshotsaturday https://t.co/ALF1InmM7K
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

SDL_MOUSEMOTION

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
4 replies to this topic

#1 Rastamanbegood   Members   

141
Like
0Likes
Like

Posted 01 December 2013 - 11:04 AM

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.



#2 SonicD007   Members   

464
Like
0Likes
Like

Posted 01 December 2013 - 11:55 AM

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.



#3 Rastamanbegood   Members   

141
Like
0Likes
Like

Posted 01 December 2013 - 01:37 PM

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



#4 Servant of the Lord   Members   

33692
Like
0Likes
Like

Posted 01 December 2013 - 01:46 PM

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.


It's perfectly fine to abbreviate my username to 'Servant' or 'SotL' rather than copy+pasting it all the time.
All glory be to the Man at the right hand... On David's throne the King will reign, and the Government will rest upon His shoulders. All the earth will see the salvation of God.
Of Stranger Flames - [indie turn-based rpg set in a para-historical French colony] | Indie RPG development journal | [Fly with me on Twitter]

#5 Rastamanbegood   Members   

141
Like
0Likes
Like

Posted 02 December 2013 - 05:45 AM

The fog is clearing. Thanks :)






Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.