From 24561cb0554b0d0a013c629eeec1710b54792232 Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Sun, 20 Mar 2022 22:06:44 -0700 Subject: [PATCH] Add Ctrl+Q exit shortcut --- src/main.rs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 90076d2..a1c1b76 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,7 +7,6 @@ use sfml::graphics::*; use sfml::system::*; use sfml::window::*; use std::io::Write; -use std::thread::current; mod structs; use structs::*; @@ -210,7 +209,13 @@ fn main() { loop { match window.poll_event() { Some(event) => match event { - Event::Closed => window.close(), + Event::Closed | Event::KeyPressed { + code: Key::Q, + alt: _, + ctrl: true, + shift: _, + system: _, + } => window.close(), Event::LostFocus => { toggle_pause = true; paused_from_lost_focus = true; @@ -294,7 +299,13 @@ fn main() { loop { match window.wait_event() { Some(event) => match event { - Event::Closed => window.close(), + Event::Closed | Event::KeyPressed { + code: Key::Q, + alt: _, + ctrl: true, + shift: _, + system: _, + } => window.close(), Event::KeyPressed { code, alt: _,