Arena/Bossfight now maps mouse coordinates better.

This commit is contained in:
Zed A. Shaw 2025-12-20 12:05:45 -05:00
parent 4b4f9b3916
commit d4d8d8ca99
2 changed files with 5 additions and 3 deletions

View file

@ -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");

View file

@ -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<DinkyECS::World> world,
DinkyECS::Entity boss_id,