|
|
|
@ -3,18 +3,20 @@ use std::path::PathBuf;
|
|
|
|
|
use gilrs::Event as GilEvent;
|
|
|
|
|
use legion::world::SubWorld;
|
|
|
|
|
use legion::*;
|
|
|
|
|
use winit::dpi::{PhysicalPosition, PhysicalSize};
|
|
|
|
|
use winit::event::DeviceEvent::MouseMotion;
|
|
|
|
|
use winit::event::{
|
|
|
|
|
use winit_24::dpi::{PhysicalPosition, PhysicalSize};
|
|
|
|
|
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::window::{Theme, WindowId, Window};
|
|
|
|
|
use winit_24::window::{Theme, WindowId, Window};
|
|
|
|
|
|
|
|
|
|
use crate::camera::{Camera, CameraController};
|
|
|
|
|
use crate::owned_event::OwnedWindowEvent::MouseWheel;
|
|
|
|
|
use crate::{ImguiPlatform, ImguiContext};
|
|
|
|
|
use std::sync::{Mutex, Arc};
|
|
|
|
|
use std::cmp::Ordering;
|
|
|
|
|
use imgui::Io;
|
|
|
|
|
|
|
|
|
|
#[derive(Clone)]
|
|
|
|
|
pub enum OwnedUIEvent<T> {
|
|
|
|
@ -239,6 +241,7 @@ pub enum OwnedWindowEvent {
|
|
|
|
|
ThemeChanged(Theme),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Because I am a glutton for punishment I am going to just do a mono-event-dispatch-magoooo
|
|
|
|
|
#[system]
|
|
|
|
|
#[write_component(Camera)]
|
|
|
|
@ -250,13 +253,13 @@ pub fn event_dispatch(
|
|
|
|
|
#[resource] imgui_platform: &mut Arc<Mutex<ImguiPlatform>>,
|
|
|
|
|
#[resource] winit_window: &mut Window,
|
|
|
|
|
) {
|
|
|
|
|
use winit::event::Event::DeviceEvent;
|
|
|
|
|
use winit_24::event::Event::DeviceEvent;
|
|
|
|
|
|
|
|
|
|
for event in event_stack {
|
|
|
|
|
|
|
|
|
|
match event {
|
|
|
|
|
OwnedEvent::DeviceEvent {
|
|
|
|
|
event: winit::event::DeviceEvent::MouseMotion { delta },
|
|
|
|
|
event: winit_24::event::DeviceEvent::MouseMotion { delta },
|
|
|
|
|
..
|
|
|
|
|
} => {
|
|
|
|
|
let mut query = <(&mut CameraController)>::query();
|
|
|
|
@ -265,7 +268,7 @@ pub fn event_dispatch(
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
OwnedEvent::DeviceEvent {
|
|
|
|
|
event: winit::event::DeviceEvent::Key(keyboard_input),
|
|
|
|
|
event: winit_24::event::DeviceEvent::Key(keyboard_input),
|
|
|
|
|
..
|
|
|
|
|
} => {
|
|
|
|
|
let mut query = <(&mut CameraController)>::query();
|
|
|
|
@ -297,6 +300,6 @@ pub fn event_dispatch(
|
|
|
|
|
let mut imgui_context = &mut imgui_context.lock().unwrap().context;
|
|
|
|
|
let mut imgui_platform = &mut imgui_platform.lock().unwrap().platform;
|
|
|
|
|
|
|
|
|
|
imgui_platform.handle_event(imgui_context.io_mut(), &winit_window, &event.into());
|
|
|
|
|
imgui_platform.handle_event(imgui_context.io_mut(), &winit_window, &event);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|