v2.3.1: added a setting for vibration & improved vibration support logic
This commit is contained in:
@@ -84,8 +84,12 @@ public class ControllerHandler implements ControllerListener {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean vibrationSupported(){
|
||||
return isControllerConnected() && Controllers.getCurrent().canVibrate();
|
||||
}
|
||||
|
||||
public static void vibrate( int millis ){
|
||||
if (Controllers.getCurrent().canVibrate()) {
|
||||
if (vibrationSupported()) {
|
||||
Controllers.getCurrent().startVibration(millis, 1f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,7 +317,9 @@ public class Game implements ApplicationListener {
|
||||
}
|
||||
|
||||
public static void vibrate( int milliseconds ) {
|
||||
platform.vibrate( milliseconds );
|
||||
if (platform.supportsVibration()) {
|
||||
platform.vibrate(milliseconds);
|
||||
}
|
||||
}
|
||||
|
||||
public interface SceneChangeCallback{
|
||||
|
||||
@@ -39,6 +39,8 @@ public abstract class PlatformSupport {
|
||||
|
||||
public abstract boolean connectedToUnmeteredNetwork();
|
||||
|
||||
public abstract boolean supportsVibration();
|
||||
|
||||
public void vibrate( int millis ){
|
||||
if (ControllerHandler.isControllerConnected()) {
|
||||
ControllerHandler.vibrate(millis);
|
||||
|
||||
Reference in New Issue
Block a user