Refactor mouse and keyboard input handling
This commit is contained in:
1 parent
c297eeaca6
commit
4b344d15ae
5 files changed
+199
-261
No files matched your search
+9
-29
@@ -5,40 +5,20 @@ use winit::window::Window;
|
||||
use crate::{
|
||||
dpi::{PhysicalPoint, PhysicalSize, ScaleFactor},
|
||||
draw_commands::DrawCommand,
|
||||
input::{Key, ModifiersState, MouseButton},
|
||||
installer::Installer,
|
||||
pob::PathOfBuilding,
|
||||
};
|
||||
|
||||
pub type Key = winit::keyboard::Key;
|
||||
pub type MouseButton = winit::event::MouseButton;
|
||||
pub type ModifiersState = winit::keyboard::ModifiersState;
|
||||
|
||||
pub enum StageEvent {
|
||||
KeyDown {
|
||||
key: Key,
|
||||
},
|
||||
KeyUp {
|
||||
key: Key,
|
||||
},
|
||||
CharacterInput {
|
||||
ch: char,
|
||||
},
|
||||
ModifiersChanged {
|
||||
state: ModifiersState,
|
||||
},
|
||||
MouseDown {
|
||||
button: MouseButton,
|
||||
//is_double_click: bool,
|
||||
},
|
||||
MouseUp {
|
||||
button: MouseButton,
|
||||
},
|
||||
MouseWheel {
|
||||
delta: f32,
|
||||
},
|
||||
MouseMoved {
|
||||
pos: PhysicalPoint<f32>,
|
||||
},
|
||||
KeyDown { key: Key },
|
||||
KeyUp { key: Key },
|
||||
CharacterInput { ch: char },
|
||||
ModifiersChanged { state: ModifiersState },
|
||||
MouseDown { button: MouseButton },
|
||||
MouseUp { button: MouseButton },
|
||||
MouseWheel { delta: f32 },
|
||||
MouseMoved { pos: PhysicalPoint<f32> },
|
||||
Exit,
|
||||
Resized(PhysicalSize<u32>),
|
||||
ScaleFactorChanged(f64),
|
||||
|
||||
Reference in new issue
Block a user