1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
pub use crate::prelude::VirtualKeyCode;
pub use bracket_geometry::prelude::Point;

/// Available device events
#[derive(Clone, Debug, PartialEq)]
pub enum BEvent {
    /// The window was resized
    Resized {
        new_size: Point,
        dpi_scale_factor: f32,
    },

    /// The window was moved
    Moved { new_position: Point },

    /// The window has requested that it be closed
    CloseRequested,

    /// A character was input
    Character { c: char },

    /// The window gained or lost focus
    Focused { focused: bool },

    /// The mouse cursor entered the window
    CursorEntered,

    /// The mouse cursor left the window
    CursorLeft,

    /// The mouse cursor moved
    CursorMoved { position: Point },

    /// A mouse button was pressed or released
    MouseClick { button: usize, pressed: bool },

    /// Mouse button is down
    MouseButtonDown { button: usize },

    /// Mouse button is up
    MouseButtonUp { button: usize },

    /// A key on the keyboard was pressed or released.
    KeyboardInput {
        key: VirtualKeyCode,
        scan_code: u32,
        pressed: bool,
    },

    /// The window's scale factor was changed. You generally don't need to do anything for this, unless you are working with
    /// pixel coordinates.
    ScaleFactorChanged {
        new_size: Point,
        dpi_scale_factor: f32,
    },
}