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

Author Topic: Most simple way to get cursor coordinates?  (Read 2673 times)

0 Members and 1 Guest are viewing this topic.

bastien

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • http://bastien-leonard.alwaysdata.net
Most simple way to get cursor coordinates?
« on: November 03, 2010, 02:04:26 pm »
The only way I found to get the cursor's coordinates at any time is to use Input::GetMouseX/Y. Is there anything more straightforward? Window has SetCursorPosition() apparently, but no GetCursorPosition(). Why?
Check out pysfml-cython, an up to date Python 2/3 binding for SFML 2: https://github.com/bastienleonard/pysfml-cython

Relic

  • Newbie
  • *
  • Posts: 43
    • View Profile
Most simple way to get cursor coordinates?
« Reply #1 on: November 03, 2010, 04:41:43 pm »
You can get the cursor position if you handle events of type MouseMoved.

bastien

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • http://bastien-leonard.alwaysdata.net
Most simple way to get cursor coordinates?
« Reply #2 on: November 04, 2010, 06:08:03 pm »
I might be totally wrong on this, but I thought that the windowing API used by SFML already had some function to cursor coordinates, and that sf::Input used that.
If that's the case, it would be more straightforward and less CPU-consuming to call that function instead of tracking the cursor manually.
Check out pysfml-cython, an up to date Python 2/3 binding for SFML 2: https://github.com/bastienleonard/pysfml-cython

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Most simple way to get cursor coordinates?
« Reply #3 on: November 04, 2010, 07:28:06 pm »
sf::Input totally relies on events, it doesn't make any OS call.
Laurent Gomila - SFML developer

 

anything