diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-28 22:52:09 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-28 22:52:09 +1000 |
commit | 0b7ddd05d19fa320b25ad0f5c968852dc416583d (patch) | |
tree | 82dcdaa98157a22c453af124091957dbf162f56c /source/application/StarInputEvent.hpp | |
parent | 0886098242be9e41f351519f8a5958995e8ed9ab (diff) |
Add extremely basic controller support (only movement)
Diffstat (limited to 'source/application/StarInputEvent.hpp')
-rw-r--r-- | source/application/StarInputEvent.hpp | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/source/application/StarInputEvent.hpp b/source/application/StarInputEvent.hpp index bbf46b5..896b192 100644 --- a/source/application/StarInputEvent.hpp +++ b/source/application/StarInputEvent.hpp @@ -154,7 +154,8 @@ enum class KeyMod : uint16_t { RGui = 0x0800, Num = 0x1000, Caps = 0x2000, - AltGr = 0x4000 + AltGr = 0x4000, + Scroll = 0x8000 }; extern EnumMap<KeyMod> const KeyModNames; @@ -181,6 +182,43 @@ extern EnumMap<MouseWheel> const MouseWheelNames; typedef uint32_t ControllerId; +enum class ControllerAxis : uint8_t { + LeftX, + LeftY, + RightX, + RightY, + TriggerLeft, + TriggerRight, + Invalid = 255 +}; +extern EnumMap<ControllerAxis> const ControllerAxisNames; + +enum class ControllerButton : uint8_t { + A, + B, + X, + Y, + Back, + Guide, + Start, + LeftStick, + RightStick, + LeftShoulder, + RightShoulder, + DPadUp, + DPadDown, + DPadLeft, + DPadRight, + Misc1, + Paddle1, + Paddle2, + Paddle3, + Paddle4, + Touchpad, + Invalid = 255 +}; +extern EnumMap<ControllerButton> const ControllerButtonNames; + struct KeyDownEvent { Key key; KeyMod mods; @@ -216,18 +254,18 @@ struct MouseWheelEvent { struct ControllerAxisEvent { ControllerId controller; - unsigned controllerAxis; + ControllerAxis controllerAxis; float controllerAxisValue; }; struct ControllerButtonDownEvent { ControllerId controller; - unsigned controllerButton; + ControllerButton controllerButton; }; struct ControllerButtonUpEvent { ControllerId controller; - unsigned controllerButton; + ControllerButton controllerButton; }; typedef Variant< |