Add Ctrl+Q exit shortcut

main
Elnu 2 years ago
parent 819aea8163
commit 24561cb055

@ -7,7 +7,6 @@ use sfml::graphics::*;
use sfml::system::*; use sfml::system::*;
use sfml::window::*; use sfml::window::*;
use std::io::Write; use std::io::Write;
use std::thread::current;
mod structs; mod structs;
use structs::*; use structs::*;
@ -210,7 +209,13 @@ fn main() {
loop { loop {
match window.poll_event() { match window.poll_event() {
Some(event) => match 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 => { Event::LostFocus => {
toggle_pause = true; toggle_pause = true;
paused_from_lost_focus = true; paused_from_lost_focus = true;
@ -294,7 +299,13 @@ fn main() {
loop { loop {
match window.wait_event() { match window.wait_event() {
Some(event) => match 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 { Event::KeyPressed {
code, code,
alt: _, alt: _,

Loading…
Cancel
Save