Browse Source

Sdl2Application: support for relative position in mouse move event.

pull/7/head
Vladimír Vondruš 14 years ago
parent
commit
5b16dbb550
  1. 2
      src/Platform/Sdl2Application.cpp
  2. 11
      src/Platform/Sdl2Application.h

2
src/Platform/Sdl2Application.cpp

@ -117,7 +117,7 @@ int Sdl2Application::exec() {
} break; } break;
case SDL_MOUSEMOTION: { case SDL_MOUSEMOTION: {
MouseMoveEvent e({event.motion.x, event.motion.y}); MouseMoveEvent e({event.motion.x, event.motion.y}, {event.motion.xrel, event.motion.yrel});
mouseMoveEvent(e); mouseMoveEvent(e);
break; break;
} }

11
src/Platform/Sdl2Application.h

@ -371,6 +371,13 @@ class Sdl2Application::MouseMoveEvent: public Sdl2Application::InputEvent {
/** @brief Position */ /** @brief Position */
inline Math::Vector2<int> position() const { return _position; } inline Math::Vector2<int> position() const { return _position; }
/**
* @brief Relative position
*
* Position relative to previous event
*/
inline Math::Vector2<int> relativePosition() const { return _relativePosition; }
/** /**
* @brief Modifiers * @brief Modifiers
* *
@ -379,9 +386,9 @@ class Sdl2Application::MouseMoveEvent: public Sdl2Application::InputEvent {
Modifiers modifiers(); Modifiers modifiers();
private: private:
inline MouseMoveEvent(const Math::Vector2<int>& position): _position(position), modifiersLoaded(false) {} inline MouseMoveEvent(const Math::Vector2<int>& position, const Math::Vector2<int>& relativePosition): _position(position), _relativePosition(relativePosition), modifiersLoaded(false) {}
const Math::Vector2<int> _position; const Math::Vector2<int> _position, _relativePosition;
bool modifiersLoaded; bool modifiersLoaded;
Modifiers _modifiers; Modifiers _modifiers;
}; };

Loading…
Cancel
Save