public AndroidControllers() { Gdx.app.addLifecycleListener(this); gatherControllers(false); setupEventQueue(); ((AndroidInput)Gdx.input).addKeyListener(this); ((AndroidInputThreePlus)Gdx.input).addGenericMotionListener(this); // use InputManager on Android +4.1 to receive (dis-)connect events if(Gdx.app.getVersion() >= 16) { try { String className = "com.badlogic.gdx.controllers.android.ControllerLifeCycleListener"; Class.forName(className).getConstructor(AndroidControllers.class).newInstance(this); } catch(Exception e) { Gdx.app.log(TAG, "Couldn't register controller life-cycle listener"); } } }
className = preferredManager; } else if (type == ApplicationType.Android) { if (Gdx.app.getVersion() >= 12) { className = "com.badlogic.gdx.controllers.android.AndroidControllers"; } else {
/** * Returns the Android API level it's basically the same as android.os.Build.VERSION.SDK_INT * @return the API level. Returns 0 if the current OS isn't Android */ public static int getAndroidApiLevel () { if (isAndroid()) { return Gdx.app.getVersion(); } else { return 0; } }
/** * Returns the Android API level it's basically the same as android.os.Build.VERSION.SDK_INT * @return the API level. Returns 0 if the current OS isn't Android */ public static int getAndroidApiLevel() { if (isAndroid()) { return Gdx.app.getVersion(); } else { return 0; } }
className = preferredManager; } else if (type == ApplicationType.Android) { if (Gdx.app.getVersion() >= 12) { className = "com.badlogic.gdx.controllers.android.AndroidControllers"; } else {