diff options
Diffstat (limited to 'kurator/src/markers.cpp')
-rw-r--r-- | kurator/src/markers.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/kurator/src/markers.cpp b/kurator/src/markers.cpp index 436bd33..b92f7d3 100644 --- a/kurator/src/markers.cpp +++ b/kurator/src/markers.cpp @@ -1,10 +1,12 @@ #include "markers.h" #include <cmath> +#include <functional> #include <string> #include <utility> #include <entt/entity/entity.hpp> +#include <entt/entity/handle.hpp> #include <raylib.h> #include <kurator/engine/Point.h> @@ -36,7 +38,7 @@ attach_markers(sim::State& ctx) void -update_markers(sim::State& ctx) +update_markers(sim::State& ctx, std::function<void(entt::handle)> select) { engine::Point mouse {static_cast<double>(GetMouseX()), static_cast<double>(GetMouseY())}; entt::entity hover {entt::null}; @@ -50,6 +52,8 @@ update_markers(sim::State& ctx) if (ctx.registry.valid(hover)) { auto& marker = ctx.registry.get<Marker>(hover); marker.hovered = true; + if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT) && select) + select(entt::handle{ctx.registry, hover}); } } |