17 #define DEFINE_GAMEPAD_BUTTON_HANDLE(KeyName) \ 18 static ButtonHandle _##KeyName; \ 19 ButtonHandle GamepadButton::KeyName() { return _##KeyName; } 21 DEFINE_GAMEPAD_BUTTON_HANDLE(lstick)
22 DEFINE_GAMEPAD_BUTTON_HANDLE(rstick)
23 DEFINE_GAMEPAD_BUTTON_HANDLE(lshoulder)
24 DEFINE_GAMEPAD_BUTTON_HANDLE(rshoulder)
25 DEFINE_GAMEPAD_BUTTON_HANDLE(ltrigger)
26 DEFINE_GAMEPAD_BUTTON_HANDLE(rtrigger)
27 DEFINE_GAMEPAD_BUTTON_HANDLE(lgrip)
28 DEFINE_GAMEPAD_BUTTON_HANDLE(rgrip)
30 DEFINE_GAMEPAD_BUTTON_HANDLE(dpad_left)
31 DEFINE_GAMEPAD_BUTTON_HANDLE(dpad_right)
32 DEFINE_GAMEPAD_BUTTON_HANDLE(dpad_up)
33 DEFINE_GAMEPAD_BUTTON_HANDLE(dpad_down)
35 DEFINE_GAMEPAD_BUTTON_HANDLE(back)
36 DEFINE_GAMEPAD_BUTTON_HANDLE(guide)
37 DEFINE_GAMEPAD_BUTTON_HANDLE(start)
39 DEFINE_GAMEPAD_BUTTON_HANDLE(next)
40 DEFINE_GAMEPAD_BUTTON_HANDLE(previous)
42 DEFINE_GAMEPAD_BUTTON_HANDLE(face_a)
43 DEFINE_GAMEPAD_BUTTON_HANDLE(face_b)
44 DEFINE_GAMEPAD_BUTTON_HANDLE(face_c)
45 DEFINE_GAMEPAD_BUTTON_HANDLE(face_x)
46 DEFINE_GAMEPAD_BUTTON_HANDLE(face_y)
47 DEFINE_GAMEPAD_BUTTON_HANDLE(face_z)
49 DEFINE_GAMEPAD_BUTTON_HANDLE(face_1)
50 DEFINE_GAMEPAD_BUTTON_HANDLE(face_2)
52 DEFINE_GAMEPAD_BUTTON_HANDLE(trigger)
53 DEFINE_GAMEPAD_BUTTON_HANDLE(hat_up)
54 DEFINE_GAMEPAD_BUTTON_HANDLE(hat_down)
55 DEFINE_GAMEPAD_BUTTON_HANDLE(hat_left)
56 DEFINE_GAMEPAD_BUTTON_HANDLE(hat_right)
65 if (button_number >= 0) {
68 while ((
size_t)button_number >= buttons.size()) {
70 sprintf(numstr,
"joystick%d", (
int)buttons.size() + 1);
73 buttons.push_back(handle);
75 return buttons[button_number];
77 return ButtonHandle::none();
This is our own Panda specialization on the default STL vector.