use {
crate::{
input::mouse::MouseButton,
types::Focus,
},
dpi::{
PhysicalPosition,
PhysicalSize,
Position,
},
keyboard_types::{
Code,
Key,
KeyState,
Location,
Modifiers,
},
strum::Display,
};
#[derive(Debug, Display, PartialEq, Clone)]
pub enum Event {
None,
RawInput(RawInputMessage),
Window(WindowEvent),
}
#[derive(Debug, Display, PartialEq, Clone)]
pub enum WindowEvent {
CloseRequest,
Draw,
Keyboard {
state: KeyState,
key: Key,
code: Code,
location: Location,
modifiers: Modifiers,
repeat: bool,
},
ModifiersChanged {
shift: KeyState,
ctrl: KeyState,
alt: KeyState,
win: KeyState,
},
MouseButton {
button: MouseButton,
state: KeyState,
position: Position,
is_double_click: bool,
},
MouseWheel { delta_x: f32, delta_y: f32 },
CursorMove {
position: PhysicalPosition<i32>,
kind: CursorMoveKind,
},
Resized(PhysicalSize<u32>),
Moved(PhysicalPosition<i32>),
BoundsChanged {
outer_position: PhysicalPosition<i32>,
outer_size: PhysicalSize<u32>,
},
Command,
SystemCommand,
Focus(Focus),
ScaleFactorChanged(f64),
}
#[derive(Debug, Display, PartialEq, Clone)]
pub enum RawInputMessage {
Keyboard { physical_key: Code, state: KeyState },
MouseButton { button: MouseButton, state: KeyState },
MouseMove { delta_x: f32, delta_y: f32 },
}
#[derive(Debug, Display, Copy, Clone, PartialEq, Eq, Hash)]
pub enum CursorMoveKind {
Entered,
Left,
Inside,
}