1use glam::Vec2;
4
5#[derive(Debug, Clone, PartialEq)]
6pub enum Event {
7 PointerMoved { pos: Vec2 },
9 PointerPressed { pos: Vec2, button: PointerButton },
10 PointerReleased { pos: Vec2, button: PointerButton },
11 PointerEntered,
12 PointerLeft,
13 Scroll { delta: Vec2 },
14
15 KeyPressed { key: KeyCode, modifiers: Modifiers },
17 KeyReleased { key: KeyCode, modifiers: Modifiers },
18 TextInput { ch: char },
19
20 FocusGained,
22 FocusLost,
23
24 Resized { width: u32, height: u32 },
26 CloseRequested,
27}
28
29#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
30pub enum PointerButton {
31 Primary,
32 Secondary,
33 Middle,
34}
35
36#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
37pub struct Modifiers {
38 pub shift: bool,
39 pub ctrl: bool,
40 pub alt: bool,
41 pub meta: bool,
42}
43
44#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
45pub enum KeyCode {
46 Backspace,
47 Delete,
48 Tab,
49 Return,
50 Escape,
51 Left,
52 Right,
53 Up,
54 Down,
55 Home,
56 End,
57 PageUp,
58 PageDown,
59 Other(u32),
60}
61
62#[derive(Debug, Clone, Copy, PartialEq, Eq)]
64pub enum EventResponse {
65 Consumed,
67 Ignored,
69}