Skip to main content

pfx_input/
event.rs

1use serde::{Deserialize, Serialize};
2
3use crate::device::{Axis, Button, Control, Key, MouseButton, PadId, PadInfo};
4
5#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
6pub enum InputEvent {
7    Key {
8        key: Key,
9        pressed: bool,
10    },
11    MouseButton {
12        button: MouseButton,
13        pressed: bool,
14    },
15    Wheel {
16        x: f32,
17        y: f32,
18    },
19    PointerMoved {
20        window: [f32; 2],
21    },
22    PointerAt {
23        layout: [f32; 2],
24        inside: bool,
25    },
26    PointerLeft,
27    FocusLost,
28    PadConnected {
29        pad: PadId,
30        info: PadInfo,
31    },
32    PadDisconnected {
33        pad: PadId,
34    },
35    PadButton {
36        pad: PadId,
37        button: Button,
38        value: f32,
39    },
40    PadAxis {
41        pad: PadId,
42        axis: Axis,
43        value: f32,
44    },
45    PadAction {
46        pad: PadId,
47        action: String,
48        value: [f32; 2],
49    },
50    PadOrigins {
51        pad: PadId,
52        action: String,
53        controls: Vec<Control>,
54    },
55}