From cdcb8c08d4dca6e9920a6e3bef8cfa5bcfc44240 Mon Sep 17 00:00:00 2001 From: demenik Date: Fri, 28 Nov 2025 12:26:34 +0100 Subject: [PATCH] fix: Use button component in StartScreen --- src/features/start_screen/mod.rs | 69 +++++++++++--------------------- 1 file changed, 24 insertions(+), 45 deletions(-) diff --git a/src/features/start_screen/mod.rs b/src/features/start_screen/mod.rs index 0f46904..889915a 100644 --- a/src/features/start_screen/mod.rs +++ b/src/features/start_screen/mod.rs @@ -24,6 +24,7 @@ fn setup(mut commands: Commands) { justify_content: JustifyContent::Center, align_items: AlignItems::Center, flex_direction: FlexDirection::Column, + row_gap: px(10), ..default() }, children![ @@ -32,57 +33,45 @@ fn setup(mut commands: Commands) { TextFont::from_font_size(64.0), TextColor(Color::srgb(0.9, 0.9, 0.9)) ), - ( - Button, + button( ButtonType::LoadGame, + ButtonVariant::Primary, Node { - width: px(300), - height: px(65), + width: px(280), justify_content: JustifyContent::Center, align_items: AlignItems::Center, + padding: UiRect::all(px(10)), ..default() }, - BackgroundColor(NORMAL_BUTTON), - children![( - Text::new("Spiel laden"), - TextFont::from_font_size(33.0), - TextColor(Color::srgb(0.9, 0.9, 0.9)) - )] + "Spiel laden", + 33.0 ), - ( - Button, + button( ButtonType::NewGame, + ButtonVariant::Primary, Node { - width: px(300), - height: px(65), + width: px(280), justify_content: JustifyContent::Center, align_items: AlignItems::Center, + padding: UiRect::all(px(10)), ..default() }, - BackgroundColor(NORMAL_BUTTON), - children![( - Text::new("Neues Spiel"), - TextFont::from_font_size(33.0), - TextColor(Color::srgb(0.9, 0.9, 0.9)) - )] + "Neues Spiel", + 33.0, ), - ( - Button, + button( ButtonType::Settings, + ButtonVariant::Secondary, Node { - width: px(300), - height: px(65), + width: px(280), justify_content: JustifyContent::Center, align_items: AlignItems::Center, + padding: UiRect::all(px(10)), ..default() }, - BackgroundColor(NORMAL_BUTTON), - children![( - Text::new("Einstellungen"), - TextFont::from_font_size(33.0), - TextColor(Color::srgb(0.9, 0.9, 0.9)) - )] - ) + "Einstellungen", + 33.0 + ), ], )); } @@ -90,18 +79,13 @@ fn setup(mut commands: Commands) { fn menu( mut commands: Commands, mut next_state: ResMut>, - mut interaction_query: Query< - (&Interaction, &ButtonType, &mut BackgroundColor), - (Changed, With