Refactor mouse and keyboard input handling

This commit is contained in:
meehl committed 2026-08-29 16:12:45 +02:00
1 parent c297eeaca6
commit 4b344d15ae
5 files changed
+199 -261

No files matched your search

+9 -29
View File
@@ -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),