Don't check input devices on platforms that don't support it

This commit is contained in:
TwistedUmbrella 2014-01-19 21:44:57 -05:00
parent dbfa473034
commit 5b386891f3
1 changed files with 13 additions and 1 deletions

View File

@ -181,6 +181,8 @@ public class GL2JNIActivity extends Activity {
}
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
JNIdc.initControllers(new boolean[] {controllerTwoConnected, controllerThreeConnected, controllerFourConnected});
int joys[] = InputDevice.getDeviceIds();
@ -279,6 +281,9 @@ public class GL2JNIActivity extends Activity {
OuyaController.BUTTON_R1, key_CONT_START };
}
}
}
}
// When viewing a resource, pass its URI to the native code for opening
@ -298,6 +303,8 @@ public class GL2JNIActivity extends Activity {
public boolean onGenericMotionEvent(MotionEvent event) {
// Log.w("INPUT", event.toString() + " " + event.getSource());
// Get all the axis for the KeyEvent
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
Integer playerNum = deviceDescriptor_PlayerNum.get(deviceId_deviceDescriptor.get(event.getDeviceId()));
@ -330,7 +337,7 @@ public class GL2JNIActivity extends Activity {
GL2JNIView.jx[playerNum] = (int) (LS_X * 126);
GL2JNIView.jy[playerNum] = (int) (LS_Y * 126);
}
}
if ((xbox[playerNum] || nVidia[playerNum]) && ((globalLS_X[playerNum] == previousLS_X[playerNum] && globalLS_Y[playerNum] == previousLS_Y[playerNum])
@ -340,6 +347,11 @@ public class GL2JNIActivity extends Activity {
return false;
else
return true;
} else {
return false;
}
}
private static final int key_CONT_B = 0x0002;