GamepadInput Arduino Lib 1.2.1
Loading...
Searching...
No Matches
gamepad::input::Tracker Class Reference

Tracks changes in gamepad input between frames. More...

#include <gamepad_input_tracker.h>

Public Member Functions

const Stateraw () const noexcept
 Get the current input state.
 
void Reset () noexcept
 Reset tracker state to neutral.
 
void Tick () noexcept
 Advance to next frame (swap states).
 
void Update (State state) noexcept
 Update current frame input state.
 
bool pressed (Button button) const noexcept
 Detect button press (falling edge).
 
bool released (Button button) const noexcept
 Detect button release (rising edge).
 
bool holding (Button button) const noexcept
 Detect button hold.
 
bool AxisChanged (Axis axis, uint8_t threshold) const noexcept
 Detect axis movement.
 
bool operator[] (Button button) const noexcept
 Check if a button is pressed.
 
uint8_t operator[] (Axis axis) const noexcept
 Get axis value.
 

Detailed Description

Tracks changes in gamepad input between frames.

Useful for detecting button press, release, hold, and significant axis movement.

Examples
gamepad_input_tracker.ino.

Definition at line 24 of file gamepad_input_tracker.h.

Member Function Documentation

◆ AxisChanged()

bool gamepad::input::Tracker::AxisChanged ( Axis axis,
uint8_t threshold ) const
inlinenoexcept

Detect axis movement.

Parameters
thresholdThreshold for detecting axis movement
Returns
True if axis has moved

Definition at line 117 of file gamepad_input_tracker.h.

◆ holding()

bool gamepad::input::Tracker::holding ( Button button) const
inlinenoexcept

Detect button hold.

Returns
True if button is held

Definition at line 103 of file gamepad_input_tracker.h.

◆ operator[]() [1/2]

uint8_t gamepad::input::Tracker::operator[] ( Axis axis) const
inlinenoexcept

Get axis value.

Returns
Axis value

Definition at line 143 of file gamepad_input_tracker.h.

◆ operator[]() [2/2]

bool gamepad::input::Tracker::operator[] ( Button button) const
inlinenoexcept

Check if a button is pressed.

Returns
True if button is pressed

Definition at line 131 of file gamepad_input_tracker.h.

◆ pressed()

bool gamepad::input::Tracker::pressed ( Button button) const
inlinenoexcept

Detect button press (falling edge).

Returns
True if button is pressed
Examples
gamepad_input_tracker.ino.

Definition at line 79 of file gamepad_input_tracker.h.

◆ raw()

const State & gamepad::input::Tracker::raw ( ) const
inlinenoexcept

Get the current input state.

Definition at line 34 of file gamepad_input_tracker.h.

◆ released()

bool gamepad::input::Tracker::released ( Button button) const
inlinenoexcept

Detect button release (rising edge).

Returns
True if button is released

Definition at line 91 of file gamepad_input_tracker.h.

◆ Reset()

void gamepad::input::Tracker::Reset ( )
inlinenoexcept

Reset tracker state to neutral.

Definition at line 44 of file gamepad_input_tracker.h.

◆ Tick()

void gamepad::input::Tracker::Tick ( )
inlinenoexcept

Advance to next frame (swap states).

Examples
gamepad_input_tracker.ino.

Definition at line 57 of file gamepad_input_tracker.h.

◆ Update()

void gamepad::input::Tracker::Update ( State state)
inlinenoexcept

Update current frame input state.

Examples
gamepad_input_tracker.ino.

Definition at line 67 of file gamepad_input_tracker.h.


The documentation for this class was generated from the following file: