|
|
|
@ -3,12 +3,9 @@ use std::path::PathBuf;
|
|
|
|
|
use gilrs::Event as GilEvent;
|
|
|
|
|
use legion::world::SubWorld;
|
|
|
|
|
use legion::*;
|
|
|
|
|
use winit_24::dpi::{PhysicalPosition, PhysicalSize};
|
|
|
|
|
use winit_24::dpi::{PhysicalPosition, PhysicalSize, LogicalPosition};
|
|
|
|
|
use winit_24::event::DeviceEvent::MouseMotion;
|
|
|
|
|
use winit_24::event::{
|
|
|
|
|
AxisId, DeviceEvent, DeviceId, ElementState, Event, KeyboardInput, ModifiersState, MouseButton,
|
|
|
|
|
MouseScrollDelta, StartCause, Touch, TouchPhase, WindowEvent,
|
|
|
|
|
};
|
|
|
|
|
use winit_24::event::{AxisId, DeviceEvent, DeviceId, ElementState, Event, KeyboardInput, ModifiersState, MouseButton, MouseScrollDelta, StartCause, Touch, TouchPhase, WindowEvent, VirtualKeyCode};
|
|
|
|
|
use winit_24::window::{Theme, WindowId, Window};
|
|
|
|
|
|
|
|
|
|
use crate::camera::{Camera, CameraController};
|
|
|
|
@ -266,6 +263,7 @@ pub fn event_dispatch(
|
|
|
|
|
for (camera_controller) in query.iter_mut(world) {
|
|
|
|
|
camera_controller.process_mouse(delta.0, delta.1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
OwnedEvent::DeviceEvent {
|
|
|
|
|
event: winit_24::event::DeviceEvent::Key(keyboard_input),
|
|
|
|
@ -279,21 +277,23 @@ pub fn event_dispatch(
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 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));
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// _ => ()
|
|
|
|
|
// }
|
|
|
|
|
match keyboard_input.virtual_keycode.unwrap() {
|
|
|
|
|
VirtualKeyCode::A => {
|
|
|
|
|
if keyboard_input.state == ElementState::Pressed {
|
|
|
|
|
println!("cursorijf");
|
|
|
|
|
winit_window.set_cursor_position(
|
|
|
|
|
LogicalPosition{ x: 100.0, y: 100.0 }
|
|
|
|
|
);
|
|
|
|
|
//winit_window.set_cursor_grab(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
VirtualKeyCode::S => {
|
|
|
|
|
if keyboard_input.state == ElementState::Pressed {
|
|
|
|
|
//winit_window.set_cursor_grab(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
_ => ()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
_ => {}
|
|
|
|
|
}
|
|
|
|
|