Create a BigRedButton struct, like CloseButton

The `BigRedButton` should be a real struct and component so that I can
query for it later.

I'm following the same API pattern as the `CloseButton` struct, in that
there is a spawner using the `Commands` (or `ChildSpawnerCommands`) and
the observer functions are static methods.
This commit is contained in:
2025-08-26 12:46:48 -05:00
parent da7f9b3152
commit 1c0681e67e
2 changed files with 81 additions and 75 deletions

View File

@@ -3,7 +3,7 @@ use bevy::{color::palettes::css::*, prelude::*, ui::Val::*};
use crate::{
game::machines::*,
resources::UiTheme,
widgets::{machine_ui_base, spawn_big_red_button},
widgets::{BigRedButton, machine_ui_base},
};
impl CuttingMachine {
@@ -42,7 +42,7 @@ impl CuttingMachine {
BackgroundColor(DARK_GRAY.into()),
Pickable::default(),
))
.with_children(|cmds| spawn_big_red_button(cmds, "CUT"));
.with_children(|cmds| BigRedButton::spawn_big_red_button(cmds, "CUT"));
});
}
}
@@ -82,7 +82,7 @@ impl RotatingMachine {
BackgroundColor(DARK_GRAY.into()),
Pickable::default(),
))
.with_children(|cmds| spawn_big_red_button(cmds, "TURN"));
.with_children(|cmds| BigRedButton::spawn_big_red_button(cmds, "TURN"));
});
}
}