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