Implement SDL_HapticStopEffect on Android (thanks Rachel!)

This commit is contained in:
Sam Lantinga 2018-08-24 10:41:57 -07:00
parent 69441bd02e
commit 8dab95ee3d
4 changed files with 26 additions and 1 deletions

View file

@ -81,6 +81,14 @@ public class SDLControllerManager
mHapticHandler.run(device_id, length);
}
/**
* This method is called by SDL using JNI.
*/
public static void hapticStop(int device_id)
{
mHapticHandler.stop(device_id);
}
// Check if a given device is considered a possible SDL joystick
public static boolean isDeviceSDLJoystick(int deviceId) {
InputDevice device = InputDevice.getDevice(deviceId);
@ -422,6 +430,13 @@ class SDLHapticHandler {
}
}
public void stop(int device_id) {
SDLHaptic haptic = getHaptic(device_id);
if (haptic != null) {
haptic.vib.cancel();
}
}
public void pollHapticDevices() {
final int deviceId_VIBRATOR_SERVICE = 999999;