Отключил х86 исправил ипут на Waydroid

This commit is contained in:
2025-08-26 12:22:46 +03:00
parent 38665f3545
commit 8951489609
3 changed files with 99 additions and 52 deletions
+1 -1
View File
@@ -15,7 +15,7 @@ android {
versionName = "1.3.128"
ndk.abiFilters.add("armeabi-v7a")
ndk.abiFilters.add("x86")
//ndk.abiFilters.add("x86")
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
@@ -67,64 +67,111 @@ public class GameGLSurfaceView extends GLSurfaceView {
setEGLConfigChooser(new ConfigChooser(5, 6, 5, 0, 24, 0));
}
@Override // android.view.View
@Override
public boolean onTouchEvent(MotionEvent motionEvent) {
GameActivityMain gameActivityMain = this.mActivity;
int i = GameActivityMain.state;
GameActivityMain gameActivityMain2 = this.mActivity;
if (i != 8) {
return true;
}
motionEvent.getHistorySize();
final int pointerCount = motionEvent.getPointerCount();
final MotionEvent obtain = MotionEvent.obtain(motionEvent);
queueEvent(new Runnable() { // from class: com.ea.ironmonkey.GameGLSurfaceView.2
@Override // java.lang.Runnable
public void run() {
int i2 = 0;
if (GameGLSurfaceView.this.kMotionEvent_GetSource) {
if (obtain.getSource() == 4098) {
if (obtain.getAction() == 2) {
while (i2 < pointerCount) {
GameGLSurfaceView.this.nativeTouchScreenEvent(obtain.getAction(), obtain.getPointerId(i2), obtain.getX(i2), obtain.getY(i2));
i2++;
}
return;
} else {
int actionIndex = obtain.getActionIndex();
GameGLSurfaceView.this.nativeTouchScreenEvent(obtain.getAction(), obtain.getPointerId(actionIndex), obtain.getX(actionIndex), obtain.getY(actionIndex));
return;
}
}
if (obtain.getSource() == 1048584) {
if (obtain.getAction() == 2) {
while (i2 < pointerCount) {
GameGLSurfaceView.this.nativeTouchPadEvent(obtain.getAction(), obtain.getPointerId(i2), obtain.getX(i2), obtain.getY(i2));
i2++;
}
return;
} else {
int actionIndex2 = obtain.getActionIndex();
GameGLSurfaceView.this.nativeTouchPadEvent(obtain.getAction(), obtain.getPointerId(actionIndex2), obtain.getX(actionIndex2), obtain.getY(actionIndex2));
return;
}
}
return;
}
if (obtain.getAction() == 2) {
while (i2 < pointerCount) {
GameGLSurfaceView.this.nativeTouchScreenEvent(obtain.getAction(), obtain.getPointerId(i2), obtain.getX(i2), obtain.getY(i2));
i2++;
}
} else {
int actionIndex3 = obtain.getActionIndex();
GameGLSurfaceView.this.nativeTouchScreenEvent(obtain.getAction(), obtain.getPointerId(actionIndex3), obtain.getX(actionIndex3), obtain.getY(actionIndex3));
queueEvent(() -> {
final int action = obtain.getActionMasked(); // Используем getActionMasked() вместо getAction()
final int pointerCount = obtain.getPointerCount();
if (GameGLSurfaceView.this.kMotionEvent_GetSource) {
// Обработка событий от разных источников
if(obtain.getSource() == 8194) {
processTouchScreenEvent(obtain, action, pointerCount);
}else if (obtain.getSource() == 4098) { // SOURCE_TOUCHSCREEN
processTouchScreenEvent(obtain, action, pointerCount);
} else if (obtain.getSource() == 1048584) { // SOURCE_MOUSE или другой источник
processTouchPadEvent(obtain, action, pointerCount);
}
} else {
// Обработка по умолчанию
processTouchScreenEvent(obtain, action, pointerCount);
}
});
return true;
}
// Вспомогательные методы для обработки разных типов событий
private void processTouchScreenEvent(MotionEvent event, int action, int pointerCount) {
switch (action) {
case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_POINTER_DOWN:
case MotionEvent.ACTION_POINTER_UP:
// Для точечных событий обрабатываем только нужный указатель
int actionIndex = event.getActionIndex();
GameGLSurfaceView.this.nativeTouchScreenEvent(
event.getAction(),
event.getPointerId(actionIndex),
event.getX(actionIndex),
event.getY(actionIndex)
);
break;
case MotionEvent.ACTION_MOVE:
// Для движения обрабатываем все указатели
for (int i = 0; i < pointerCount; i++) {
GameGLSurfaceView.this.nativeTouchScreenEvent(
event.getAction(),
event.getPointerId(i),
event.getX(i),
event.getY(i)
);
}
break;
default:
// Обработка других действий
int index = event.getActionIndex();
GameGLSurfaceView.this.nativeTouchScreenEvent(
event.getAction(),
event.getPointerId(index),
event.getX(index),
event.getY(index)
);
break;
}
}
private void processTouchPadEvent(MotionEvent event, int action, int pointerCount) {
// Аналогичная логика для тачпада
switch (action) {
case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_POINTER_DOWN:
case MotionEvent.ACTION_POINTER_UP:
int actionIndex = event.getActionIndex();
GameGLSurfaceView.this.nativeTouchPadEvent(
event.getAction(),
event.getPointerId(actionIndex),
event.getX(actionIndex),
event.getY(actionIndex)
);
break;
case MotionEvent.ACTION_MOVE:
for (int i = 0; i < pointerCount; i++) {
GameGLSurfaceView.this.nativeTouchPadEvent(
event.getAction(),
event.getPointerId(i),
event.getX(i),
event.getY(i)
);
}
break;
default:
int index = event.getActionIndex();
GameGLSurfaceView.this.nativeTouchPadEvent(
event.getAction(),
event.getPointerId(index),
event.getX(index),
event.getY(index)
);
break;
}
}
private static class ConfigChooser implements GLSurfaceView.EGLConfigChooser {
private static final int EGL_DEPTH_ENCODING_NONLINEAR_NV = 12515;
private static final int EGL_DEPTH_ENCODING_NV = 12514;
+1 -1
View File
@@ -11,7 +11,7 @@ android {
minSdk = 27
ndk {
abiFilters += listOf("armeabi-v7a", "x86")
abiFilters += listOf("armeabi-v7a")
}
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"