diff --git a/boss/fight.cpp b/boss/fight.cpp index 9dd67e8..18fcf66 100644 --- a/boss/fight.cpp +++ b/boss/fight.cpp @@ -173,13 +173,14 @@ namespace boss { bool Fight::handle_mouse(game::Event ev) { using enum game::Event; + $mouse_pos = $window->mapPixelToCoords($router.position); switch(ev) { case MOUSE_CLICK: { - $ui.mouse($router.position.x, $router.position.y, guecs::NO_MODS); + $ui.mouse($mouse_pos.x, $mouse_pos.y, guecs::NO_MODS); } break; case MOUSE_MOVE: { - $ui.mouse($router.position.x, $router.position.y, {1 << guecs::ModBit::hover}); + $ui.mouse($mouse_pos.x, $mouse_pos.y, {1 << guecs::ModBit::hover}); } break; case MOUSE_DRAG: dbc::log("mouse drag"); diff --git a/boss/fight.hpp b/boss/fight.hpp index b291c5e..ba01111 100644 --- a/boss/fight.hpp +++ b/boss/fight.hpp @@ -29,7 +29,8 @@ namespace boss { boss::UI $ui; DinkyECS::Entity $host = DinkyECS::NONE; components::Combat* $host_combat = nullptr; - gui::routing::Router $router; + gui::routing::Router $router{}; + sf::Vector2f $mouse_pos{}; Fight(shared_ptr world, DinkyECS::Entity boss_id,