update libs for LibGDX 1.13.5

update gdx-controllers
This commit is contained in:
Anthony Calosa
2025-07-13 22:27:01 +08:00
parent 701cc31e1c
commit 4b6e46ab7d
38 changed files with 21 additions and 69 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -209,7 +209,7 @@
<dependency> <dependency>
<groupId>com.badlogicgames.gdx-controllers</groupId> <groupId>com.badlogicgames.gdx-controllers</groupId>
<artifactId>gdx-controllers-android</artifactId> <artifactId>gdx-controllers-android</artifactId>
<version>2.2.3</version> <version>2.2.4</version>
<scope>system</scope> <scope>system</scope>
<systemPath>${pom.basedir}/libs/gdx-controllers-android.jar</systemPath> <systemPath>${pom.basedir}/libs/gdx-controllers-android.jar</systemPath>
<exclusions> <exclusions>

View File

@@ -89,6 +89,7 @@
-keepclassmembers class com.badlogic.gdx.physics.box2d.World { -keepclassmembers class com.badlogic.gdx.physics.box2d.World {
boolean contactFilter(long, long); boolean contactFilter(long, long);
boolean getUseDefaultContactFilter();
void beginContact(long); void beginContact(long);
void endContact(long); void endContact(long);
void preSolve(long, long); void preSolve(long, long);

View File

@@ -55,8 +55,7 @@ public class AndroidApplication extends Activity implements AndroidApplicationBa
protected boolean firstResume = true; protected boolean firstResume = true;
protected final Array<Runnable> runnables = new Array<Runnable>(); protected final Array<Runnable> runnables = new Array<Runnable>();
protected final Array<Runnable> executedRunnables = new Array<Runnable>(); protected final Array<Runnable> executedRunnables = new Array<Runnable>();
protected final SnapshotArray<LifecycleListener> lifecycleListeners = new SnapshotArray<LifecycleListener>( protected final SnapshotArray<LifecycleListener> lifecycleListeners = new SnapshotArray<>(LifecycleListener[]::new);
LifecycleListener.class);
private final Array<AndroidEventListener> androidEventListeners = new Array<AndroidEventListener>(); private final Array<AndroidEventListener> androidEventListeners = new Array<AndroidEventListener>();
protected int logLevel = LOG_INFO; protected int logLevel = LOG_INFO;
protected ApplicationLogger applicationLogger; protected ApplicationLogger applicationLogger;
@@ -295,8 +294,8 @@ public class AndroidApplication extends Activity implements AndroidApplicationBa
@Override @Override
protected void onDestroy () { protected void onDestroy () {
super.onDestroy();
keyboardHeightProvider.close(); keyboardHeightProvider.close();
super.onDestroy();
} }
@Override @Override

View File

@@ -17,6 +17,7 @@
package com.badlogic.gdx.backends.android; package com.badlogic.gdx.backends.android;
import android.animation.Animator; import android.animation.Animator;
import android.annotation.SuppressLint;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
@@ -63,6 +64,7 @@ import com.badlogic.gdx.utils.GdxRuntimeException;
import com.badlogic.gdx.utils.Pool; import com.badlogic.gdx.utils.Pool;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
/** An implementation of the {@link Input} interface for Android. /** An implementation of the {@link Input} interface for Android.
@@ -114,9 +116,9 @@ public class DefaultAndroidInput extends AbstractInput implements AndroidInput,
public static final int NUM_TOUCHES = 20; public static final int NUM_TOUCHES = 20;
ArrayList<OnKeyListener> keyListeners = new ArrayList(); ArrayList<OnKeyListener> keyListeners = new ArrayList<>();
ArrayList<KeyEvent> keyEvents = new ArrayList(); ArrayList<KeyEvent> keyEvents = new ArrayList<>();
ArrayList<TouchEvent> touchEvents = new ArrayList(); ArrayList<TouchEvent> touchEvents = new ArrayList<>();
int[] touchX = new int[NUM_TOUCHES]; int[] touchX = new int[NUM_TOUCHES];
int[] touchY = new int[NUM_TOUCHES]; int[] touchY = new int[NUM_TOUCHES];
int[] deltaX = new int[NUM_TOUCHES]; int[] deltaX = new int[NUM_TOUCHES];
@@ -126,17 +128,16 @@ public class DefaultAndroidInput extends AbstractInput implements AndroidInput,
int[] realId = new int[NUM_TOUCHES]; int[] realId = new int[NUM_TOUCHES];
float[] pressure = new float[NUM_TOUCHES]; float[] pressure = new float[NUM_TOUCHES];
final boolean hasMultitouch; final boolean hasMultitouch;
private boolean[] justPressedButtons = new boolean[NUM_TOUCHES]; private final boolean[] justPressedButtons = new boolean[NUM_TOUCHES];
private SensorManager manager; private SensorManager manager;
public boolean accelerometerAvailable = false; public boolean accelerometerAvailable = false;
protected final float[] accelerometerValues = new float[3]; protected final float[] accelerometerValues = new float[3];
public boolean gyroscopeAvailable = false; public boolean gyroscopeAvailable = false;
protected final float[] gyroscopeValues = new float[3]; protected final float[] gyroscopeValues = new float[3];
private Handler handle; private final Handler handle;
final Application app; final Application app;
final Context context; final Context context;
protected final AndroidTouchHandler touchHandler; protected final AndroidTouchHandler touchHandler;
private int sleepTime = 0;
protected final AndroidHaptics haptics; protected final AndroidHaptics haptics;
private boolean compassAvailable = false; private boolean compassAvailable = false;
private boolean rotationVectorAvailable = false; private boolean rotationVectorAvailable = false;
@@ -158,12 +159,12 @@ public class DefaultAndroidInput extends AbstractInput implements AndroidInput,
private SensorEventListener compassListener; private SensorEventListener compassListener;
private SensorEventListener rotationVectorListener; private SensorEventListener rotationVectorListener;
private final ArrayList<OnGenericMotionListener> genericMotionListeners = new ArrayList(); private final ArrayList<OnGenericMotionListener> genericMotionListeners = new ArrayList<>();
private final AndroidMouseHandler mouseHandler; private final AndroidMouseHandler mouseHandler;
public DefaultAndroidInput (Application activity, Context context, Object view, AndroidApplicationConfiguration config) { public DefaultAndroidInput (Application activity, Context context, Object view, AndroidApplicationConfiguration config) {
// we hook into View, for LWPs we call onTouch below directly from // we hook into View, for LWPs we call onTouch below directly from
// within the AndroidLivewallpaperEngine#onTouchEvent() method. // within the AndroidWallpaperEngine#onTouchEvent() method.
if (view instanceof View) { if (view instanceof View) {
View v = (View)view; View v = (View)view;
v.setOnKeyListener(this); v.setOnKeyListener(this);
@@ -181,7 +182,6 @@ public class DefaultAndroidInput extends AbstractInput implements AndroidInput,
handle = new Handler(); handle = new Handler();
this.app = activity; this.app = activity;
this.context = context; this.context = context;
this.sleepTime = config.touchSleepTime;
touchHandler = new AndroidTouchHandler(); touchHandler = new AndroidTouchHandler();
hasMultitouch = touchHandler.supportsMultitouch(context); hasMultitouch = touchHandler.supportsMultitouch(context);
@@ -403,15 +403,11 @@ public class DefaultAndroidInput extends AbstractInput implements AndroidInput,
synchronized (this) { synchronized (this) {
if (justTouched) { if (justTouched) {
justTouched = false; justTouched = false;
for (int i = 0; i < justPressedButtons.length; i++) { Arrays.fill(justPressedButtons, false);
justPressedButtons[i] = false;
}
} }
if (keyJustPressed) { if (keyJustPressed) {
keyJustPressed = false; keyJustPressed = false;
for (int i = 0; i < justPressedKeys.length; i++) { Arrays.fill(justPressedKeys, false);
justPressedKeys[i] = false;
}
} }
if (processor != null) { if (processor != null) {
@@ -491,6 +487,7 @@ public class DefaultAndroidInput extends AbstractInput implements AndroidInput,
boolean requestFocus = true; boolean requestFocus = true;
@SuppressLint("ClickableViewAccessibility")
@Override @Override
public boolean onTouch (View view, MotionEvent event) { public boolean onTouch (View view, MotionEvent event) {
if (requestFocus && view != null) { if (requestFocus && view != null) {
@@ -502,51 +499,9 @@ public class DefaultAndroidInput extends AbstractInput implements AndroidInput,
// synchronized in handler.postTouchEvent() // synchronized in handler.postTouchEvent()
touchHandler.onTouch(event, this); touchHandler.onTouch(event, this);
if (sleepTime != 0) {
try {
Thread.sleep(sleepTime);
} catch (InterruptedException e) {
}
}
return true; return true;
} }
// TODO Seems unused. Delete when confirmed.
// /** Called in {@link AndroidLiveWallpaperService} on tap
// * @param x
// * @param y */
// public void onTap (int x, int y) {
// postTap(x, y);
// }
//
// /** Called in {@link AndroidLiveWallpaperService} on drop
// * @param x
// * @param y */
// public void onDrop (int x, int y) {
// postTap(x, y);
// }
//
// protected void postTap (int x, int y) {
// synchronized (this) {
// TouchEvent event = usedTouchEvents.obtain();
// event.timeStamp = System.nanoTime();
// event.pointer = 0;
// event.x = x;
// event.y = y;
// event.type = TouchEvent.TOUCH_DOWN;
// touchEvents.add(event);
//
// event = usedTouchEvents.obtain();
// event.timeStamp = System.nanoTime();
// event.pointer = 0;
// event.x = x;
// event.y = y;
// event.type = TouchEvent.TOUCH_UP;
// touchEvents.add(event);
// }
// Gdx.app.getGraphics().requestRendering();
// }
@Override @Override
public boolean onKey (View v, int keyCode, android.view.KeyEvent e) { public boolean onKey (View v, int keyCode, android.view.KeyEvent e) {
for (int i = 0, n = keyListeners.size(); i < n; i++) for (int i = 0, n = keyListeners.size(); i < n; i++)
@@ -680,9 +635,6 @@ public class DefaultAndroidInput extends AbstractInput implements AndroidInput,
DisplayMetrics metrics = new DisplayMetrics(); DisplayMetrics metrics = new DisplayMetrics();
androidApplication.getWindowManager().getDefaultDisplay().getMetrics(metrics); androidApplication.getWindowManager().getDefaultDisplay().getMetrics(metrics);
int usableHeight = metrics.heightPixels; int usableHeight = metrics.heightPixels;
int sdkVersion = android.os.Build.VERSION.SDK_INT;
if (sdkVersion < 17) return usableHeight;
androidApplication.getWindowManager().getDefaultDisplay().getRealMetrics(metrics); androidApplication.getWindowManager().getDefaultDisplay().getRealMetrics(metrics);
int realHeight = metrics.heightPixels; int realHeight = metrics.heightPixels;
@@ -1036,7 +988,7 @@ public class DefaultAndroidInput extends AbstractInput implements AndroidInput,
final String text = editText.getText().toString(); final String text = editText.getText().toString();
final int selection = editText.getSelectionStart(); final int selection = editText.getSelectionStart();
Gdx.app.postRunnable(new Runnable() { Gdx.app.postRunnable(new Runnable() {
TextInputWrapper wrapper = textInputWrapper; final TextInputWrapper wrapper = textInputWrapper;
@Override @Override
public void run () { public void run () {
@@ -1145,7 +1097,7 @@ public class DefaultAndroidInput extends AbstractInput implements AndroidInput,
* <a href= "http://developer.android.com/reference/android/hardware/SensorManager.html#getRotationMatrix(float[], float[], * <a href= "http://developer.android.com/reference/android/hardware/SensorManager.html#getRotationMatrix(float[], float[],
* float[], float[])" >SensorManager#getRotationMatrix(float[], float[], float[], float[])</a>. Does not manipulate the matrix * float[], float[])" >SensorManager#getRotationMatrix(float[], float[], float[], float[])</a>. Does not manipulate the matrix
* if the platform does not have an accelerometer and compass, or a rotation vector sensor. * if the platform does not have an accelerometer and compass, or a rotation vector sensor.
* @param matrix */ * @param matrix the device's rotation matrix */
public void getRotationMatrix (float[] matrix) { public void getRotationMatrix (float[] matrix) {
if (rotationVectorAvailable) if (rotationVectorAvailable)
SensorManager.getRotationMatrixFromVector(matrix, rotationVectorValues); SensorManager.getRotationMatrixFromVector(matrix, rotationVectorValues);
@@ -1323,7 +1275,7 @@ public class DefaultAndroidInput extends AbstractInput implements AndroidInput,
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
sb.append(i + ":" + realId[i] + " "); sb.append(i).append(":").append(realId[i]).append(" ");
} }
Gdx.app.log("AndroidInput", "Pointer ID lookup failed: " + pointerId + ", " + sb.toString()); Gdx.app.log("AndroidInput", "Pointer ID lookup failed: " + pointerId + ", " + sb.toString());
return -1; return -1;

Binary file not shown.

Binary file not shown.

View File

@@ -225,7 +225,7 @@
<dependency> <dependency>
<groupId>com.badlogicgames.gdx-controllers</groupId> <groupId>com.badlogicgames.gdx-controllers</groupId>
<artifactId>gdx-controllers-desktop</artifactId> <artifactId>gdx-controllers-desktop</artifactId>
<version>2.2.3</version> <version>2.2.4</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>com.badlogicgames.gdx</groupId> <groupId>com.badlogicgames.gdx</groupId>

Binary file not shown.

View File

@@ -64,7 +64,7 @@
<dependency> <dependency>
<groupId>com.badlogicgames.gdx-controllers</groupId> <groupId>com.badlogicgames.gdx-controllers</groupId>
<artifactId>gdx-controllers-core</artifactId> <artifactId>gdx-controllers-core</artifactId>
<version>2.2.3</version> <version>2.2.4</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>com.badlogicgames.gdx</groupId> <groupId>com.badlogicgames.gdx</groupId>