xinput/enumerations/vk.rs
1use bytemuck::{Pod, Zeroable};
2use winapi::um::xinput::*;
3
4
5
6/// \[[microsoft.com](https://learn.microsoft.com/en-us/windows/win32/api/xinput/ns-xinput-xinput_keystroke#remarks)\]
7/// VK_* values specific to Xbox 360 controllers
8#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
9#[derive(Default, Pod, Zeroable)]
10#[repr(transparent)] pub struct VK(u16);
11
12enumish! {
13 VK => u16;
14 None, PadA, PadB, PadX, PadY, PadRShoulder, PadLShoulder, PadRTrigger, PadLTrigger,
15 PadDPadUp, PadDPadDown, PadDPadLeft, PadDPadRight, PadStart, PadBack, PadLThumbPress, PadRThumbPress,
16 PadLThumbUp, PadLThumbDown, PadLThumbRight, PadLThumbLeft, PadLThumbUpLeft, PadLThumbUpRight, PadLThumbDownRight, PadLThumbDownLeft,
17 PadRThumbUp, PadRThumbDown, PadRThumbRight, PadRThumbLeft, PadRThumbUpLeft, PadRThumbUpRight, PadRThumbDownRight, PadRThumbDownLeft,
18}
19
20#[allow(non_upper_case_globals)] impl VK {
21 /// No virtual key corresponding to this keystroke event (input method editor input?)
22 pub const None : VK = VK(0);
23
24 /// Typically synonymous select/accept in menus on Xbox 360 style controllers/games/console.
25 ///
26 /// | Controller | Legend | Where |
27 /// | ------------- | --------- | ----- |
28 /// | Xbox 360 | Green A | Bottom button of the right face cluster
29 /// | Xbox One | A | Bottom button of the right face cluster
30 pub const PadA : VK = VK(VK_PAD_A);
31
32 /// Typically synonymous back/cancel in menus on Xbox 360 style controllers/games/console.
33 ///
34 /// | Controller | Legend | Where |
35 /// | ------------- | --------- | ----- |
36 /// | Xbox 360 | Red B | Right button of the right face cluster
37 /// | Xbox One | B | Right button of the right face cluster
38 pub const PadB : VK = VK(VK_PAD_B);
39
40 /// | Controller | Legend | Where |
41 /// | ------------- | --------- | ----- |
42 /// | Xbox 360 | Blue X | Left button of the right face cluster
43 /// | Xbox One | X | Left button of the right face cluster
44 pub const PadX : VK = VK(VK_PAD_X);
45
46 /// | Controller | Legend | Where |
47 /// | ------------- | --------- | ----- |
48 /// | Xbox 360 | Yellow Y | Top button of the right face cluster
49 /// | Xbox One | Y | Top button of the right face cluster
50 pub const PadY : VK = VK(VK_PAD_Y);
51
52 /// | Controller | Where |
53 /// | ------------- | ----- |
54 /// | Xbox 360 | Top right on the controller
55 /// | Xbox One | Top right on the controller
56 pub const PadRShoulder : VK = VK(VK_PAD_RSHOULDER);
57
58 /// | Controller | Where |
59 /// | ------------- | ----- |
60 /// | Xbox 360 | Top left on the controller
61 /// | Xbox One | Top left on the controller
62 pub const PadLShoulder : VK = VK(VK_PAD_LSHOULDER);
63
64 /// Analog trigger behind the right side of the gamepad.
65 pub const PadRTrigger : VK = VK(VK_PAD_RTRIGGER);
66
67 /// Analog trigger behind the left side of the gamepad.
68 pub const PadLTrigger : VK = VK(VK_PAD_LTRIGGER);
69
70 /// | Controller | Where |
71 /// | ------------- | ----- |
72 /// | Xbox 360 | Directional pad on the bottom left of the face
73 /// | Xbox One | Directional pad on the bottom left of the face
74 pub const PadDPadUp : VK = VK(VK_PAD_DPAD_UP);
75
76 /// | Controller | Where |
77 /// | ------------- | ------ |
78 /// | Xbox 360 | Directional pad on the bottom left of the face
79 /// | Xbox One | Directional pad on the bottom left of the face
80 pub const PadDPadDown : VK = VK(VK_PAD_DPAD_DOWN);
81
82 /// | Controller | Where |
83 /// | ------------- | ----- |
84 /// | Xbox 360 | Directional pad on the bottom left of the face
85 /// | Xbox One | Directional pad on the bottom left of the face
86 pub const PadDPadLeft : VK = VK(VK_PAD_DPAD_LEFT);
87
88 /// | Controller | Where |
89 /// | ------------- | ----- |
90 /// | Xbox 360 | Directional pad on the bottom left of the face
91 /// | Xbox One | Directional pad on the bottom left of the face
92 pub const PadDPadRight : VK = VK(VK_PAD_DPAD_RIGHT);
93
94 /// | Controller | Legend | Where |
95 /// | ------------- | --------- | ----- |
96 /// | Xbox 360 | Start `ᐅ` | Right button of the middle face cluster
97 /// | Xbox One | Menu `≡` | Right button of the middle face cluster
98 pub const PadStart : VK = VK(VK_PAD_START);
99
100 /// | Controller | Legend | Where |
101 /// | ------------- | --------- | ----- |
102 /// | Xbox 360 | Back `ᐊ` | Left button of the middle face cluster
103 /// | Xbox One | View `⧉` | Left button of the middle face cluster
104 pub const PadBack : VK = VK(VK_PAD_BACK);
105
106 /// | Controller | When |
107 /// | ------------- | ----- |
108 /// | Xbox 360 | Pressing the left thumbstick into the controller
109 /// | Xbox One | Pressing the left thumbstick into the controller
110 pub const PadLThumbPress : VK = VK(VK_PAD_LTHUMB_PRESS);
111
112 /// | Controller | When |
113 /// | ------------- | ----- |
114 /// | Xbox 360 | Pressing the right thumbstick into the controller
115 /// | Xbox One | Pressing the right thumbstick into the controller
116 pub const PadRThumbPress : VK = VK(VK_PAD_RTHUMB_PRESS);
117
118 /// Moved the upper left thumbstick up.
119 pub const PadLThumbUp : VK = VK(VK_PAD_LTHUMB_UP);
120
121 /// Moved the upper left thumbstick down.
122 pub const PadLThumbDown : VK = VK(VK_PAD_LTHUMB_DOWN);
123
124 /// Moved the upper left thumbstick right.
125 pub const PadLThumbRight : VK = VK(VK_PAD_LTHUMB_RIGHT);
126
127 /// Moved the upper left thumbstick left.
128 pub const PadLThumbLeft : VK = VK(VK_PAD_LTHUMB_LEFT);
129
130 /// Moved the upper left thumbstick up and left.
131 pub const PadLThumbUpLeft : VK = VK(VK_PAD_LTHUMB_UPLEFT);
132
133 /// Moved the upper left thumbstick up and right.
134 pub const PadLThumbUpRight : VK = VK(VK_PAD_LTHUMB_UPRIGHT);
135
136 /// Moved the upper left thumbstick down and right.
137 pub const PadLThumbDownRight : VK = VK(VK_PAD_LTHUMB_DOWNRIGHT);
138
139 /// Moved the upper left thumbstick and left.
140 pub const PadLThumbDownLeft : VK = VK(VK_PAD_LTHUMB_DOWNLEFT);
141
142 /// Moved the right thumbstick up.
143 pub const PadRThumbUp : VK = VK(VK_PAD_RTHUMB_UP);
144
145 /// Moved the right thumbstick down.
146 pub const PadRThumbDown : VK = VK(VK_PAD_RTHUMB_DOWN);
147
148 /// Moved the right thumbstick right.
149 pub const PadRThumbRight : VK = VK(VK_PAD_RTHUMB_RIGHT);
150
151 /// Moved the right thumbstick left.
152 pub const PadRThumbLeft : VK = VK(VK_PAD_RTHUMB_LEFT);
153
154 /// Moved the right thumbstick up and left.
155 pub const PadRThumbUpLeft : VK = VK(VK_PAD_RTHUMB_UPLEFT);
156
157 /// Moved the right thumbstick up and right.
158 pub const PadRThumbUpRight : VK = VK(VK_PAD_RTHUMB_UPRIGHT);
159
160 /// Moved the right thumbstick down and right.
161 pub const PadRThumbDownRight : VK = VK(VK_PAD_RTHUMB_DOWNRIGHT);
162
163 /// Moved the right thumbstick down and left.
164 pub const PadRThumbDownLeft : VK = VK(VK_PAD_RTHUMB_DOWNLEFT);
165}
166
167//#cpp2rust VK_PAD_A = xinput::VK::PadA
168//#cpp2rust VK_PAD_B = xinput::VK::PadB
169//#cpp2rust VK_PAD_X = xinput::VK::PadX
170//#cpp2rust VK_PAD_Y = xinput::VK::PadY
171//#cpp2rust VK_PAD_RSHOULDER = xinput::VK::PadRShoulder
172//#cpp2rust VK_PAD_LSHOULDER = xinput::VK::PadLShoulder
173//#cpp2rust VK_PAD_LTRIGGER = xinput::VK::PadLTrigger
174//#cpp2rust VK_PAD_RTRIGGER = xinput::VK::PadRTrigger
175
176//#cpp2rust VK_PAD_DPAD_UP = xinput::VK::PadDPadUp
177//#cpp2rust VK_PAD_DPAD_DOWN = xinput::VK::PadDPadDown
178//#cpp2rust VK_PAD_DPAD_LEFT = xinput::VK::PadDPadLeft
179//#cpp2rust VK_PAD_DPAD_RIGHT = xinput::VK::PadDPadRight
180//#cpp2rust VK_PAD_START = xinput::VK::PadStart
181//#cpp2rust VK_PAD_BACK = xinput::VK::PadBack
182//#cpp2rust VK_PAD_LTHUMB_PRESS = xinput::VK::PadLThumbPress
183//#cpp2rust VK_PAD_RTHUMB_PRESS = xinput::VK::PadRThumbPress
184
185//#cpp2rust VK_PAD_LTHUMB_UP = xinput::VK::PadLThumbUp
186//#cpp2rust VK_PAD_LTHUMB_DOWN = xinput::VK::PadLThumbDown
187//#cpp2rust VK_PAD_LTHUMB_RIGHT = xinput::VK::PadLThumbRight
188//#cpp2rust VK_PAD_LTHUMB_LEFT = xinput::VK::PadLThumbLeft
189//#cpp2rust VK_PAD_LTHUMB_UPLEFT = xinput::VK::PadLThumbUpLeft
190//#cpp2rust VK_PAD_LTHUMB_UPRIGHT = xinput::VK::PadLThumbUpRight
191//#cpp2rust VK_PAD_LTHUMB_DOWNRIGHT = xinput::VK::PadLThumbDownRight
192//#cpp2rust VK_PAD_LTHUMB_DOWNLEFT = xinput::VK::PadLThumbDownLeft
193
194//#cpp2rust VK_PAD_RTHUMB_UP = xinput::VK::PadRThumbUp
195//#cpp2rust VK_PAD_RTHUMB_DOWN = xinput::VK::PadRThumbDown
196//#cpp2rust VK_PAD_RTHUMB_RIGHT = xinput::VK::PadRThumbRight
197//#cpp2rust VK_PAD_RTHUMB_LEFT = xinput::VK::PadRThumbLeft
198//#cpp2rust VK_PAD_RTHUMB_UPLEFT = xinput::VK::PadRThumbUpLeft
199//#cpp2rust VK_PAD_RTHUMB_UPRIGHT = xinput::VK::PadRThumbUpRight
200//#cpp2rust VK_PAD_RTHUMB_DOWNRIGHT = xinput::VK::PadRThumbDownRight
201//#cpp2rust VK_PAD_RTHUMB_DOWNLEFT = xinput::VK::PadRThumbDownLeft