I use SDL2 and I try to make my controllers rumble on both iOS 13 and Android 10. You can see an extract of my code below:
joystick = SDL_JoystickOpen(device);
SDL_Haptic * haptic = SDL_HapticOpenFromJoystick(joystick);
SDL_HapticRumbleInit(haptic);
SDL_HapticRumblePlay(haptic, (float)0.5, 2000);
SDL_HapticClose(haptic);
But for now it only works on Android 10 with PS4 controller, with Xbox One controller, SDL call to SDL_NumHaptics() allways return 0 on iOS 13 and Android 10 and it's the same with PS4 controller on iOS 13...
Does someone had encounter the same issue ? If yes, is there a way to solve or work around it ?
Thank you in advance.
You have to add SDL_Delay(2000) before yo close the Haptic. If you don't do it, then you are closing it before it could actually do the rumble
I also would add the corresponding checks, as seen in the wiki of sdl2 :