use bevy::{color::palettes::css::*, prelude::*, ui::Val::*}; use crate::{ game::machines::*, resources::UiTheme, widgets::{BigRedButton, machine_ui_base}, }; impl CuttingMachine { pub fn spawn_ui(mut commands: Commands, theme: Res) { let base_entity = machine_ui_base(&mut commands, "Cutting Machine", &theme); commands.entity(base_entity).with_children(|commands| { // Left panel. For fuel or machine stats or whatever. commands.spawn(( Node { padding: UiRect::all(Px(10.0)), ..default() }, BackgroundColor(GREEN.into()), Pickable::default(), children![(Text::new("Uses: "), TextColor(BLACK.into()),)], )); // Center panel (placeholder for the Card view) commands.spawn(( Node::default(), BackgroundColor(BLUE.into()), Pickable::default(), children![( Text::new("Card cut view placeholder"), TextColor(MAGENTA.into()), TextShadow::default(), ),], )); // Right panel for the "CUT" button commands .spawn(( Node { align_items: AlignItems::End, ..Default::default() }, BackgroundColor(DARK_GRAY.into()), Pickable::default(), )) .with_children(|cmds| { let _button_cmds = cmds.spawn(BigRedButton::bundle("CUT")); // TODO: Attach on-press observer so this machine can do something // in response to that button being pressed }); }); } } impl RotatingMachine { pub fn spawn_ui(mut commands: Commands, theme: Res) { let base_entity = machine_ui_base(&mut commands, "Rotating Machine", &theme); commands.entity(base_entity).with_children(|commands| { commands.spawn(( Node { padding: UiRect::all(Px(10.0)), ..Default::default() }, BackgroundColor(GREEN.into()), Pickable::default(), children![(Text::new("Uses: "), TextColor(BLACK.into()))], )); // Center panel (placeholder for input-output rotation) commands.spawn(( Node::default(), BackgroundColor(BLUE.into()), Pickable::default(), children![ Text::new("Card rotation side-by-side placeholder"), TextColor(MAGENTA.into()), ], )); // Right panel for the rotation controls commands .spawn(( Node { align_items: AlignItems::End, ..Default::default() }, BackgroundColor(DARK_GRAY.into()), Pickable::default(), )) .with_children(|cmds| { let button_cmds = cmds.spawn(BigRedButton::bundle("TURN")); // TODO: Attach on-press observer to the button. }); }); } }