R-Type 0.1
Loading...
Searching...
No Matches
rtk::Input::InputMapping Class Reference

Table binding up to four physical controls to each of 32 actions. More...

#include <inputAction/inputMapping.hpp>

Public Member Functions

void bindKey (uint8_t bitIndex, ecs::concepts::Key key)
 Binds a keyboard key to an action.
 
void bindGamepad (uint8_t bitIndex, ecs::concepts::GamepadButton button)
 Binds a gamepad button to an action.
 
void bindMouse (uint8_t bitIndex, ecs::concepts::MouseButton mouseButton)
 Binds a mouse button to an action.
 
void bindGamepadAxis (uint8_t bitIndex, ecs::concepts::GamepadAxis axis, float validationPression)
 Binds a gamepad axis to an action.
 
const std::array< InputBinding, MAX_ACTIONS *BINDINGS_PER_ACTION > & getBindings () const
 Returns every binding slot.
 

Static Public Attributes

static constexpr uint8_t MAX_ACTIONS = 32
 Number of actions, one per bit of InputState::actionMask.
 
static constexpr uint8_t BINDINGS_PER_ACTION = 4
 Number of controls that can trigger the same action.
 

Detailed Description

Table binding up to four physical controls to each of 32 actions.

Member Function Documentation

◆ bindKey()

void rtk::Input::InputMapping::bindKey ( uint8_t bitIndex,
ecs::concepts::Key key )
inline

Binds a keyboard key to an action.

Parameters
bitIndexAction index, from 0 to 31.
keyKey to bind.

◆ bindGamepad()

void rtk::Input::InputMapping::bindGamepad ( uint8_t bitIndex,
ecs::concepts::GamepadButton button )
inline

Binds a gamepad button to an action.

Parameters
bitIndexAction index, from 0 to 31.
buttonButton to bind.

◆ bindMouse()

void rtk::Input::InputMapping::bindMouse ( uint8_t bitIndex,
ecs::concepts::MouseButton mouseButton )
inline

Binds a mouse button to an action.

Parameters
bitIndexAction index, from 0 to 31.
mouseButtonButton to bind.

◆ bindGamepadAxis()

void rtk::Input::InputMapping::bindGamepadAxis ( uint8_t bitIndex,
ecs::concepts::GamepadAxis axis,
float validationPression )
inline

Binds a gamepad axis to an action.

Parameters
bitIndexAction index, from 0 to 31.
axisAxis to bind.
validationPressionThreshold, negative values trigger below it.

◆ getBindings()

const std::array< InputBinding, MAX_ACTIONS *BINDINGS_PER_ACTION > & rtk::Input::InputMapping::getBindings ( ) const
inline

Returns every binding slot.

Returns
Slots of action n are at indices 4n to 4n + 3.