Refactored the mouse handling to use the new guecss Modifiers system and improved Clickable.

This commit is contained in:
Zed A. Shaw 2025-08-14 14:10:28 -04:00
parent ad0069e899
commit a86912705c
20 changed files with 67 additions and 64 deletions

View file

@ -51,7 +51,7 @@ namespace gui {
auto open_close_toggle = $gui.entity("ritual_ui");
$gui.set<Clickable>(open_close_toggle, {
[&](auto, auto){ event(Event::TOGGLE); }
[&](auto){ event(Event::TOGGLE); }
});
@ -110,8 +110,8 @@ namespace gui {
}
}
bool UI::mouse(float x, float y, bool hover) {
return $gui.mouse(x, y, hover);
bool UI::mouse(float x, float y, guecs::Modifiers mods) {
return $gui.mouse(x, y, mods);
}
bool UI::is_open() {
@ -172,7 +172,7 @@ namespace gui {
$gui.set_init<Sprite>(slot_id, {item});
$gui.set<Clickable>(slot_id, {
[&, slot_id, item_id](auto, auto) {
[&, slot_id, item_id](auto) {
auto data = std::make_any<SelectedItem>(slot_id, item_id);
event(Event::SELECT, data);
}
@ -231,7 +231,7 @@ namespace gui {
}
$gui.set<Clickable>(combine, {
[&](auto, auto){ event(Event::COMBINE); }
[&](auto){ event(Event::COMBINE); }
});
} else {
$gui.show_text("result_text", L"That won't work.");