|
Gin
|
Represents a single connected game controller. More...
#include <gin_gamecontroller.h>
Public Types | |
| enum class | Button { unknown = 0 , dpadUp , dpadRight , dpadDown , dpadLeft , faceDown , faceRight , faceUp , faceLeft , leftShoulder , rightShoulder , leftTrigger , rightTrigger , select , home , start , leftStick , rightStick , numButtons } |
| enum class | Axis { leftX = 0 , leftY , rightX , rightY , leftTrigger , rightTrigger , numAxes } |
Public Member Functions | |
| int | getIndex () const noexcept |
| Port index (0..maxControllers - 1). | |
| const juce::String & | getName () const noexcept |
| Human-readable product name reported by the platform backend. | |
| bool | isConnected () const noexcept |
| True between a controllerConnected and a controllerDisconnected. | |
| bool | isButtonDown (Button b) const noexcept |
| float | getAxis (Axis a) const noexcept |
| Analog axis value. | |
Represents a single connected game controller.
GameController instances are owned by the GameControllerManager and live for the life of that manager — a disconnect just flips isConnected() to false so pointers held by listeners stay valid until they're reconnected on the same port.
Button and axis layouts are normalised across backends so the same enum value means the same physical control on Xbox, PlayStation, MFi, etc. Face buttons are named by position (faceDown / faceRight / faceUp / faceLeft) rather than letter so the mapping holds regardless of vendor:
Xbox A = PS Cross = faceDown Xbox B = PS Circle = faceRight Xbox Y = PS Triangle = faceUp Xbox X = PS Square = faceLeft
|
strong |
|
strong |
|
noexcept |
Port index (0..maxControllers - 1).
Stable across disconnect/reconnect.
|
noexcept |
Human-readable product name reported by the platform backend.
|
noexcept |
True between a controllerConnected and a controllerDisconnected.
Analog axis value.
Sticks: -1..1. Triggers: 0..1.