diff options
Diffstat (limited to 'src/ctrl/mouse.h')
-rw-r--r-- | src/ctrl/mouse.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/ctrl/mouse.h b/src/ctrl/mouse.h index 8b66cee..521b0a4 100644 --- a/src/ctrl/mouse.h +++ b/src/ctrl/mouse.h @@ -3,16 +3,19 @@ #include "math/vector.h" -using engine::math::Vector2; - namespace engine::controllers { +template<typename MouseMotionCallback> class Mouse { public: - bool moved; - Vector2 rel_motion; + constexpr Mouse(MouseMotionCallback mouse_motion_cb) : mouse_motion_cb{mouse_motion_cb} {} + + void mouse_motion_event(Vector2 rel) const & { + mouse_motion_cb(rel); + } - constexpr Mouse() : moved{false}, rel_motion{0.f, 0.f} {} + private: + MouseMotionCallback mouse_motion_cb; }; } |