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

Author Topic: Mouse Position Delta  (Read 2873 times)

0 Members and 1 Guest are viewing this topic.

Magtheridon96

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
Mouse Position Delta
« on: June 23, 2013, 12:24:14 pm »
It would be nice if the MouseMoveEvent struct:

struct MouseMoveEvent
{
    int x; ///< X position of the mouse pointer, relative to the left of the owner window
    int y; ///< Y position of the mouse pointer, relative to the top of the owner window
};

were to have 2 more useful members:

struct MouseMoveEvent
{
    int x;      ///< X position of the mouse pointer, relative to the left of the owner window
    int y;      ///< Y position of the mouse pointer, relative to the top of the owner window
    int deltaX; ///< Difference in X position of the mouse pointer, relative to the left of the owner window
    int deltaY; ///< Difference in Y position of the mouse pointer, relative to the top of the owner window
};

Currently, I have to calculate them manually by constantly tracking MouseMoved events.
I think it would be cleaner to have SFML do it.

The implementation should be simple, but that's none of my business, so I'll leave it at that.
« Last Edit: June 23, 2013, 12:26:51 pm by Magtheridon96 »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Mouse Position Delta
« Reply #1 on: June 23, 2013, 12:56:29 pm »
Quote
Currently, I have to calculate them manually by constantly tracking MouseMoved events.
You already constantly track MouseMoved events anyway, so calculating the delta on your side is just an extra line of code. Is it worth requesting it as a new feature?

I agree, it should be simple. But things may be trickier in border cases, like when focus is lost/gained, when mouse enters/leaves the window, when the mouse is moved programmatically, etc.
Laurent Gomila - SFML developer

Magtheridon96

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
Re: Mouse Position Delta
« Reply #2 on: June 23, 2013, 01:36:17 pm »
Quote
But things may be trickier in border cases, like when focus is lost/gained, when mouse enters/leaves the window, when the mouse is moved programmatically, etc.

Well, that settles it :v
I guess it might not be worth it after all.