Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Window.input() or Mousemove event ?  (Read 1739 times)

0 Members and 1 Guest are viewing this topic.

freesoul

  • Newbie
  • *
  • Posts: 19
    • View Profile
Window.input() or Mousemove event ?
« 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

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Window.input() or Mousemove event ?
« Reply #1 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.

If you don't use a custom cursor then there's no reason at all to update the mouse... ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

freesoul

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: Window.input() or Mousemove event ?
« Reply #2 on: September 24, 2012, 02:40:12 pm »
Nice, thanks, that was good. I will pass my project to SFML 2.0 soon

 

anything