summaryrefslogtreecommitdiff
path: root/hello_world/demo/addons
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/addons
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/addons')
-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
8 files changed, 22 insertions, 5 deletions
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"