gdritter repos outlander / a1f4c9e
Listen for Q to exit Getty Ritter 6 years ago
1 changed file(s) with 11 addition(s) and 4 deletion(s). Collapse all Expand all
6161 }
6262
6363 window.run(|event| {
64 use glutin::{ControlFlow, Event, WindowEvent};
64 use glutin::{ControlFlow, Event, WindowEvent, VirtualKeyCode};
6565
66 if let Event::WindowEvent { event, .. } = event {
67 if let WindowEvent::Closed = event {
68 return ControlFlow::Break;
66 match event {
67 Event::WindowEvent { event: WindowEvent::Closed, .. } =>
68 return ControlFlow::Break,
69 Event::WindowEvent { event: WindowEvent::KeyboardInput { input: k, .. }, .. } => {
70 match k.virtual_keycode {
71 Some(VirtualKeyCode::Q) =>
72 return ControlFlow::Break,
73 _ => println!("{:#?}", k),
74 }
6975 }
76 _ => (),
7077 }
7178
7279 unsafe {