summaryrefslogtreecommitdiff
path: root/hello_world
diff options
context:
space:
mode:
Diffstat (limited to 'hello_world')
-rw-r--r--hello_world/README.md3
-rw-r--r--hello_world/build.gradle4
-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
13 files changed, 35 insertions, 15 deletions
diff --git a/hello_world/README.md b/hello_world/README.md
new file mode 100644
index 0000000..5cfb640
--- /dev/null
+++ b/hello_world/README.md
@@ -0,0 +1,3 @@
+## Hello World plugin
+
+Showcase how to build a simple Godot Android plugin which is invoked from gdscript
diff --git a/hello_world/build.gradle b/hello_world/build.gradle
index 003ea6f..4c12e93 100644
--- a/hello_world/build.gradle
+++ b/hello_world/build.gradle
@@ -30,13 +30,13 @@ dependencies {
task copyDebugAARToAddons(type: Copy) {
from 'build/outputs/aar'
include 'HelloWorld.debug.aar'
- into 'demo/addons/hello_world_plugin'
+ into 'demo/addons/hello_world_plugin/export'
}
task copyReleaseAARToAddons(type: Copy) {
from 'build/outputs/aar'
include 'HelloWorld.release.aar'
- into 'demo/addons/hello_world_plugin'
+ into 'demo/addons/hello_world_plugin/export'
}
assemble.finalizedBy(copyDebugAARToAddons)
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"