allow closing debug menu with gamepad
This commit is contained in:
@@ -8,10 +8,16 @@ pub fn plugin(app: &mut App) {
|
|||||||
app.add_systems(Startup, setup);
|
app.add_systems(Startup, setup);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update(mut commands: Commands, keyboard: Res<ButtonInput<KeyCode>>) {
|
fn update(mut commands: Commands, keyboard: Res<ButtonInput<KeyCode>>, gamepads: Query<&Gamepad>) {
|
||||||
if keyboard.just_pressed(KeyCode::Backquote) {
|
if keyboard.just_pressed(KeyCode::Backquote) {
|
||||||
commands.trigger(LogViewerVisibility::Toggle);
|
commands.trigger(LogViewerVisibility::Toggle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for g in gamepads.iter() {
|
||||||
|
if g.just_pressed(GamepadButton::North) {
|
||||||
|
commands.trigger(LogViewerVisibility::Toggle);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn setup(mut commands: Commands) {
|
fn setup(mut commands: Commands) {
|
||||||
|
|||||||
Reference in New Issue
Block a user