summaryrefslogtreecommitdiff
path: root/platform/android/java
diff options
context:
space:
mode:
authorfhuya <fhuya@google.com>2020-03-19 15:28:33 -0700
committerfhuya <fhuya@google.com>2020-03-19 15:28:33 -0700
commitd7b10beb1b856c0a7061a3dc93eac949671093e4 (patch)
tree48b8a27290daaeeb5df0ccebc626a88aa446312d /platform/android/java
parent1a532d53ccfd11cae7efdda1d406fd26da5cdb1e (diff)
Update the naming scheme for the GodotPlugin's methods in preparate of the vulkan integration.
Diffstat (limited to 'platform/android/java')
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/Godot.java17
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPlugin.java33
2 files changed, 33 insertions, 17 deletions
diff --git a/platform/android/java/lib/src/org/godotengine/godot/Godot.java b/platform/android/java/lib/src/org/godotengine/godot/Godot.java
index 4e605f9950..1798a1df3a 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/Godot.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/Godot.java
@@ -55,8 +55,6 @@ import android.hardware.SensorManager;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
-import android.os.Handler;
-import android.os.Looper;
import android.os.Messenger;
import android.os.VibrationEffect;
import android.os.Vibrator;
@@ -64,7 +62,6 @@ import android.provider.Settings.Secure;
import android.support.annotation.CallSuper;
import android.support.annotation.Keep;
import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
import android.support.v4.app.FragmentActivity;
import android.view.Display;
import android.view.KeyEvent;
@@ -197,12 +194,12 @@ public abstract class Godot extends FragmentActivity implements SensorEventListe
};
/**
- * Invoked on the GL thread when the Godot main loop has started.
+ * Invoked on the render thread when the Godot main loop has started.
*/
@CallSuper
- protected void onGLGodotMainLoopStarted() {
+ protected void onGodotMainLoopStarted() {
for (GodotPlugin plugin : pluginRegistry.getAllPlugins()) {
- plugin.onGLGodotMainLoopStarted();
+ plugin.onGodotMainLoopStarted();
}
}
@@ -247,7 +244,7 @@ public abstract class Godot extends FragmentActivity implements SensorEventListe
// Must occur after GodotLib.setup has completed.
for (GodotPlugin plugin : pluginRegistry.getAllPlugins()) {
- plugin.onGLRegisterPluginWithGodotNative();
+ plugin.onRegisterPluginWithGodotNative();
}
setKeepScreenOn("True".equals(GodotLib.getGlobal("display/window/energy_saving/keep_screen_on")));
@@ -787,11 +784,11 @@ public abstract class Godot extends FragmentActivity implements SensorEventListe
}
/**
- * Queue a runnable to be run on the GL thread.
+ * Queue a runnable to be run on the render thread.
* <p>
- * This must be called after the GL thread has started.
+ * This must be called after the render thread has started.
*/
- public final void runOnGLThread(@NonNull Runnable action) {
+ public final void runOnRenderThread(@NonNull Runnable action) {
if (mView != null) {
mView.queueEvent(action);
}
diff --git a/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPlugin.java b/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPlugin.java
index d5bf4fc70e..e745cdd0a5 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPlugin.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPlugin.java
@@ -34,6 +34,7 @@ import android.app.Activity;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
+import android.view.Surface;
import android.view.View;
import java.lang.reflect.Method;
import java.util.ArrayList;
@@ -84,8 +85,10 @@ public abstract class GodotPlugin {
/**
* Register the plugin with Godot native code.
+ *
+ * This method is invoked on the render thread.
*/
- public final void onGLRegisterPluginWithGodotNative() {
+ public final void onRegisterPluginWithGodotNative() {
nativeRegisterSingleton(getPluginName());
Class clazz = getClass();
@@ -169,9 +172,9 @@ public abstract class GodotPlugin {
public boolean onMainBackPressed() { return false; }
/**
- * Invoked on the GL thread when the Godot main loop has started.
+ * Invoked on the render thread when the Godot main loop has started.
*/
- public void onGLGodotMainLoopStarted() {}
+ public void onGodotMainLoopStarted() {}
/**
* Invoked once per frame on the GL thread after the frame is drawn.
@@ -190,6 +193,22 @@ public abstract class GodotPlugin {
public void onGLSurfaceCreated(GL10 gl, EGLConfig config) {}
/**
+ * Invoked once per frame on the Vulkan thread after the frame is drawn.
+ */
+ public void onVkDrawFrame() {}
+
+ /**
+ * Called on the Vulkan thread after the surface is created and whenever the surface size
+ * changes.
+ */
+ public void onVkSurfaceChanged(Surface surface, int width, int height) {}
+
+ /**
+ * Called on the Vulkan thread when the surface is created or recreated.
+ */
+ public void onVkSurfaceCreated(Surface surface) {}
+
+ /**
* Returns the name of the plugin.
* <p>
* This value must match the one listed in the plugin '<meta-data>' manifest entry.
@@ -225,12 +244,12 @@ public abstract class GodotPlugin {
}
/**
- * Queue the specified action to be run on the GL thread.
+ * Queue the specified action to be run on the render thread.
*
- * @param action the action to run on the GL thread
+ * @param action the action to run on the render thread
*/
- protected void runOnGLThread(Runnable action) {
- godot.runOnGLThread(action);
+ protected void runOnRenderThread(Runnable action) {
+ godot.runOnRenderThread(action);
}
/**