coastline 0.0.4
Loading...
Searching...
No Matches
coastline::ControlBindings Class Reference

Configured action sources, player devices, and stick dead zone for an input owner. More...

#include <controls.h>

Public Member Functions

 ControlBindings (const GameConfig &config)
 Load configured assignments and preset defaults.
void Load (const GameConfig &config)
 Replace assignments, logging and ignoring invalid sources.
std::string_view PlayerDevice (std::size_t player) const
bool IsAnalog (ControlAction action) const
int Read (SDL_Gamepad *gamepad, ControlAction action) const

Detailed Description

Configured action sources, player devices, and stick dead zone for an input owner.

Constructor & Destructor Documentation

◆ ControlBindings()

coastline::ControlBindings::ControlBindings ( const GameConfig & config)
explicit

Load configured assignments and preset defaults.

Parameters
configSettings with optional Controls assignments, preset, devices, and dead zone.

Member Function Documentation

◆ Load()

void coastline::ControlBindings::Load ( const GameConfig & config)

Replace assignments, logging and ignoring invalid sources.

Preset defaults apply only to absent action keys.

Parameters
configSettings with optional Controls assignments, preset, devices, and dead zone.

◆ PlayerDevice()

std::string_view coastline::ControlBindings::PlayerDevice ( std::size_t player) const
Parameters
playerThe player index, 0 or 1.
Returns
The lowercase selector, defaulting to 'auto', valid until Load() or destruction.

◆ IsAnalog()

bool coastline::ControlBindings::IsAnalog ( ControlAction action) const
Parameters
actionA valid action below CONTROL_ACTION_COUNT.
Returns
Whether at least one configured source for the action is an axis.

◆ Read()

int coastline::ControlBindings::Read ( SDL_Gamepad * gamepad,
ControlAction action ) const
Parameters
gamepadThe gamepad to query; null produces zero through SDL input queries.
actionA valid action below CONTROL_ACTION_COUNT.
Returns
The greatest source magnitude, from 0 to CONTROL_FULL, after dead-zone suppression.

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