Refactored the mouse handling to use the new guecss Modifiers system and improved Clickable.
This commit is contained in:
parent
ad0069e899
commit
a86912705c
20 changed files with 67 additions and 64 deletions
|
@ -68,7 +68,7 @@ namespace gui {
|
|||
auto button = $status.entity(name);
|
||||
$status.set<Rectangle>(button, {});
|
||||
$status.set<Clickable>(button, {
|
||||
[this, name](auto, auto){
|
||||
[this, name](auto){
|
||||
dbc::log(fmt::format("STATUS: {}", name));
|
||||
}
|
||||
});
|
||||
|
@ -83,7 +83,7 @@ namespace gui {
|
|||
for(auto& [name, cell] : $overlay.cells()) {
|
||||
auto region = $overlay.entity(name);
|
||||
$overlay.set<Clickable>(region, {
|
||||
[this, name](auto, auto){
|
||||
[this, name](auto){
|
||||
dbc::log(fmt::format("OVERLAY: {}", name));
|
||||
}
|
||||
});
|
||||
|
@ -139,12 +139,12 @@ namespace gui {
|
|||
$overlay.render(window);
|
||||
}
|
||||
|
||||
bool BossFightUI::mouse(float x, float y, bool hover) {
|
||||
if($status.mouse(x, y, hover)) {
|
||||
bool BossFightUI::mouse(float x, float y, guecs::Modifiers mods) {
|
||||
if($status.mouse(x, y, mods)) {
|
||||
dbc::log("STATUS button pressed");
|
||||
}
|
||||
|
||||
if($overlay.mouse(x, y, hover)) {
|
||||
if($overlay.mouse(x, y, mods)) {
|
||||
$animation.play();
|
||||
sound::play("Sword_Hit_1");
|
||||
$boss_hit = !$boss_hit;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue