From e8e7f81ee5b66ce2909bd24765c47bf822f17ed5 Mon Sep 17 00:00:00 2001 From: Daniel McNab <36049421+DJMcNab@users.noreply.github.com> Date: Thu, 6 Jan 2022 20:09:27 +0000 Subject: [PATCH] Remove exit_on_esc --- crates/bevy_input/src/lib.rs | 1 - crates/bevy_input/src/system.rs | 20 -------------------- examples/game/alien_cake_addict.rs | 3 ++- examples/game/breakout.rs | 3 ++- 4 files changed, 4 insertions(+), 23 deletions(-) delete mode 100644 crates/bevy_input/src/system.rs diff --git a/crates/bevy_input/src/lib.rs b/crates/bevy_input/src/lib.rs index a9dbc2d3301d37..48041ff9412f89 100644 --- a/crates/bevy_input/src/lib.rs +++ b/crates/bevy_input/src/lib.rs @@ -3,7 +3,6 @@ pub mod gamepad; mod input; pub mod keyboard; pub mod mouse; -pub mod system; pub mod touch; pub use axis::*; diff --git a/crates/bevy_input/src/system.rs b/crates/bevy_input/src/system.rs deleted file mode 100644 index d32968862a23bb..00000000000000 --- a/crates/bevy_input/src/system.rs +++ /dev/null @@ -1,20 +0,0 @@ -use crate::{ - keyboard::{KeyCode, KeyboardInput}, - ElementState, -}; -use bevy_app::AppExit; -use bevy_ecs::prelude::{EventReader, EventWriter}; - -/// Sends the `AppExit` event whenever the "esc" key is pressed. -pub fn exit_app_on_esc( - mut keyboard_input_events: EventReader, - mut app_exit_events: EventWriter, -) { - for event in keyboard_input_events.iter() { - if let Some(key_code) = event.key_code { - if event.state == ElementState::Pressed && key_code == KeyCode::Escape { - app_exit_events.send(AppExit); - } - } - } -} diff --git a/examples/game/alien_cake_addict.rs b/examples/game/alien_cake_addict.rs index 7f23e6f9dd8bee..e8ed5fc63e6762 100644 --- a/examples/game/alien_cake_addict.rs +++ b/examples/game/alien_cake_addict.rs @@ -1,5 +1,6 @@ use bevy::{ core::FixedTimestep, ecs::schedule::SystemSet, prelude::*, render::camera::CameraPlugin, + window::close_on_esc, }; use rand::Rng; @@ -33,7 +34,7 @@ fn main() { .with_run_criteria(FixedTimestep::step(5.0)) .with_system(spawn_bonus), ) - .add_system(bevy::input::system::exit_on_esc_system) + .add_system(close_on_esc) .run(); } diff --git a/examples/game/breakout.rs b/examples/game/breakout.rs index 1bee7cb8df37ca..eb99852e4c9ec6 100644 --- a/examples/game/breakout.rs +++ b/examples/game/breakout.rs @@ -2,6 +2,7 @@ use bevy::{ core::FixedTimestep, prelude::*, sprite::collide_aabb::{collide, Collision}, + window::close_on_esc, }; /// An implementation of the classic game "Breakout" @@ -20,7 +21,7 @@ fn main() { .with_system(ball_movement_system), ) .add_system(scoreboard_system) - .add_system(bevy::input::system::exit_on_esc_system) + .add_system(close_on_esc) .run(); }