From 9242f39bb0b9d27b735ea10b11e9a099cd534181 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Mon, 29 Jul 2024 16:41:16 -0500 Subject: [PATCH] Toggling states simpler for testing --- src/main_menu.rs | 16 +++++++++++----- src/player.rs | 3 ++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/main_menu.rs b/src/main_menu.rs index 9135061..87ce8be 100644 --- a/src/main_menu.rs +++ b/src/main_menu.rs @@ -64,13 +64,19 @@ pub fn exit(mut commands: Commands, q: Query>) { } pub fn update( - keyboard_input: Res>, + keyboard: Res>, mut next_state: ResMut>, mut app_exit_events: ResMut>, ) { - if keyboard_input.just_pressed(KeyCode::Escape) { - app_exit_events.send(bevy::app::AppExit); - } else if keyboard_input.pressed(KeyCode::Enter) { - next_state.set(crate::View::InGame) + for key in keyboard.get_just_pressed() { + match key { + KeyCode::Escape => { + app_exit_events.send(bevy::app::AppExit); + } + KeyCode::Enter => { + next_state.set(crate::View::InGame); + } + _ => {} + } } } diff --git a/src/player.rs b/src/player.rs index 6794f07..4020a3e 100644 --- a/src/player.rs +++ b/src/player.rs @@ -49,7 +49,7 @@ pub fn startup( text: Text::from_section( "You", TextStyle { - font_size: 32.0, + font_size: 100.0, font: assets.fonts.iosevkalytemin.clone(), color: Color::WHITE, ..Default::default() @@ -148,6 +148,7 @@ pub fn controls( for key in input.get_just_pressed() { match key { KeyCode::Escape => next_state.set(crate::View::MainMenu), + KeyCode::Enter => next_state.set(crate::View::MainMenu), KeyCode::Space => { let child = commands .spawn(AudioSourceBundle {