diff options
author | Baitinq <manuelpalenzuelamerino@gmail.com> | 2023-02-22 11:24:15 +0100 |
---|---|---|
committer | Baitinq <manuelpalenzuelamerino@gmail.com> | 2023-02-22 11:24:45 +0100 |
commit | b62c65cf1c8340957baeca3006a6083a411437bc (patch) | |
tree | 4d2fa3b6fcca5fcb5686399caf86406077e3f8f8 /src | |
parent | Move window showing to its own function (diff) | |
download | kyukai-b62c65cf1c8340957baeca3006a6083a411437bc.tar.gz kyukai-b62c65cf1c8340957baeca3006a6083a411437bc.tar.bz2 kyukai-b62c65cf1c8340957baeca3006a6083a411437bc.zip |
Exit the program on CtrlC
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index ad96f8f..afdc1f5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,6 +8,8 @@ fn main() { .video() .expect("Couldn't get the SDL2 video subsystem!"); + ctrlc::set_handler(move || std::process::exit(1)).expect("Error setting Ctrl-C handler"); + show_screensaver(sdl_context, sdl_video); } @@ -39,6 +41,7 @@ fn show_screensaver(sdl_context: sdl2::Sdl, sdl_video: sdl2::VideoSubsystem) { } => { break 'running; } + Event::Quit { timestamp: _ } => std::process::exit(0), _ => {} } } |