reload shaders
This commit is contained in:
11
src/main.rs
11
src/main.rs
@@ -1,5 +1,5 @@
|
||||
use crate::vulkan::{Vertex, GameData};
|
||||
use winit::{Event, WindowEvent};
|
||||
use winit::{Event, WindowEvent, ElementState};
|
||||
use std::time::SystemTime;
|
||||
use std::iter::FromIterator;
|
||||
|
||||
@@ -7,7 +7,7 @@ mod vulkan;
|
||||
|
||||
impl GameData<'_> {
|
||||
/// Returns true if event should be ignored by the vulkan handler
|
||||
fn on_window_event(self: &Self, event: &Event) -> bool {
|
||||
fn on_window_event(self: &mut Self, event: &Event) -> bool {
|
||||
match event {
|
||||
Event::WindowEvent { event: WindowEvent::KeyboardInput { device_id, input }, .. } => {
|
||||
let mods = String::from_iter(
|
||||
@@ -20,6 +20,10 @@ impl GameData<'_> {
|
||||
} else {
|
||||
println!("Keyboard {:?} input {:?} {:?}", device_id, input.state, input.scancode)
|
||||
}
|
||||
|
||||
if input.state == ElementState::Released && input.modifiers.ctrl && input.scancode == 19 {
|
||||
self.recreate_pipeline = true;
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
@@ -52,7 +56,8 @@ fn main() {
|
||||
Vertex { position: [0.9, 0., 0.] },
|
||||
],
|
||||
push_constants: &mut pc,
|
||||
start_time: SystemTime::now()
|
||||
start_time: SystemTime::now(),
|
||||
recreate_pipeline: false
|
||||
};
|
||||
|
||||
vulkan::init(data);
|
||||
|
||||
Reference in New Issue
Block a user