class

GamepadInput

Module
Input
Header
#include "Input/GamepadInput.h"
Namespace
Mowo

Properties

TypeNameDescription
static constexpr floatDefaultDeadzoneDeadzone (applied to stick axes) Default 0.15f.
static constexpr floatDefaultTriggerDeadzoneTrigger deadzone. Worn analog triggers rest slightly above zero; with no floor, a bound action actuates forever from that drift and never sees a release. The live range remaps to the full 0..1. Default 0.05f.

Constructors

SignatureNameDescription
GamepadInput()GamepadInput

Public functions

ReturnsNameDescription
boolIsButtonDown
boolIsButtonPressedSticky per-frame edges — a press+release between two Update() calls still reports both (see KeyboardInput).
boolIsButtonReleased
floatGetAxisAxis values (-1..1 for sticks, 0..1 for triggers)
boolIsConnected
voidSetConnectedDisconnecting zeroes the device state: a pad yanked mid-stick-push otherwise leaves its last axis values latched forever and any bound action stays actuated with no release ever arriving.
voidOnButtonDown
voidOnButtonUp
voidSetAxis
voidUpdateCall at start of frame (copies current → previous)
voidSetDeadzone
floatGetDeadzone
voidSetTriggerDeadzone
floatGetTriggerDeadzone
voidSetNativeHandleNative SDL_Gamepad* handle (opaque to avoid leaking SDL into the header).
void*GetNativeHandle
boolRumbleRumble (low-frequency = big motor, high-frequency = small motor).
boolRumbleTriggersTrigger rumble (DualSense / Xbox Series X|S adaptive triggers).
voidStopRumbleStop all rumble immediately (both regular + trigger motors).
boolHasGyro
boolHasAccel
SensorSampleGetGyro
SensorSampleGetAccel
boolEnableMotionSensorsStarts the sensor stream.
voidSetGyro
voidSetAccel
boolHasRgbLedLight bar / LED colour in 0..1 (DualShock 4, DualSense, Steam Deck).
boolSetLedColor
boolHasLedColor
voidRestoreLedRe-sends the last colour; Window's connect path calls it through the manager so a pad that re-pairs mid-session keeps the colour the game set.
boolIsMotionEnabled

Function details

GamepadInput

C++
GamepadInput()

IsButtonDown

C++
bool IsButtonDown(GamepadButton button) const

IsButtonPressed

C++
bool IsButtonPressed(GamepadButton button) const

Sticky per-frame edges — a press+release between two Update() calls still reports both (see KeyboardInput).

IsButtonReleased

C++
bool IsButtonReleased(GamepadButton button) const

GetAxis

C++
float GetAxis(GamepadAxis axis) const

Axis values (-1..1 for sticks, 0..1 for triggers)

IsConnected

C++
bool IsConnected() const

SetConnected

C++
void SetConnected(bool connected)

Disconnecting zeroes the device state: a pad yanked mid-stick-push otherwise leaves its last axis values latched forever and any bound action stays actuated with no release ever arriving.

OnButtonDown

C++
void OnButtonDown(GamepadButton button)

OnButtonUp

C++
void OnButtonUp(GamepadButton button)

SetAxis

C++
void SetAxis(GamepadAxis axis, float value)

Update

C++
void Update()

Call at start of frame (copies current → previous)

SetDeadzone

C++
void SetDeadzone(float deadzone)

GetDeadzone

C++
float GetDeadzone() const

SetTriggerDeadzone

C++
void SetTriggerDeadzone(float deadzone)

GetTriggerDeadzone

C++
float GetTriggerDeadzone() const

SetNativeHandle

C++
void SetNativeHandle(void* sdlGamepad)

Native SDL_Gamepad* handle (opaque to avoid leaking SDL into the header). Set by Window on connect / cleared to nullptr on disconnect. Required for rumble — SDL keeps haptic state per-gamepad.

GetNativeHandle

C++
void* GetNativeHandle() const

Rumble

C++
bool Rumble(float lowFreq, float highFreq, uint32_t durationMs)

Rumble (low-frequency = big motor, high-frequency = small motor). Both in 0..1; durationMs == 0 stops rumble. Returns true on success. No-op when the gamepad doesn't support rumble (e.g. some 3rd-party pads).

RumbleTriggers

C++
bool RumbleTriggers(float leftTrigger, float rightTrigger, uint32_t durationMs)

Trigger rumble (DualSense / Xbox Series X|S adaptive triggers). Returns true on success; false if the controller doesn't expose trigger haptics — caller may fall back to a regular Rumble().

StopRumble

C++
void StopRumble()

Stop all rumble immediately (both regular + trigger motors).

HasGyro

C++
bool HasGyro() const

HasAccel

C++
bool HasAccel() const

GetGyro

C++
SensorSample GetGyro() const

GetAccel

C++
SensorSample GetAccel() const

EnableMotionSensors

C++
bool EnableMotionSensors(bool enable)

Starts the sensor stream. SDL leaves it off because it costs HID bandwidth, so InputManager enables it on the first gyro/accel read rather than for every pad; returns true when a gyro is streaming.

SetGyro

C++
void SetGyro(float x, float y, float z)

SetAccel

C++
void SetAccel(float x, float y, float z)

HasRgbLed

C++
bool HasRgbLed() const

Light bar / LED colour in 0..1 (DualShock 4, DualSense, Steam Deck). Returns false when the pad has no RGB LED. Remembered so a connect after the game picked a colour restores it.

SetLedColor

C++
bool SetLedColor(float r, float g, float b)

HasLedColor

C++
bool HasLedColor() const

RestoreLed

C++
void RestoreLed()

Re-sends the last colour; Window's connect path calls it through the manager so a pad that re-pairs mid-session keeps the colour the game set.

IsMotionEnabled

C++
bool IsMotionEnabled() const
Generated from Input/GamepadInput.h via input.json · Nov 2, 2026Version 1.0.0