diff --git a/src/plugins/start_screen.rs b/src/plugins/start_screen.rs index 1724ebb..bd8911c 100644 --- a/src/plugins/start_screen.rs +++ b/src/plugins/start_screen.rs @@ -16,6 +16,13 @@ struct MenuData { button_entity: Entity, } +#[derive(Component)] +enum ButtonType { + LoadGame, + NewGame, + Settings, +} + const NORMAL_BUTTON: Color = Color::srgb(0.15, 0.15, 0.15); const HOVERED_BUTTON: Color = Color::srgb(0.25, 0.25, 0.25); const PRESSED_BUTTON: Color = Color::srgb(0.35, 0.75, 0.35); @@ -28,27 +35,79 @@ fn setup(mut commands: Commands) { height: percent(100), justify_content: JustifyContent::Center, align_items: AlignItems::Center, + flex_direction: FlexDirection::Column, ..default() }, - children![( - Button, - Node { - width: px(150), - height: px(65), - justify_content: JustifyContent::Center, - align_items: AlignItems::Center, - ..default() - }, - BackgroundColor(NORMAL_BUTTON), - children![( - Text::new("Play"), + children![ + ( + Text::new("Pomonon Garten"), TextFont { - font_size: 33.0, + font_size: 64.0, ..default() }, TextColor(Color::srgb(0.9, 0.9, 0.9)) - )] - )], + ), + ( + Button, + ButtonType::LoadGame, + Node { + width: px(300), + height: px(65), + justify_content: JustifyContent::Center, + align_items: AlignItems::Center, + ..default() + }, + BackgroundColor(NORMAL_BUTTON), + children![( + Text::new("Spiel laden"), + TextFont { + font_size: 33.0, + ..default() + }, + TextColor(Color::srgb(0.9, 0.9, 0.9)) + )] + ), + ( + Button, + ButtonType::NewGame, + Node { + width: px(300), + height: px(65), + justify_content: JustifyContent::Center, + align_items: AlignItems::Center, + ..default() + }, + BackgroundColor(NORMAL_BUTTON), + children![( + Text::new("Neues Spiel"), + TextFont { + font_size: 33.0, + ..default() + }, + TextColor(Color::srgb(0.9, 0.9, 0.9)) + )] + ), + ( + Button, + ButtonType::Settings, + Node { + width: px(300), + height: px(65), + justify_content: JustifyContent::Center, + align_items: AlignItems::Center, + ..default() + }, + BackgroundColor(NORMAL_BUTTON), + children![( + Text::new("Einstellungen"), + TextFont { + font_size: 33.0, + ..default() + }, + TextColor(Color::srgb(0.9, 0.9, 0.9)) + )] + ) + ], )) .id(); @@ -58,15 +117,19 @@ fn setup(mut commands: Commands) { fn menu( mut next_state: ResMut>, mut interaction_query: Query< - (&Interaction, &mut BackgroundColor), + (&Interaction, &ButtonType, &mut BackgroundColor), (Changed, With