Fixed reinitializing the SDL joystick subsystem on Android
This commit is contained in:
parent
0f6d45f840
commit
1880564264
1 changed files with 17 additions and 20 deletions
|
@ -36,13 +36,7 @@ public class SDLControllerManager
|
||||||
private static final String TAG = "SDLControllerManager";
|
private static final String TAG = "SDLControllerManager";
|
||||||
|
|
||||||
public static void initialize() {
|
public static void initialize() {
|
||||||
mJoystickHandler = null;
|
if (mJoystickHandler == null) {
|
||||||
mHapticHandler = null;
|
|
||||||
|
|
||||||
SDLControllerManager.setup();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setup() {
|
|
||||||
if (Build.VERSION.SDK_INT >= 19) {
|
if (Build.VERSION.SDK_INT >= 19) {
|
||||||
mJoystickHandler = new SDLJoystickHandler_API19();
|
mJoystickHandler = new SDLJoystickHandler_API19();
|
||||||
} else if (Build.VERSION.SDK_INT >= 16) {
|
} else if (Build.VERSION.SDK_INT >= 16) {
|
||||||
|
@ -52,13 +46,16 @@ public class SDLControllerManager
|
||||||
} else {
|
} else {
|
||||||
mJoystickHandler = new SDLJoystickHandler();
|
mJoystickHandler = new SDLJoystickHandler();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mHapticHandler == null) {
|
||||||
if (Build.VERSION.SDK_INT >= 26) {
|
if (Build.VERSION.SDK_INT >= 26) {
|
||||||
mHapticHandler = new SDLHapticHandler_API26();
|
mHapticHandler = new SDLHapticHandler_API26();
|
||||||
} else {
|
} else {
|
||||||
mHapticHandler = new SDLHapticHandler();
|
mHapticHandler = new SDLHapticHandler();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Joystick glue code, just a series of stubs that redirect to the SDLJoystickHandler instance
|
// Joystick glue code, just a series of stubs that redirect to the SDLJoystickHandler instance
|
||||||
public static boolean handleJoystickMotionEvent(MotionEvent event) {
|
public static boolean handleJoystickMotionEvent(MotionEvent event) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue