From 38159a5f843e7355ab63fca12a1762d59caeabb2 Mon Sep 17 00:00:00 2001 From: "Zed A. Shaw" Date: Wed, 11 Jun 2025 00:56:41 -0400 Subject: [PATCH] Fix the window coordinates so that you can resize. --- gui/fsm.cpp | 4 ++-- gui/guecstra.cpp | 5 ++--- gui/guecstra.hpp | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/gui/fsm.cpp b/gui/fsm.cpp index 02055f5..aaf868d 100644 --- a/gui/fsm.cpp +++ b/gui/fsm.cpp @@ -157,7 +157,7 @@ namespace gui { case MOUSE_MOVE: { if($grab_source) { auto& source = $loot_ui.$gui.get(*$grab_source); - source.move($router.position); + source.move($window.mapPixelToCoords($router.position)); } mouse_action(true); } break; @@ -207,7 +207,7 @@ namespace gui { case MOUSE_MOVE: { if($grab_source) { auto& source = $status_ui.$gui.get(*$grab_source); - source.move($router.position); + source.move($window.mapPixelToCoords($router.position)); } mouse_action(true); } break; diff --git a/gui/guecstra.cpp b/gui/guecstra.cpp index fc11aa9..5b32023 100644 --- a/gui/guecstra.cpp +++ b/gui/guecstra.cpp @@ -31,10 +31,9 @@ namespace guecs { sprite = sp.sprite; } - void GrabSource::move(sf::Vector2i pos) { + void GrabSource::move(sf::Vector2f pos) { if(sprite) { - sprite->setPosition({ - float(pos.x), float(pos.y)}); + sprite->setPosition(pos); } } } diff --git a/gui/guecstra.hpp b/gui/guecstra.hpp index 2640fbf..c96d6d2 100644 --- a/gui/guecstra.hpp +++ b/gui/guecstra.hpp @@ -15,7 +15,7 @@ namespace guecs { DinkyECS::Entity grab(); void setSprite(guecs::UI& gui, guecs::Entity gui_id); - void move(sf::Vector2i pos); + void move(sf::Vector2f pos); }; struct DropTarget {