diff --git a/src/widgets/machines.rs b/src/widgets/machines.rs index 0fe6a41..0ac6cb5 100644 --- a/src/widgets/machines.rs +++ b/src/widgets/machines.rs @@ -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)), diff --git a/src/widgets/mod.rs b/src/widgets/mod.rs index 39fa3f2..cafefd3 100644 --- a/src/widgets/mod.rs +++ b/src/widgets/mod.rs @@ -38,23 +38,21 @@ fn machine_ui_base(header: impl Into) -> 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. + )], + ),], ) }