mitchellhansen 4 years ago
parent aaef25f710
commit 165a90eba1

@ -65,6 +65,10 @@ pub struct PersistentState {
compu_frame: CompuFrame,
}
struct TrSprite {
entity: Entity,
}
pub fn main() {
//hprof::start_frame();
//let g = hprof::enter("vulkan preload");
@ -150,7 +154,7 @@ pub fn main() {
.with(Images { images: vec![compu_image], image_resolutions: vec![image_dimensions_u] })
.build();
world.create_entity()
let sprite = world.create_entity()
.with(Evented { subscribed: |event| {true} })
.with(Position { x: 0.0, y: 0.0, z: 0 })
.with(Geometry { size_x: 300.0, size_y: 300.0, rotation: 0.0 })
@ -203,7 +207,7 @@ pub fn main() {
events_loop.run(move |event, _, control_flow| {
*control_flow = ControlFlow::Poll;
// The incoming event type will indicate what section of the event loop we are in
match event {
Event::NewEvents(cause) => {
if cause == StartCause::Init {
@ -240,6 +244,8 @@ pub fn main() {
}
accumulator_time += delta_time;
world.
// This dispatches all the systems in parallel (but blocking).
world.write_resource::<PersistentState>()
.delta_time = delta_time;
@ -251,55 +257,56 @@ pub fn main() {
_ => {}
}
// Each NewEvents event will clear this event stack
world.write_resource::<Vec<TrEvent<TrEventExtension>>>().push(event.into());
//
// match event {
// Event::UserEvent(TrEventExtension::KeyHeldEvent {}) => {}
// Event::UserEvent(TrEventExtension::MouseHeldEvent {}) => {}
// Event::UserEvent(TrEventExtension::GamepadEvent { gil_event }) => {}
// Event::DeviceEvent { device_id, event } => {
// match event {
// DeviceEvent::Key(keyboard_input) => {
// match keyboard_input.virtual_keycode.unwrap() {
// VirtualKeyCode::A => {
// if keyboard_input.state == ElementState::Pressed {}
// }
// VirtualKeyCode::S => {
// if keyboard_input.state == ElementState::Pressed {}
// }
// VirtualKeyCode::P => {
// if keyboard_input.state == ElementState::Pressed {
// let data = world.write_resource::<VkProcessor>().read_compute_buffer(compute_buffer.clone());
// image::save_buffer(&Path::new("image.png"), data.as_slice(), (image_data.1).0, (image_data.1).1, image::RGBA(8));
// }
// }
// _ => ()
// }
// }
// _ => {}
// }
// }
//
// _ => ()
// }
// bucket the events out, but not really
// match
// event {
// Event::NewEvents(_) => {}
// Event::WindowEvent { window_id, event } => {}
// Event::DeviceEvent { device_id, event } => {}
// Event::UserEvent(tr_event) => {}
// Event::Suspended => {}
// Event::Resumed => {}
// Event::MainEventsCleared => {}
// Event::RedrawRequested(_) => {}
// Event::RedrawEventsCleared => {}
// Event::LoopDestroyed => {}
// }
/*
match event {
Event::UserEvent(TrEventExtension::KeyHeldEvent {}) => {}
Event::UserEvent(TrEventExtension::MouseHeldEvent {}) => {}
Event::UserEvent(TrEventExtension::GamepadEvent { gil_event }) => {}
Event::DeviceEvent { device_id, event } => {
match event {
DeviceEvent::Key(keyboard_input) => {
match keyboard_input.virtual_keycode.unwrap() {
VirtualKeyCode::A => {
if keyboard_input.state == ElementState::Pressed {}
}
VirtualKeyCode::S => {
if keyboard_input.state == ElementState::Pressed {}
}
VirtualKeyCode::P => {
if keyboard_input.state == ElementState::Pressed {
let data = world.write_resource::<VkProcessor>().read_compute_buffer(compute_buffer.clone());
image::save_buffer(&Path::new("image.png"), data.as_slice(), (image_data.1).0, (image_data.1).1, image::RGBA(8));
}
}
_ => ()
}
}
_ => {}
}
}
_ => ()
}
bucket the events out, but not really
match
event {
Event::NewEvents(_) => {}
Event::WindowEvent { window_id, event } => {}
Event::DeviceEvent { device_id, event } => {}
Event::UserEvent(tr_event) => {}
Event::Suspended => {}
Event::Resumed => {}
Event::MainEventsCleared => {}
Event::RedrawRequested(_) => {}
Event::RedrawEventsCleared => {}
Event::LoopDestroyed => {}
}*/
});

Loading…
Cancel
Save