Removed hover on guecs::UI::mouse and now use a generic 16 bit modifier bitset. Also finally fixed Clickable so it just a simple callback with only the modifiers.
This commit is contained in:
parent
4c019048d0
commit
5d0d8b16fc
5 changed files with 29 additions and 41 deletions
|
@ -169,8 +169,8 @@ struct CalculatorUI {
|
|||
$gui.set<guecs::Text>(id, { label });
|
||||
wchar_t op = label[0];
|
||||
$gui.set<guecs::Clickable>(id, {
|
||||
[&, op](auto, auto) { handle_button(op); }
|
||||
});
|
||||
[&, op](auto) { handle_button(op); }
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,8 +182,8 @@ struct CalculatorUI {
|
|||
// $gui.debug_layout(window);
|
||||
}
|
||||
|
||||
void mouse(float x, float y, bool hover) {
|
||||
$gui.mouse(x, y, hover);
|
||||
void mouse(float x, float y, guecs::Modifiers mods) {
|
||||
$gui.mouse(x, y, mods);
|
||||
}
|
||||
|
||||
void handle_button(wchar_t op) {
|
||||
|
|
|
@ -94,7 +94,7 @@ struct ClickerUI {
|
|||
$gui.set<guecs::Effect>(id, {});
|
||||
$gui.set<guecs::Icon>(id, { "clicker_treat_bone" });
|
||||
$gui.set<guecs::Clickable>(id, {
|
||||
[&](auto, auto) { handle_button(Event::A_BUTTON); }
|
||||
[&](auto) { handle_button(Event::A_BUTTON); }
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ struct ClickerUI {
|
|||
$gui.set<guecs::Sprite>($clicker, {"clicker_the_dog"});
|
||||
$gui.set<guecs::Sound>($clicker, {"clicker_bark"});
|
||||
$gui.set<guecs::Clickable>($clicker, {
|
||||
[&](auto, auto) { handle_button(Event::CLICKER); }
|
||||
[&](auto) { handle_button(Event::CLICKER); }
|
||||
});
|
||||
|
||||
// custom components need to be initialized manually
|
||||
|
@ -126,8 +126,8 @@ struct ClickerUI {
|
|||
// $gui.debug_layout(window);
|
||||
}
|
||||
|
||||
void mouse(float x, float y, bool hover) {
|
||||
$gui.mouse(x, y, hover);
|
||||
void mouse(float x, float y, guecs::Modifiers mods) {
|
||||
$gui.mouse(x, y, mods);
|
||||
}
|
||||
|
||||
void handle_button(Event ev) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue