diff --git a/Cargo.toml b/Cargo.toml index b7e340b..0cec508 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,9 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -bevy = { version = "0.14", default-features = false } +bevy = { version = "0.15", default-features = false, features = [ + "bevy_window", +] } ctrlc = "3" [target.'cfg(windows)'.dependencies] diff --git a/src/lib.rs b/src/lib.rs index 78aefdb..f342e1d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,8 @@ -use bevy::{app::AppExit, prelude::*, window::WindowFocused}; +use bevy::{ + app::{AppExit, TerminalCtrlCHandlerPlugin}, + prelude::*, + window::WindowFocused, +}; #[cfg(windows)] use windows::{ core::GUID, @@ -28,7 +32,7 @@ fn setup(mut commands: Commands) { Power::PowerSetActiveScheme(None, Some(active)) .ok() .expect("Failed to set power scheme"); - std::process::exit(1); + TerminalCtrlCHandlerPlugin::gracefully_exit(); }) .expect("Failed to set exit handler"); }