|
|
@ -141,11 +141,14 @@ impl<'a> System<'a> for EventSystem {
|
|
|
|
WriteStorage<'a, Draws>,
|
|
|
|
WriteStorage<'a, Draws>,
|
|
|
|
Write<'a, PersistentState>,
|
|
|
|
Write<'a, PersistentState>,
|
|
|
|
Write<'a, VkProcessor>,
|
|
|
|
Write<'a, VkProcessor>,
|
|
|
|
|
|
|
|
Write<'a, Vec<TrEvent<TrEventExtension>>>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
fn run(&mut self, (mut draw, mut state, mut vk_processor): Self::SystemData) {
|
|
|
|
fn run(&mut self, (mut draw, mut state, mut vk_processor, event_stack): Self::SystemData) {
|
|
|
|
for draw_data in (&draw).join() {
|
|
|
|
for draw_data in (&mut draw).join() {
|
|
|
|
//draw_data.1.notify()
|
|
|
|
for event in event_stack.iter() {
|
|
|
|
|
|
|
|
draw_data.1.notify(event)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -259,7 +262,8 @@ pub fn main() {
|
|
|
|
// call the run method for the following systems & deps
|
|
|
|
// call the run method for the following systems & deps
|
|
|
|
let mut dispatcher = DispatcherBuilder::new()
|
|
|
|
let mut dispatcher = DispatcherBuilder::new()
|
|
|
|
// .with(SysA, "sys_a", &[])
|
|
|
|
// .with(SysA, "sys_a", &[])
|
|
|
|
.with(RenderSystem, "render_s", &[]).build();
|
|
|
|
.with(EventSystem, "event_s", &[])
|
|
|
|
|
|
|
|
.with(RenderSystem, "render_s", &["event_s"]).build();
|
|
|
|
|
|
|
|
|
|
|
|
let event_loop_proxy = events_loop.create_proxy();
|
|
|
|
let event_loop_proxy = events_loop.create_proxy();
|
|
|
|
|
|
|
|
|
|
|
@ -306,12 +310,22 @@ pub fn main() {
|
|
|
|
world.write_resource::<PersistentState>()
|
|
|
|
world.write_resource::<PersistentState>()
|
|
|
|
.window_size = surface.window().inner_size().into();
|
|
|
|
.window_size = surface.window().inner_size().into();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// println!("{}", world.write_resource::<Vec<TrEvent<TrEventExtension>>>().len());
|
|
|
|
world.write_resource::<Vec<TrEvent<TrEventExtension>>>().clear();
|
|
|
|
world.write_resource::<Vec<TrEvent<TrEventExtension>>>().clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => {
|
|
|
|
Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => {
|
|
|
|
*control_flow = ControlFlow::Exit
|
|
|
|
*control_flow = ControlFlow::Exit
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Event::WindowEvent { event: WindowEvent::MouseInput { device_id, state, button, modifiers }, .. } => {
|
|
|
|
|
|
|
|
match button {
|
|
|
|
|
|
|
|
MouseButton::Left => {
|
|
|
|
|
|
|
|
if state == ElementState::Pressed {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
_ => {}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
Event::WindowEvent { event: WindowEvent::Resized(new_size), .. } => {
|
|
|
|
Event::WindowEvent { event: WindowEvent::Resized(new_size), .. } => {
|
|
|
|
world.write_resource::<VkProcessor>()
|
|
|
|
world.write_resource::<VkProcessor>()
|
|
|
|
.swapchain_recreate_needed = true;
|
|
|
|
.swapchain_recreate_needed = true;
|
|
|
|