Added HIDAPI joystick drivers for more consistent support for Xbox, PS4 and Nintendo Switch Pro controller support across platforms.

Added SDL_GameControllerRumble() and SDL_JoystickRumble() for simple force feedback outside of the SDL haptics API
This commit is contained in:
Sam Lantinga 2018-08-09 16:00:17 -07:00
parent 13edfebf3b
commit db39b4811f
53 changed files with 6827 additions and 1367 deletions

View file

@ -114,6 +114,11 @@ loop(void *arg)
case SDL_CONTROLLERBUTTONDOWN:
case SDL_CONTROLLERBUTTONUP:
SDL_Log("Controller button %s %s\n", SDL_GameControllerGetStringForButton((SDL_GameControllerButton)event.cbutton.button), event.cbutton.state ? "pressed" : "released");
/* First button triggers a 0.5 second full strength rumble */
if (event.type == SDL_CONTROLLERBUTTONDOWN &&
event.cbutton.button == SDL_CONTROLLER_BUTTON_A) {
SDL_GameControllerRumble(gamecontroller, 0xFFFF, 0xFFFF, 500);
}
break;
case SDL_KEYDOWN:
if (event.key.keysym.sym != SDLK_ESCAPE) {