group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
systems::gamepad Namespace Reference

Functions

float normaliseAxis (Sint16 raw)
 Convert SDL's int16 axis value to a deadzoned float in [-1, 1].

Variables

constexpr float k_stickDeadzone = 0.15f
 Stick deadzone as a fraction of full deflection.
constexpr float k_triggerThreshold = 0.5f
 Trigger threshold for treating an analog trigger as "pressed".

Function Documentation

◆ normaliseAxis()

float systems::gamepad::normaliseAxis ( Sint16 raw)
inline

Convert SDL's int16 axis value to a deadzoned float in [-1, 1].

Applies a radial deadzone and rescales so the live range is still [-1, 1] (otherwise full stick deflection would only feel like ~0.85 of the range).

Here is the caller graph for this function:

Variable Documentation

◆ k_stickDeadzone

float systems::gamepad::k_stickDeadzone = 0.15f
inlineconstexpr

Stick deadzone as a fraction of full deflection.

Xbox 360 sticks notoriously drift around centre, so anything below this reads as zero. 0.15 is a conservative middle-ground that ignores drift without introducing perceptible "stick travel before motion".

◆ k_triggerThreshold

float systems::gamepad::k_triggerThreshold = 0.5f
inlineconstexpr

Trigger threshold for treating an analog trigger as "pressed".

Triggers are 0..1 analog; we want a clear press semantic for fire / grapple (which are boolean in InputSnapshot). 0.5 matches the Xbox UI convention.