|
|
@ -20,7 +20,7 @@ use vulkano::sync;
|
|
|
|
use vulkano::sync::GpuFuture;
|
|
|
|
use vulkano::sync::GpuFuture;
|
|
|
|
use vulkano_win::VkSurfaceBuild;
|
|
|
|
use vulkano_win::VkSurfaceBuild;
|
|
|
|
use winit::dpi::LogicalSize;
|
|
|
|
use winit::dpi::LogicalSize;
|
|
|
|
use winit::event::{DeviceEvent, ElementState, Event, MouseButton, VirtualKeyCode, WindowEvent};
|
|
|
|
use winit::event::{DeviceEvent, ElementState, Event, MouseButton, StartCause, VirtualKeyCode, WindowEvent};
|
|
|
|
use winit::event_loop::{ControlFlow, EventLoop, EventLoopProxy};
|
|
|
|
use winit::event_loop::{ControlFlow, EventLoop, EventLoopProxy};
|
|
|
|
use winit::platform::unix::WindowBuilderExtUnix;
|
|
|
|
use winit::platform::unix::WindowBuilderExtUnix;
|
|
|
|
use winit::window::WindowBuilder;
|
|
|
|
use winit::window::WindowBuilder;
|
|
|
@ -113,6 +113,13 @@ pub mod button_m {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn main() {
|
|
|
|
pub fn main() {
|
|
|
|
hprof::start_frame();
|
|
|
|
hprof::start_frame();
|
|
|
|
|
|
|
|
|
|
|
@ -236,19 +243,24 @@ pub fn main() {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let mut canvas_frame = CanvasFrame::default();
|
|
|
|
let mut canvas_frame = CanvasFrame::default();
|
|
|
|
canvas_frame.draw(&funky_sprite);
|
|
|
|
let mut compu_frame = CompuFrame::new();
|
|
|
|
canvas_frame.draw(&compu_sprite1);
|
|
|
|
|
|
|
|
canvas_frame.draw(&slider);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Events loop is borrowed from the surface
|
|
|
|
// Events loop is borrowed from the surface
|
|
|
|
events_loop.run(move |event, _, control_flow| {
|
|
|
|
events_loop.run(move |event, _, control_flow| {
|
|
|
|
*control_flow = ControlFlow::Poll;
|
|
|
|
*control_flow = ControlFlow::Poll;
|
|
|
|
|
|
|
|
|
|
|
|
let mut previous_canvas = CanvasFrame::default();
|
|
|
|
funky_sprite.notify(&event);
|
|
|
|
|
|
|
|
|
|
|
|
match event {
|
|
|
|
match event {
|
|
|
|
|
|
|
|
Event::NewEvents(cause) => {
|
|
|
|
|
|
|
|
if cause == StartCause::Init {
|
|
|
|
|
|
|
|
canvas_frame.draw(&funky_sprite);
|
|
|
|
|
|
|
|
canvas_frame.draw(&compu_sprite1);
|
|
|
|
|
|
|
|
canvas_frame.draw(&slider);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => {
|
|
|
|
Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => {
|
|
|
|
*control_flow = ControlFlow::Exit
|
|
|
|
*control_flow = ControlFlow::Exit
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -265,12 +277,17 @@ pub fn main() {
|
|
|
|
Event::UserEvent(TrEvent::KeyHeldEvent {}) => {}
|
|
|
|
Event::UserEvent(TrEvent::KeyHeldEvent {}) => {}
|
|
|
|
Event::UserEvent(TrEvent::MouseHeldEvent {}) => {}
|
|
|
|
Event::UserEvent(TrEvent::MouseHeldEvent {}) => {}
|
|
|
|
Event::UserEvent(TrEvent::GamepadEvent { gil_event }) => {}
|
|
|
|
Event::UserEvent(TrEvent::GamepadEvent { gil_event }) => {}
|
|
|
|
Event::DeviceEvent { event: DeviceEvent::Key(keyboard_input), .. } => {
|
|
|
|
Event::DeviceEvent { device_id, event } => {
|
|
|
|
|
|
|
|
match event {
|
|
|
|
|
|
|
|
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 {
|
|
|
|
funky_sprite.position.0 += 0.1;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
VirtualKeyCode::S => {
|
|
|
|
|
|
|
|
if keyboard_input.state == ElementState::Pressed {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
VirtualKeyCode::P => {
|
|
|
|
VirtualKeyCode::P => {
|
|
|
@ -282,15 +299,17 @@ pub fn main() {
|
|
|
|
_ => ()
|
|
|
|
_ => ()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_ => {}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Event::MainEventsCleared => {
|
|
|
|
Event::MainEventsCleared => {
|
|
|
|
|
|
|
|
|
|
|
|
canvas_frame = CanvasFrame::default();
|
|
|
|
canvas_frame = CanvasFrame::default();
|
|
|
|
canvas_frame.draw(&funky_sprite);
|
|
|
|
canvas_frame.draw(&funky_sprite);
|
|
|
|
canvas_frame.draw(&compu_sprite1);
|
|
|
|
canvas_frame.draw(&compu_sprite1);
|
|
|
|
canvas_frame.draw(&slider);
|
|
|
|
canvas_frame.draw(&slider);
|
|
|
|
|
|
|
|
|
|
|
|
let mut compu_frame = CompuFrame::new();
|
|
|
|
compu_frame = CompuFrame::new();
|
|
|
|
compu_frame.add_with_image_swap(compute_buffer.clone(), compute_kernel.clone(), &compu_sprite1);
|
|
|
|
compu_frame.add_with_image_swap(compute_buffer.clone(), compute_kernel.clone(), &compu_sprite1);
|
|
|
|
compu_frame.add(compute_buffer.clone(), compute_kernel.clone());
|
|
|
|
compu_frame.add(compute_buffer.clone(), compute_kernel.clone());
|
|
|
|
|
|
|
|
|
|
|
@ -305,18 +324,19 @@ pub fn main() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// bucket the events out, but not really
|
|
|
|
// bucket the events out, but not really
|
|
|
|
match event {
|
|
|
|
// match
|
|
|
|
Event::NewEvents(_) => {}
|
|
|
|
// event {
|
|
|
|
Event::WindowEvent { window_id, event } => {}
|
|
|
|
// Event::NewEvents(_) => {}
|
|
|
|
Event::DeviceEvent { device_id, event } => {}
|
|
|
|
// Event::WindowEvent { window_id, event } => {}
|
|
|
|
Event::UserEvent(tr_event) => {}
|
|
|
|
// Event::DeviceEvent { device_id, event } => {}
|
|
|
|
Event::Suspended => {}
|
|
|
|
// Event::UserEvent(tr_event) => {}
|
|
|
|
Event::Resumed => {}
|
|
|
|
// Event::Suspended => {}
|
|
|
|
Event::MainEventsCleared => {}
|
|
|
|
// Event::Resumed => {}
|
|
|
|
Event::RedrawRequested(_) => {}
|
|
|
|
// Event::MainEventsCleared => {}
|
|
|
|
Event::RedrawEventsCleared => {}
|
|
|
|
// Event::RedrawRequested(_) => {}
|
|
|
|
Event::LoopDestroyed => {}
|
|
|
|
// Event::RedrawEventsCleared => {}
|
|
|
|
}
|
|
|
|
// Event::LoopDestroyed => {}
|
|
|
|
|
|
|
|
// }
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
drop(l);
|
|
|
|
drop(l);
|
|
|
@ -336,11 +356,6 @@ pub fn click_test(event_loop_proxy: EventLoopProxy<TrEvent>, canvas_state: &Canv
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// while let true = processor.is_open() {
|
|
|
|
// while let true = processor.is_open() {
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// // Take care of our timing
|
|
|
|
// // Take care of our timing
|
|
|
|