Add options to invert scroll direction and swap gamepad buttons

Fixes #463
Fixes #467
This commit is contained in:
Cameron Gutman
2020-12-25 22:21:20 -06:00
parent a11f623b17
commit 5096ff6496
9 changed files with 103 additions and 1 deletions

View File

@@ -167,6 +167,23 @@ void SdlInputHandler::handleControllerButtonEvent(SDL_ControllerButtonEvent* eve
return;
}
if (m_SwapFaceButtons) {
switch (event->button) {
case SDL_CONTROLLER_BUTTON_A:
event->button = SDL_CONTROLLER_BUTTON_B;
break;
case SDL_CONTROLLER_BUTTON_B:
event->button = SDL_CONTROLLER_BUTTON_A;
break;
case SDL_CONTROLLER_BUTTON_X:
event->button = SDL_CONTROLLER_BUTTON_Y;
break;
case SDL_CONTROLLER_BUTTON_Y:
event->button = SDL_CONTROLLER_BUTTON_X;
break;
}
}
if (event->state == SDL_PRESSED) {
state->buttons |= k_ButtonMap[event->button];