From 857aefda0394d4c412c4b2f494256a19d45c3f71 Mon Sep 17 00:00:00 2001 From: Robert Garrett Date: Sun, 19 Oct 2025 09:57:57 -0500 Subject: [PATCH] Wire the 'Start' button to a state changer --- client/src/ui.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/client/src/ui.rs b/client/src/ui.rs index 61f80e1..bbade38 100644 --- a/client/src/ui.rs +++ b/client/src/ui.rs @@ -5,6 +5,8 @@ use bevy::{ prelude::*, }; +use crate::GameState; + pub const BTN_BORDER_COLOR: Color = Color::WHITE; pub const BTN_BG_COLOR: Color = Color::BLACK; pub const BTN_BG_SELECTED: Color = bevy::prelude::Color::Srgba(DARK_GRAY); @@ -29,9 +31,11 @@ pub fn spawn_main_menu(mut commands: Commands) { TextShadow::default(), )); let mut start_button = cmds.spawn(button_bundle("Start game")); - start_button.observe(|_trigger: On>| { - info!("The start button was pressed."); - }); + start_button.observe( + |_trigger: On>, mut game_state: ResMut>| { + game_state.set(GameState::Playing); + }, + ); let mut quit_button = cmds.spawn(button_bundle("Quit Game")); quit_button.observe( |_trigger: On>, mut messages: MessageWriter| {