use std::sync::atomic::{AtomicU8, Ordering};
use sdl2::event::{Event, WindowEvent};
-use sdl2::keyboard::Keycode;
+use sdl2::keyboard::{Keycode, Mod};
use sdl2::mouse::MouseButton;
use sdl2::render::{Canvas, Texture, TextureCreator};
use sdl2::pixels::PixelFormatEnum;
if let Event::MouseButtonDown {mouse_btn: MouseButton::Right, ..} = event {
self.toggle_pause();
}
- if let Event::KeyDown {keycode: Some(keycode), ..} = event {
+ if let Event::KeyDown {keycode: Some(keycode), keymod, ..} = event {
match keycode {
- Keycode::Escape | Keycode::Q => {
+ Keycode::Escape => {
+ self.end = true;
+ println!();
+ return Ok(true);
+ },
+ Keycode::Q if matches!(keymod, Mod::RSHIFTMOD | Mod::LSHIFTMOD) => {
self.end = true;
println!();
return Ok(true);