Quit the NanoVG demo when pressing Escape, not any key.
The previous setup was making it hard to take screenshots.
This commit is contained in:
parent
deee2436c1
commit
abecb697be
|
@ -44,7 +44,7 @@ use std::time::Instant;
|
||||||
use surfman::{Connection, ContextAttributeFlags, ContextAttributes, GLVersion as SurfmanGLVersion};
|
use surfman::{Connection, ContextAttributeFlags, ContextAttributes, GLVersion as SurfmanGLVersion};
|
||||||
use surfman::{SurfaceAccess, SurfaceType};
|
use surfman::{SurfaceAccess, SurfaceType};
|
||||||
use winit::dpi::LogicalSize;
|
use winit::dpi::LogicalSize;
|
||||||
use winit::{Event, EventsLoop, WindowBuilder, WindowEvent};
|
use winit::{Event, EventsLoop, KeyboardInput, VirtualKeyCode, WindowBuilder, WindowEvent};
|
||||||
|
|
||||||
#[cfg(not(windows))]
|
#[cfg(not(windows))]
|
||||||
use jemallocator;
|
use jemallocator;
|
||||||
|
@ -1586,7 +1586,13 @@ fn main() {
|
||||||
event_loop.poll_events(|event| {
|
event_loop.poll_events(|event| {
|
||||||
match event {
|
match event {
|
||||||
Event::WindowEvent { event: WindowEvent::CloseRequested, .. } |
|
Event::WindowEvent { event: WindowEvent::CloseRequested, .. } |
|
||||||
Event::WindowEvent { event: WindowEvent::KeyboardInput { .. }, .. } => exit = true,
|
Event::WindowEvent {
|
||||||
|
event: WindowEvent::KeyboardInput {
|
||||||
|
input: KeyboardInput { virtual_keycode: Some(VirtualKeyCode::Escape), .. },
|
||||||
|
..
|
||||||
|
},
|
||||||
|
..
|
||||||
|
} => exit = true,
|
||||||
Event::WindowEvent { event: WindowEvent::CursorMoved { position, .. }, .. } => {
|
Event::WindowEvent { event: WindowEvent::CursorMoved { position, .. }, .. } => {
|
||||||
mouse_position = vec2f(position.x as f32, position.y as f32);
|
mouse_position = vec2f(position.x as f32, position.y as f32);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue