|
@@ -44,11 +44,15 @@ import android.annotation.SuppressLint;
|
|
import android.content.Context;
|
|
import android.content.Context;
|
|
import android.graphics.PixelFormat;
|
|
import android.graphics.PixelFormat;
|
|
import android.opengl.GLSurfaceView;
|
|
import android.opengl.GLSurfaceView;
|
|
|
|
+import android.os.Build;
|
|
import android.view.GestureDetector;
|
|
import android.view.GestureDetector;
|
|
import android.view.KeyEvent;
|
|
import android.view.KeyEvent;
|
|
import android.view.MotionEvent;
|
|
import android.view.MotionEvent;
|
|
|
|
+import android.view.PointerIcon;
|
|
import android.view.SurfaceView;
|
|
import android.view.SurfaceView;
|
|
|
|
|
|
|
|
+import androidx.annotation.Keep;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* A simple GLSurfaceView sub-class that demonstrate how to perform
|
|
* A simple GLSurfaceView sub-class that demonstrate how to perform
|
|
* OpenGL ES 2.0 rendering into a GL Surface. Note the following important
|
|
* OpenGL ES 2.0 rendering into a GL Surface. Note the following important
|
|
@@ -72,6 +76,7 @@ public class GodotGLRenderView extends GLSurfaceView implements GodotRenderView
|
|
private final GodotInputHandler inputHandler;
|
|
private final GodotInputHandler inputHandler;
|
|
private final GestureDetector detector;
|
|
private final GestureDetector detector;
|
|
private final GodotRenderer godotRenderer;
|
|
private final GodotRenderer godotRenderer;
|
|
|
|
+ private PointerIcon pointerIcon;
|
|
|
|
|
|
public GodotGLRenderView(Context context, Godot godot, XRMode xrMode, boolean p_use_32_bits,
|
|
public GodotGLRenderView(Context context, Godot godot, XRMode xrMode, boolean p_use_32_bits,
|
|
boolean p_use_debug_opengl) {
|
|
boolean p_use_debug_opengl) {
|
|
@@ -83,6 +88,9 @@ public class GodotGLRenderView extends GLSurfaceView implements GodotRenderView
|
|
this.inputHandler = new GodotInputHandler(this);
|
|
this.inputHandler = new GodotInputHandler(this);
|
|
this.detector = new GestureDetector(context, new GodotGestureHandler(this));
|
|
this.detector = new GestureDetector(context, new GodotGestureHandler(this));
|
|
this.godotRenderer = new GodotRenderer();
|
|
this.godotRenderer = new GodotRenderer();
|
|
|
|
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
|
|
|
+ pointerIcon = PointerIcon.getSystemIcon(getContext(), PointerIcon.TYPE_DEFAULT);
|
|
|
|
+ }
|
|
init(xrMode, false, 16, 0);
|
|
init(xrMode, false, 16, 0);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -149,6 +157,21 @@ public class GodotGLRenderView extends GLSurfaceView implements GodotRenderView
|
|
return inputHandler.onGenericMotionEvent(event);
|
|
return inputHandler.onGenericMotionEvent(event);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * called from JNI to change pointer icon
|
|
|
|
+ */
|
|
|
|
+ @Keep
|
|
|
|
+ public void setPointerIcon(int pointerType) {
|
|
|
|
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
|
|
|
+ pointerIcon = PointerIcon.getSystemIcon(getContext(), pointerType);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public PointerIcon onResolvePointerIcon(MotionEvent me, int pointerIndex) {
|
|
|
|
+ return pointerIcon;
|
|
|
|
+ }
|
|
|
|
+
|
|
private void init(XRMode xrMode, boolean translucent, int depth, int stencil) {
|
|
private void init(XRMode xrMode, boolean translucent, int depth, int stencil) {
|
|
setPreserveEGLContextOnPause(true);
|
|
setPreserveEGLContextOnPause(true);
|
|
setFocusableInTouchMode(true);
|
|
setFocusableInTouchMode(true);
|