Отключил х86 исправил ипут на Waydroid
This commit is contained in:
@@ -15,7 +15,7 @@ android {
|
|||||||
versionName = "1.3.128"
|
versionName = "1.3.128"
|
||||||
|
|
||||||
ndk.abiFilters.add("armeabi-v7a")
|
ndk.abiFilters.add("armeabi-v7a")
|
||||||
ndk.abiFilters.add("x86")
|
//ndk.abiFilters.add("x86")
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,64 +67,111 @@ public class GameGLSurfaceView extends GLSurfaceView {
|
|||||||
setEGLConfigChooser(new ConfigChooser(5, 6, 5, 0, 24, 0));
|
setEGLConfigChooser(new ConfigChooser(5, 6, 5, 0, 24, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // android.view.View
|
@Override
|
||||||
public boolean onTouchEvent(MotionEvent motionEvent) {
|
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);
|
final MotionEvent obtain = MotionEvent.obtain(motionEvent);
|
||||||
queueEvent(new Runnable() { // from class: com.ea.ironmonkey.GameGLSurfaceView.2
|
queueEvent(() -> {
|
||||||
@Override // java.lang.Runnable
|
final int action = obtain.getActionMasked(); // Используем getActionMasked() вместо getAction()
|
||||||
public void run() {
|
final int pointerCount = obtain.getPointerCount();
|
||||||
int i2 = 0;
|
|
||||||
if (GameGLSurfaceView.this.kMotionEvent_GetSource) {
|
if (GameGLSurfaceView.this.kMotionEvent_GetSource) {
|
||||||
if (obtain.getSource() == 4098) {
|
// Обработка событий от разных источников
|
||||||
if (obtain.getAction() == 2) {
|
if(obtain.getSource() == 8194) {
|
||||||
while (i2 < pointerCount) {
|
processTouchScreenEvent(obtain, action, pointerCount);
|
||||||
GameGLSurfaceView.this.nativeTouchScreenEvent(obtain.getAction(), obtain.getPointerId(i2), obtain.getX(i2), obtain.getY(i2));
|
}else if (obtain.getSource() == 4098) { // SOURCE_TOUCHSCREEN
|
||||||
i2++;
|
processTouchScreenEvent(obtain, action, pointerCount);
|
||||||
}
|
} else if (obtain.getSource() == 1048584) { // SOURCE_MOUSE или другой источник
|
||||||
return;
|
processTouchPadEvent(obtain, action, pointerCount);
|
||||||
} 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));
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// Обработка по умолчанию
|
||||||
|
processTouchScreenEvent(obtain, action, pointerCount);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return true;
|
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 class ConfigChooser implements GLSurfaceView.EGLConfigChooser {
|
||||||
private static final int EGL_DEPTH_ENCODING_NONLINEAR_NV = 12515;
|
private static final int EGL_DEPTH_ENCODING_NONLINEAR_NV = 12515;
|
||||||
private static final int EGL_DEPTH_ENCODING_NV = 12514;
|
private static final int EGL_DEPTH_ENCODING_NV = 12514;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ android {
|
|||||||
minSdk = 27
|
minSdk = 27
|
||||||
|
|
||||||
ndk {
|
ndk {
|
||||||
abiFilters += listOf("armeabi-v7a", "x86")
|
abiFilters += listOf("armeabi-v7a")
|
||||||
}
|
}
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|||||||
Reference in New Issue
Block a user