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