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:
@@ -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"));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user