Fixed the problem where the only way to complete a grab/drop operation was to capture the MOUSE_CLICK directly. Solution was to move the mouse processing out of DNDLoot and only handle the MOUSE_MOVE/DRAG.

This commit is contained in:
Zed A. Shaw 2025-06-24 11:33:37 -04:00
parent 6a72d1160f
commit f559b5a39d
6 changed files with 32 additions and 43 deletions

View file

@ -16,15 +16,21 @@ namespace gui {
);
}
inline void make_clickable_area(GameLevel& level, guecs::UI &gui, const std::string &name) {
auto area = gui.entity(name);
gui.set<Clickable>(area, {
[&](auto ent, auto data) {
level.world->send<Events::GUI>(Events::GUI::AIM_CLICK, ent, data);
}
});
}
void OverlayUI::init() {
$gui.init();
auto bottom = $gui.entity("bottom");
$gui.set<Clickable>(bottom, {
[&](auto ent, auto data) {
$level.world->send<Events::GUI>(
Events::GUI::AIM_CLICK, ent, data);
}
});
make_clickable_area($level, $gui, "top");
make_clickable_area($level, $gui, "middle");
make_clickable_area($level, $gui, "bottom");
}
void OverlayUI::render(sf::RenderWindow& window) {