Toggling states simpler for testing
This commit is contained in:
parent
4a6d9ee223
commit
9242f39bb0
|
@ -64,13 +64,19 @@ pub fn exit(mut commands: Commands, q: Query<Entity, With<MainMenu>>) {
|
|||
}
|
||||
|
||||
pub fn update(
|
||||
keyboard_input: Res<ButtonInput<KeyCode>>,
|
||||
keyboard: Res<ButtonInput<KeyCode>>,
|
||||
mut next_state: ResMut<NextState<crate::View>>,
|
||||
mut app_exit_events: ResMut<Events<bevy::app::AppExit>>,
|
||||
) {
|
||||
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);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue