MCPcopy Create free account
hub / github.com/TurningWheel/Barony / bControllerRawInputPressed

Method bControllerRawInputPressed

src/player.cpp:6286–6306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6284}
6285
6286const bool Inputs::bControllerRawInputPressed(int player, const unsigned button) const
6287{
6288 if ( button < 299 || button >= (301 + SDL_GameControllerButton::SDL_CONTROLLER_BUTTON_MAX) )
6289 {
6290 return false;
6291 }
6292 const GameController* controller = getController(player);
6293 if ( !controller )
6294 {
6295 return false;
6296 }
6297
6298 if ( button == 299 || button == 300 ) // triggers
6299 {
6300 return controller->binaryToggle(static_cast<SDL_GameControllerAxis>(button - 299 + SDL_CONTROLLER_AXIS_TRIGGERLEFT));
6301 }
6302 else
6303 {
6304 return controller->binaryToggle(static_cast<SDL_GameControllerButton>(button - 301));
6305 }
6306}
6307
6308const bool Inputs::bControllerRawInputReleased(int player, const unsigned button) const
6309{

Callers 1

handleButtonsFunction · 0.80

Calls 1

binaryToggleMethod · 0.45

Tested by

no test coverage detected