|
|
|
|
#pragma once
|
|
|
|
|
// Unifies joystick, gamepad, and keyboard controller APIs.
|
|
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
|
|
|
|
|
namespace devilution {
|
|
|
|
|
|
|
|
|
|
// NOTE: A, B, X, Y refer to physical positions on an XBox 360 controller.
|
|
|
|
|
// A<->B and X<->Y are reversed on a Nintendo controller.
|
|
|
|
|
enum ControllerButton : uint8_t {
|
|
|
|
|
ControllerButton_NONE,
|
|
|
|
|
ControllerButton_IGNORE,
|
|
|
|
|
ControllerButton_AXIS_TRIGGERLEFT, // ZL (aka L2)
|
|
|
|
|
ControllerButton_AXIS_TRIGGERRIGHT, // ZR (aka R2)
|
|
|
|
|
ControllerButton_BUTTON_A, // Bottom button
|
|
|
|
|
ControllerButton_BUTTON_B, // Right button
|
|
|
|
|
ControllerButton_BUTTON_X, // Left button
|
|
|
|
|
ControllerButton_BUTTON_Y, // TOP button
|
|
|
|
|
ControllerButton_BUTTON_LEFTSTICK,
|
|
|
|
|
ControllerButton_BUTTON_RIGHTSTICK,
|
|
|
|
|
ControllerButton_BUTTON_LEFTSHOULDER,
|
|
|
|
|
ControllerButton_BUTTON_RIGHTSHOULDER,
|
|
|
|
|
ControllerButton_BUTTON_START,
|
|
|
|
|
ControllerButton_BUTTON_BACK,
|
|
|
|
|
ControllerButton_BUTTON_DPAD_UP,
|
|
|
|
|
ControllerButton_BUTTON_DPAD_DOWN,
|
|
|
|
|
ControllerButton_BUTTON_DPAD_LEFT,
|
|
|
|
|
ControllerButton_BUTTON_DPAD_RIGHT
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
inline bool IsDPadButton(ControllerButton button)
|
|
|
|
|
{
|
|
|
|
|
return button == ControllerButton_BUTTON_DPAD_UP
|
|
|
|
|
|| button == ControllerButton_BUTTON_DPAD_DOWN
|
|
|
|
|
|| button == ControllerButton_BUTTON_DPAD_LEFT
|
|
|
|
|
|| button == ControllerButton_BUTTON_DPAD_RIGHT;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace devilution
|