Reattach the close button to the rotator machine
That was much easier than I expected it to be. I'm still going to alter how the `machine_ui_base` function works so that I don't have to remember to attach a button all the time.
This commit is contained in:
@@ -2,7 +2,7 @@ use bevy::{color::palettes::css::*, prelude::*, ui::Val::*};
|
||||
|
||||
use crate::{
|
||||
game::machines::*,
|
||||
widgets::{machine_ui_base, spawn_big_red_button},
|
||||
widgets::{CloseButton, machine_ui_base, spawn_big_red_button},
|
||||
};
|
||||
|
||||
impl CuttingMachine {
|
||||
@@ -52,6 +52,7 @@ impl RotatingMachine {
|
||||
commands
|
||||
.spawn((machine_ui_base("Rotating Machine"),))
|
||||
.with_children(|commands| {
|
||||
commands.spawn(CloseButton::bundle(commands.target_entity()));
|
||||
commands.spawn((
|
||||
Node {
|
||||
padding: UiRect::all(Px(10.0)),
|
||||
|
||||
@@ -38,23 +38,21 @@ fn machine_ui_base(header: impl Into<String>) -> impl Bundle {
|
||||
},
|
||||
BackgroundColor(SLATE_100.into()),
|
||||
BorderRadius::all(Percent(2.0)),
|
||||
children![
|
||||
(
|
||||
// TODO: A real node with stuff in it (buttons, maybe?)
|
||||
Node {
|
||||
justify_content: JustifyContent::Center,
|
||||
grid_column: GridPlacement::span(2),
|
||||
..default()
|
||||
},
|
||||
BackgroundColor(RED.into()),
|
||||
Pickable::default(),
|
||||
children![(
|
||||
Text::new(header),
|
||||
TextColor(BLACK.into()),
|
||||
// TODO: Text shadow, maybe. I couldn't make it look good.
|
||||
)],
|
||||
),
|
||||
],
|
||||
children![(
|
||||
// TODO: A real node with stuff in it (buttons, maybe?)
|
||||
Node {
|
||||
justify_content: JustifyContent::Center,
|
||||
grid_column: GridPlacement::span(2),
|
||||
..default()
|
||||
},
|
||||
BackgroundColor(RED.into()),
|
||||
Pickable::default(),
|
||||
children![(
|
||||
Text::new(header),
|
||||
TextColor(BLACK.into()),
|
||||
// TODO: Text shadow, maybe. I couldn't make it look good.
|
||||
)],
|
||||
),],
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user