events are coming in. But my dual box thingy is not gonna be the way to go here. I guess it copied the data and they no longer link. Bummer

This commit is contained in:
2020-08-11 21:56:14 -07:00
parent 9719675465
commit 28565652c0
5 changed files with 65 additions and 11 deletions

View File

@@ -141,11 +141,14 @@ impl<'a> System<'a> for EventSystem {
WriteStorage<'a, Draws>,
Write<'a, PersistentState>,
Write<'a, VkProcessor>,
Write<'a, Vec<TrEvent<TrEventExtension>>>
);
fn run(&mut self, (mut draw, mut state, mut vk_processor): Self::SystemData) {
for draw_data in (&draw).join() {
//draw_data.1.notify()
fn run(&mut self, (mut draw, mut state, mut vk_processor, event_stack): Self::SystemData) {
for draw_data in (&mut draw).join() {
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
let mut dispatcher = DispatcherBuilder::new()
// .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();
@@ -306,12 +310,22 @@ pub fn main() {
world.write_resource::<PersistentState>()
.window_size = surface.window().inner_size().into();
} else {
// println!("{}", world.write_resource::<Vec<TrEvent<TrEventExtension>>>().len());
world.write_resource::<Vec<TrEvent<TrEventExtension>>>().clear();
}
}
Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => {
*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), .. } => {
world.write_resource::<VkProcessor>()
.swapchain_recreate_needed = true;