QcGamepadState Class
One pad's buttons and axes at one moment, normalised and independent of the backend. More...
| Header: | #include <clientcore/input/QcGamepadState.h> |
Public Functions
| float | axis(QcGamepadAxis axis) const |
| bool | pressed(QcGamepadButton button) const |
| void | setAxis(QcGamepadAxis axis, float value) |
| void | setPressed(QcGamepadButton button, bool pressed) |
Static Public Members
| bool | isTrigger(QcGamepadAxis axis) |
Related Non-Members
| enum class | QcGamepadAxis { LeftX, LeftY, RightX, RightY, LeftTrigger, …, Count } |
| enum class | QcGamepadButton { South, East, West, North, Back, …, Count } |
| enum class | QcGamepadType { Generic, Xbox, PlayStation, SwitchPro } |
| const std::size_t | qcGamepadAxisCount |
| const std::size_t | qcGamepadButtonCount |
Detailed Description
Member Function Documentation
float QcGamepadState::axis(QcGamepadAxis axis) const
Returns the value of axis.
See also setAxis().
[static] bool QcGamepadState::isTrigger(QcGamepadAxis axis)
Returns whether axis is a trigger (range [0, 1]).
bool QcGamepadState::pressed(QcGamepadButton button) const
Returns whether button is pressed.
See also setPressed().
void QcGamepadState::setAxis(QcGamepadAxis axis, float value)
Sets axis to value, clamped to [-1, 1] for the sticks and [0, 1] for the triggers; NaN counts as 0.
See also axis().
void QcGamepadState::setPressed(QcGamepadButton button, bool pressed)
Sets whether button is pressed.
See also pressed().
Related Non-Members
enum class QcGamepadAxis
The analogue inputs: sticks in [-1, 1] (x positive to the right, y positive downwards, as SDL and most pads report them), triggers in [0, 1].
| Constant | Value | Description |
|---|---|---|
QcGamepadState::QcGamepadAxis::LeftX | 0 | left stick, horizontal |
QcGamepadState::QcGamepadAxis::LeftY | 1 | left stick, vertical |
QcGamepadState::QcGamepadAxis::RightX | 2 | right stick, horizontal |
QcGamepadState::QcGamepadAxis::RightY | 3 | right stick, vertical |
QcGamepadState::QcGamepadAxis::LeftTrigger | 4 | left trigger |
QcGamepadState::QcGamepadAxis::RightTrigger | 5 | right trigger |
QcGamepadState::QcGamepadAxis::Count | 6 | the number of axes, not an axis |
enum class QcGamepadButton
The buttons of a gamepad by position, not by label (decision E-540): South is A on an Xbox pad, Cross on a PlayStation pad and B on a Switch Pro pad.
The triggers are axes.
| Constant | Value | Description |
|---|---|---|
QcGamepadState::QcGamepadButton::South | 0 | bottom face button |
QcGamepadState::QcGamepadButton::East | 1 | right face button |
QcGamepadState::QcGamepadButton::West | 2 | left face button |
QcGamepadState::QcGamepadButton::North | 3 | top face button |
QcGamepadState::QcGamepadButton::Back | 4 | the left middle button (Back, Share, Minus) |
QcGamepadState::QcGamepadButton::Guide | 5 | the logo button |
QcGamepadState::QcGamepadButton::Start | 6 | the right middle button (Start, Options, Plus) |
QcGamepadState::QcGamepadButton::LeftStick | 7 | pressing the left stick |
QcGamepadState::QcGamepadButton::RightStick | 8 | pressing the right stick |
QcGamepadState::QcGamepadButton::LeftShoulder | 9 | left bumper |
QcGamepadState::QcGamepadButton::RightShoulder | 10 | right bumper |
QcGamepadState::QcGamepadButton::DpadUp | 11 | d-pad up |
QcGamepadState::QcGamepadButton::DpadDown | 12 | d-pad down |
QcGamepadState::QcGamepadButton::DpadLeft | 13 | d-pad left |
QcGamepadState::QcGamepadButton::DpadRight | 14 | d-pad right |
QcGamepadState::QcGamepadButton::Count | 15 | the number of buttons, not a button |
enum class QcGamepadType
The family of a pad, for button symbols in HUD and help texts.
| Constant | Value | Description |
|---|---|---|
QcGamepadState::QcGamepadType::Generic | 0 | unknown family: generic symbols |
QcGamepadState::QcGamepadType::Xbox | 1 | Xbox and compatible pads |
QcGamepadState::QcGamepadType::PlayStation | 2 | PlayStation pads |
QcGamepadState::QcGamepadType::SwitchPro | 3 | Nintendo Switch Pro pads |
const std::size_t qcGamepadAxisCount
Number of axes.
const std::size_t qcGamepadButtonCount
Number of buttons.