mitchellhansen 4 years ago
parent aaef25f710
commit 165a90eba1

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

Loading…
Cancel
Save