Skip to main content

pawkit_input/binding/
button.rs

1use num_enum::TryFromPrimitive;
2use serde::{Deserialize, Serialize};
3
4use crate::binding::implement_into;
5
6#[repr(u8)]
7#[rustfmt::skip]
8#[derive(Debug, Clone, Copy, PartialEq, Eq, 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(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, TryFromPrimitive)]
54#[serde(rename_all = "PascalCase")]
55pub enum MouseButton {
56    Left,
57    Right,
58    Middle,
59    Side1,
60    Side2,
61}
62
63implement_into!(MouseButton);
64
65#[repr(u8)]
66#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, TryFromPrimitive)]
67#[serde(rename_all = "PascalCase")]
68pub enum GamepadButton {
69    South,
70    East,
71    West,
72    North,
73    Back,
74    Guide,
75    Start,
76    LeftStick,
77    RightStick,
78    LeftShoulder,
79    RightShoulder,
80    DpadUp,
81    DpadDown,
82    DpadLeft,
83    DpadRight,
84    Misc1,
85    RightPaddle1,
86    LeftPaddle1,
87    RightPaddle2,
88    LeftPaddle2,
89    Touchpad,
90    Misc2,
91    Misc3,
92    Misc4,
93    Misc5,
94    Misc6,
95}
96
97implement_into!(GamepadButton);