summaryrefslogtreecommitdiff
path: root/hello_world/demo
diff options
context:
space:
mode:
authorFredia Huya-Kouadio <fhuya@meta.com>2023-07-05 12:06:39 -0700
committerFredia Huya-Kouadio <fhuya@meta.com>2023-07-05 12:10:05 -0700
commit93543c9cc7b9b7b3526fd3eb2a0f6819cc6fee32 (patch)
treeeffa5bd70925039ed7f6d4cbc56d5485e6e9a740 /hello_world/demo
parent01f6b286390e552cd326df00ad16c65e5f5c703b (diff)
downloadgodot-android-samples-93543c9cc7b9b7b3526fd3eb2a0f6819cc6fee32.tar.gz
godot-android-samples-93543c9cc7b9b7b3526fd3eb2a0f6819cc6fee32.tar.bz2
godot-android-samples-93543c9cc7b9b7b3526fd3eb2a0f6819cc6fee32.zip
Update the directory structure for the Android plugin addon
The addon directory now contains two subfolders: - "addons/<plugin_dir>/export": - should contain the editor plugin script and the editor export plugin script. as well as any binaries needed for export - `plugin.cfg` must point to the editor plugin script in this directory - must contain a `.gdignore` file to exclude this directory from the export process - "addons/<plugin_dir>/interface": - optional directory - can contain helper gdscript files used by the project to interface with the functionality exposed by the plugin
Diffstat (limited to 'hello_world/demo')
-rw-r--r--hello_world/demo/Main.gd9
-rw-r--r--hello_world/demo/addons/hello_world_plugin/.gdignore1
-rw-r--r--hello_world/demo/addons/hello_world_plugin/export/.gdignore0
-rw-r--r--hello_world/demo/addons/hello_world_plugin/export/HelloWorld.debug.aar (renamed from hello_world/demo/addons/hello_world_plugin/HelloWorld.debug.aar)bin6117 -> 6114 bytes
-rw-r--r--hello_world/demo/addons/hello_world_plugin/export/HelloWorld.release.aar (renamed from hello_world/demo/addons/hello_world_plugin/HelloWorld.release.aar)bin5988 -> 5978 bytes
-rw-r--r--hello_world/demo/addons/hello_world_plugin/export/hello_world_editor_export_plugin.gd (renamed from hello_world/demo/addons/hello_world_plugin/hello_world_export_plugin.gd)4
-rw-r--r--hello_world/demo/addons/hello_world_plugin/export/hello_world_editor_plugin.gd (renamed from hello_world/demo/addons/hello_world_plugin/hello_world_plugin.gd)2
-rw-r--r--hello_world/demo/addons/hello_world_plugin/interface/hello_world_plugin.gd18
-rw-r--r--hello_world/demo/addons/hello_world_plugin/plugin.cfg2
-rw-r--r--hello_world/demo/export_presets.cfg6
-rw-r--r--hello_world/demo/project.godot1
11 files changed, 30 insertions, 13 deletions
diff --git a/hello_world/demo/Main.gd b/hello_world/demo/Main.gd
index 11b332b..c5174eb 100644
--- a/hello_world/demo/Main.gd
+++ b/hello_world/demo/Main.gd
@@ -1,12 +1,11 @@
extends Node2D
-var hello_world
+var hello_world_plugin : HelloWorldPlugin
func _ready():
- if Engine.has_singleton("HelloWorld"):
- hello_world = Engine.get_singleton("HelloWorld")
+ hello_world_plugin = preload("res://addons/hello_world_plugin/interface/hello_world_plugin.gd").new()
func _on_Button_pressed():
- if hello_world:
- hello_world.helloWorld()
+ if hello_world_plugin:
+ hello_world_plugin.helloWorld()
diff --git a/hello_world/demo/addons/hello_world_plugin/.gdignore b/hello_world/demo/addons/hello_world_plugin/.gdignore
deleted file mode 100644
index 8b13789..0000000
--- a/hello_world/demo/addons/hello_world_plugin/.gdignore
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/hello_world/demo/addons/hello_world_plugin/export/.gdignore b/hello_world/demo/addons/hello_world_plugin/export/.gdignore
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/hello_world/demo/addons/hello_world_plugin/export/.gdignore
diff --git a/hello_world/demo/addons/hello_world_plugin/HelloWorld.debug.aar b/hello_world/demo/addons/hello_world_plugin/export/HelloWorld.debug.aar
index ddb9986..4d59e06 100644
--- a/hello_world/demo/addons/hello_world_plugin/HelloWorld.debug.aar
+++ b/hello_world/demo/addons/hello_world_plugin/export/HelloWorld.debug.aar
Binary files differ
diff --git a/hello_world/demo/addons/hello_world_plugin/HelloWorld.release.aar b/hello_world/demo/addons/hello_world_plugin/export/HelloWorld.release.aar
index 8277aa5..6b112c5 100644
--- a/hello_world/demo/addons/hello_world_plugin/HelloWorld.release.aar
+++ b/hello_world/demo/addons/hello_world_plugin/export/HelloWorld.release.aar
Binary files differ
diff --git a/hello_world/demo/addons/hello_world_plugin/hello_world_export_plugin.gd b/hello_world/demo/addons/hello_world_plugin/export/hello_world_editor_export_plugin.gd
index 6749497..46a8a3b 100644
--- a/hello_world/demo/addons/hello_world_plugin/hello_world_export_plugin.gd
+++ b/hello_world/demo/addons/hello_world_plugin/export/hello_world_editor_export_plugin.gd
@@ -8,9 +8,9 @@ func _supports_platform(platform):
func _get_android_libraries(platform, debug):
if debug:
- return PackedStringArray(["hello_world_plugin/HelloWorld.debug.aar"])
+ return PackedStringArray(["hello_world_plugin/export/HelloWorld.debug.aar"])
else:
- return PackedStringArray(["hello_world_plugin/HelloWorld.release.aar"])
+ return PackedStringArray(["hello_world_plugin/export/HelloWorld.release.aar"])
func _get_name():
return "HelloWorldPlugin"
diff --git a/hello_world/demo/addons/hello_world_plugin/hello_world_plugin.gd b/hello_world/demo/addons/hello_world_plugin/export/hello_world_editor_plugin.gd
index 05bb37a..3865634 100644
--- a/hello_world/demo/addons/hello_world_plugin/hello_world_plugin.gd
+++ b/hello_world/demo/addons/hello_world_plugin/export/hello_world_editor_plugin.gd
@@ -6,7 +6,7 @@ var export_plugin : EditorExportPlugin
func _enter_tree():
# Initialization of the plugin goes here.
- export_plugin = preload("hello_world_export_plugin.gd").new()
+ export_plugin = preload("hello_world_editor_export_plugin.gd").new()
add_export_plugin(export_plugin)
pass
diff --git a/hello_world/demo/addons/hello_world_plugin/interface/hello_world_plugin.gd b/hello_world/demo/addons/hello_world_plugin/interface/hello_world_plugin.gd
new file mode 100644
index 0000000..ed84ef3
--- /dev/null
+++ b/hello_world/demo/addons/hello_world_plugin/interface/hello_world_plugin.gd
@@ -0,0 +1,18 @@
+class_name HelloWorldPlugin extends Object
+
+## Interface used to access the functionality provided by this plugin
+
+var _hello_world_singleton
+
+func _init():
+ if Engine.has_singleton("HelloWorld"):
+ _hello_world_singleton = Engine.get_singleton("HelloWorld")
+ else:
+ printerr("Initialization error: unable to access the java logic")
+
+## Toggle between showing and hiding the hello world text
+func helloWorld():
+ if _hello_world_singleton:
+ _hello_world_singleton.helloWorld()
+ else:
+ printerr("Initialization error")
diff --git a/hello_world/demo/addons/hello_world_plugin/plugin.cfg b/hello_world/demo/addons/hello_world_plugin/plugin.cfg
index 0024e5f..bc8575e 100644
--- a/hello_world/demo/addons/hello_world_plugin/plugin.cfg
+++ b/hello_world/demo/addons/hello_world_plugin/plugin.cfg
@@ -4,4 +4,4 @@ name="HelloWorldPlugin"
description="Sample to showcase how to package a Godot Android plugin "
author="Fredia Huya-Kouadio (m4gr3d)"
version=""
-script="hello_world_plugin.gd"
+script="export/hello_world_editor_plugin.gd"
diff --git a/hello_world/demo/export_presets.cfg b/hello_world/demo/export_presets.cfg
index 3892c84..6356705 100644
--- a/hello_world/demo/export_presets.cfg
+++ b/hello_world/demo/export_presets.cfg
@@ -39,9 +39,6 @@ launcher_icons/adaptive_foreground_432x432=""
launcher_icons/adaptive_background_432x432=""
graphics/opengl_debug=false
xr_features/xr_mode=0
-xr_features/hand_tracking=0
-xr_features/hand_tracking_frequency=0
-xr_features/passthrough=0
screen/immersive_mode=true
screen/support_small=true
screen/support_normal=true
@@ -199,3 +196,6 @@ permissions/write_sms=false
permissions/write_social_stream=false
permissions/write_sync_settings=false
permissions/write_user_dictionary=false
+xr_features/hand_tracking=0
+xr_features/hand_tracking_frequency=0
+xr_features/passthrough=0
diff --git a/hello_world/demo/project.godot b/hello_world/demo/project.godot
index a9cf847..3fcf242 100644
--- a/hello_world/demo/project.godot
+++ b/hello_world/demo/project.godot
@@ -26,6 +26,7 @@ enabled=PackedStringArray("res://addons/hello_world_plugin/plugin.cfg")
[rendering]
renderer/rendering_method="gl_compatibility"
+renderer/rendering_method.mobile="gl_compatibility"
textures/vram_compression/import_etc2_astc=true
environment/defaults/default_environment="res://default_env.tres"
quality/driver/driver_name="GLES2"