aboutsummaryrefslogtreecommitdiff
path: root/src/ctrl/mouse.h
diff options
context:
space:
mode:
authorvimene <vincent.menegaux@gmail.com>2025-01-03 08:19:05 +0100
committervimene <vincent.menegaux@gmail.com>2025-01-03 08:19:05 +0100
commit0485661fd05af686acf886cb2c96dd4a5e38bb4d (patch)
tree6676d203c3c3156f4c45bdc90cc7dd8b8ec1efaa /src/ctrl/mouse.h
parent77cd3a0538d342e25010132317734f27af4bed8e (diff)
downloadengine-0485661fd05af686acf886cb2c96dd4a5e38bb4d.tar.gz
improved keyboard and mouse controlsHEADmaster
Diffstat (limited to 'src/ctrl/mouse.h')
-rw-r--r--src/ctrl/mouse.h13
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;
};
}