There are build-in systems in Bevy that increase our convenience. For example, the system close_on_esc will close the window when the Esc key is pressed.
use bevy::{
app::{App, Update},
window::close_on_esc,
DefaultPlugins,
};
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_systems(Update, close_on_esc)
.run();
}
The close_on_esc is added to the schedule Update, so that our App checks if the Esc key is pressed whenever the app is updated.
➡️ Next: Camera 2D
📘 Back: Table of contents