SFML community forums

Help => General => Topic started by: freesoul on September 23, 2012, 02:30:42 pm

Title: Window.input() or Mousemove event ?
Post by: freesoul on September 23, 2012, 02:30:42 pm
Hello, I wonder what's better for moving mouse pointer between these two options:

- Update mouse coords in EACH loop, whether the mouse was moved or not with window.GetInput()

- Update mouse coords only when I get the MouseMove (or MouseMoved idk why there are these two) event, with coords in the event message.

thanks
Title: Re: Window.input() or Mousemove event ?
Post by: eXpl0it3r on September 23, 2012, 03:16:52 pm
I guess you're talking about a user defined cursor, i.e. sprite, right?
It's better to update it each iteration, but not with GetInput() because that's SFML 1.6, which you shouldn't use anymore. On SFML 1.6 hasn't been really worked on it for around 3years and SFML 2 has many many new features.
In SFML 2 you can use sf::Mouse::getPosition(), as described in this tutorial (https://github.com/SFML/SFML/wiki/TutorialChangeCursor).

If you don't use a custom cursor then there's no reason at all to update the mouse... ;)
Title: Re: Window.input() or Mousemove event ?
Post by: freesoul on September 24, 2012, 02:40:12 pm
Nice, thanks, that was good. I will pass my project to SFML 2.0 soon