pawkit_input/bindings/
button.rs

1use num_enum::TryFromPrimitive;
2use serde::{Deserialize, Serialize};
3
4use crate::bindings::implement_into;
5
6#[repr(u8)]
7#[rustfmt::skip]
8#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize, TryFromPrimitive)]
9#[serde(rename_all = "PascalCase")]
10pub enum KeyboardButton {
11    A, B, C, D, E, F, G, H, I, J, K, L, M,
12    N, O, P, Q, R, S, T, U, V, W, X, Y, Z,
13
14    Number0, Number1, Number2, Number3,
15    Number4, Number5, Number6, Number7,
16    Number8, Number9,
17
18    Up, Down, Left, Right,
19
20    Tilde, Grave, Minus, Plus,
21    LeftBracket, RightBracket,
22    Semicolon, Quote, Comma,
23    Period, Slash, BackSlash,
24
25    LeftShift, RightShift,
26    LeftControl, RightControl,
27    LeftAlt, RightAlt,
28    LeftMeta, RightMeta,
29
30    Menu, Enter, Escape, Space,
31    Tab, Backspace, Insert,
32    Delete, PageUp, PageDown,
33    Home, End, CapsLock, ScrollLock,
34    PrintScreen, Pause, NumLock,
35    Clear, Sleep,
36
37    Numpad0, Numpad1, Numpad2, Numpad3,
38    Numpad4, Numpad5, Numpad6, Numpad7,
39    Numpad8, Numpad9, NumpadDivide,
40    NumpadMultiply, NumpadMinus,
41    NumpadPlus, NumpadDecimal,
42    NumpadPeriod, NumpadEnter,
43
44    F1, F2, F3, F4, F5, F6, F7, F8, F9,
45    F10, F11, F12, F13, F14, F15, F16,
46    F17, F18, F19, F20, F21, F22, F23,
47    F24,
48}
49
50implement_into!(KeyboardButton);
51
52#[repr(u8)]
53#[derive(
54    Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize, TryFromPrimitive,
55)]
56#[serde(rename_all = "PascalCase")]
57pub enum MouseButton {
58    Left,
59    Right,
60    Middle,
61    Side1,
62    Side2,
63}
64
65implement_into!(MouseButton);
66
67#[repr(u8)]
68#[derive(
69    Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize, TryFromPrimitive,
70)]
71#[serde(rename_all = "PascalCase")]
72pub enum GamepadButton {
73    South,
74    East,
75    West,
76    North,
77    Back,
78    Guide,
79    Start,
80    LeftStick,
81    RightStick,
82    LeftShoulder,
83    RightShoulder,
84    DpadUp,
85    DpadDown,
86    DpadLeft,
87    DpadRight,
88    Misc1,
89    RightPaddle1,
90    LeftPaddle1,
91    RightPaddle2,
92    LeftPaddle2,
93    Touchpad,
94    Misc2,
95    Misc3,
96    Misc4,
97    Misc5,
98    Misc6,
99}
100
101implement_into!(GamepadButton);