|
|
@ -87,6 +87,7 @@ public class AndroidSensorJoyInput implements JoyInput, SensorEventListener { |
|
|
|
private InputManager inputManager = null; |
|
|
|
private InputManager inputManager = null; |
|
|
|
private SensorManager sensorManager = null; |
|
|
|
private SensorManager sensorManager = null; |
|
|
|
private Vibrator vibrator = null; |
|
|
|
private Vibrator vibrator = null; |
|
|
|
|
|
|
|
private boolean vibratorActive = false; |
|
|
|
private long maxRumbleTime = 250; // 250ms
|
|
|
|
private long maxRumbleTime = 250; // 250ms
|
|
|
|
private RawInputListener listener = null; |
|
|
|
private RawInputListener listener = null; |
|
|
|
private IntMap<SensorData> sensors = new IntMap<SensorData>(); |
|
|
|
private IntMap<SensorData> sensors = new IntMap<SensorData>(); |
|
|
@ -299,7 +300,7 @@ public class AndroidSensorJoyInput implements JoyInput, SensorEventListener { |
|
|
|
for (Entry entry: sensors) { |
|
|
|
for (Entry entry: sensors) { |
|
|
|
unRegisterListener(entry.getKey()); |
|
|
|
unRegisterListener(entry.getKey()); |
|
|
|
} |
|
|
|
} |
|
|
|
if (vibrator != null) { |
|
|
|
if (vibrator != null && vibratorActive) { |
|
|
|
vibrator.cancel(); |
|
|
|
vibrator.cancel(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -546,8 +547,10 @@ public class AndroidSensorJoyInput implements JoyInput, SensorEventListener { |
|
|
|
|
|
|
|
|
|
|
|
if (rumbleOnDur > 0) { |
|
|
|
if (rumbleOnDur > 0) { |
|
|
|
vibrator.vibrate(rumblePattern, rumbleRepeatFrom); |
|
|
|
vibrator.vibrate(rumblePattern, rumbleRepeatFrom); |
|
|
|
|
|
|
|
vibratorActive = true; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
vibrator.cancel(); |
|
|
|
vibrator.cancel(); |
|
|
|
|
|
|
|
vibratorActive = false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|