mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-21 22:34:43 +00:00
Fix the multi-window example handling every key event (#2589)
This commit is contained in:
parent
50b3b7a42f
commit
43a298e1ab
@ -45,6 +45,7 @@ use winit::{
|
|||||||
application::ApplicationHandler,
|
application::ApplicationHandler,
|
||||||
event::{ElementState, KeyEvent, WindowEvent},
|
event::{ElementState, KeyEvent, WindowEvent},
|
||||||
event_loop::{ActiveEventLoop, EventLoop},
|
event_loop::{ActiveEventLoop, EventLoop},
|
||||||
|
keyboard::{Key, NamedKey},
|
||||||
window::{Window, WindowId},
|
window::{Window, WindowId},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -52,6 +53,8 @@ fn main() -> Result<(), impl Error> {
|
|||||||
let event_loop = EventLoop::new().unwrap();
|
let event_loop = EventLoop::new().unwrap();
|
||||||
let mut app = App::new(&event_loop);
|
let mut app = App::new(&event_loop);
|
||||||
|
|
||||||
|
println!("\nPress space to open a new window");
|
||||||
|
|
||||||
event_loop.run_app(&mut app)
|
event_loop.run_app(&mut app)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -365,6 +368,7 @@ impl ApplicationHandler for App {
|
|||||||
WindowEvent::KeyboardInput {
|
WindowEvent::KeyboardInput {
|
||||||
event:
|
event:
|
||||||
KeyEvent {
|
KeyEvent {
|
||||||
|
logical_key: Key::Named(NamedKey::Space),
|
||||||
state: ElementState::Pressed,
|
state: ElementState::Pressed,
|
||||||
..
|
..
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user