summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFredia Huya-Kouadio <fhuya@meta.com>2023-07-02 16:59:41 -0700
committerGitHub <noreply@github.com>2023-07-02 16:59:41 -0700
commit01f6b286390e552cd326df00ad16c65e5f5c703b (patch)
tree9ca58d95496b72bb7974d4525f4821284e3ade7f
parent8a50b716f5d335d0c060eb096032fc2d214dc635 (diff)
parent1d35faab621629b7cf27db2675c439d390a32541 (diff)
downloadgodot-android-samples-01f6b286390e552cd326df00ad16c65e5f5c703b.tar.gz
godot-android-samples-01f6b286390e552cd326df00ad16c65e5f5c703b.tar.bz2
godot-android-samples-01f6b286390e552cd326df00ad16c65e5f5c703b.zip
Merge pull request #1 from m4gr3d/godot_4_2_plugin_refactor
Godot 4.2 plugin refactor
-rw-r--r--.gitignore1
-rw-r--r--README.md5
-rw-r--r--build.gradle27
-rw-r--r--config.gradle11
-rw-r--r--gradle/wrapper/gradle-wrapper.properties2
-rw-r--r--hello_signals/build.gradle42
-rw-r--r--hello_signals/demo/Main.gd4
-rw-r--r--hello_signals/demo/Main.tscn38
-rw-r--r--hello_signals/demo/addons/hello_signals_plugin/.gdignore1
-rw-r--r--hello_signals/demo/addons/hello_signals_plugin/HelloSignals.debug.aarbin0 -> 6825 bytes
-rw-r--r--hello_signals/demo/addons/hello_signals_plugin/HelloSignals.release.aarbin0 -> 6647 bytes
-rw-r--r--hello_signals/demo/addons/hello_signals_plugin/hello_signals_export_plugin.gd16
-rw-r--r--hello_signals/demo/addons/hello_signals_plugin/hello_signals_plugin.gd17
-rw-r--r--hello_signals/demo/addons/hello_signals_plugin/plugin.cfg7
-rw-r--r--hello_signals/demo/default_env.tres6
-rw-r--r--hello_signals/demo/export_presets.cfg55
-rw-r--r--hello_signals/demo/project.godot21
-rw-r--r--hello_signals/src/main/java/fhuyakou/godot/plugin/android/hellosignals/HelloSignalsPlugin.kt6
-rw-r--r--hello_world/build.gradle39
-rw-r--r--hello_world/demo/Main.tscn19
-rw-r--r--hello_world/demo/addons/hello_world_plugin/.gdignore1
-rw-r--r--hello_world/demo/addons/hello_world_plugin/HelloWorld.debug.aarbin0 -> 6117 bytes
-rw-r--r--hello_world/demo/addons/hello_world_plugin/HelloWorld.release.aarbin0 -> 5988 bytes
-rw-r--r--hello_world/demo/addons/hello_world_plugin/hello_world_export_plugin.gd16
-rw-r--r--hello_world/demo/addons/hello_world_plugin/hello_world_plugin.gd17
-rw-r--r--hello_world/demo/addons/hello_world_plugin/plugin.cfg7
-rw-r--r--hello_world/demo/default_env.tres6
-rw-r--r--hello_world/demo/export_presets.cfg57
-rw-r--r--hello_world/demo/project.godot21
-rw-r--r--hello_world/src/main/java/fhuyakou/godot/plugin/android/helloworld/HelloWorldPlugin.java24
-rw-r--r--libs/godot-lib.release.aarbin11795976 -> 0 bytes
-rw-r--r--settings.gradle20
32 files changed, 296 insertions, 190 deletions
diff --git a/.gitignore b/.gitignore
index 4f7b373..49e602f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,3 +7,4 @@
/captures
.externalNativeBuild
.cxx
+.godot
diff --git a/README.md b/README.md
index deb92e5..547f6c2 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,4 @@
# Godot-Android-Plugins
-Collection of Godot Android plugins.
-The plugins in this repo require the [Android plugin refactor PR](https://github.com/godotengine/godot/pull/33682) to be operational.
+Collection of Godot Android plugin samples.
+
+**Requires Godot 4.2 or above**
diff --git a/build.gradle b/build.gradle
index 601d66a..bef5465 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,32 +1,19 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
-
buildscript {
-
- ext {
- kotlin_version = '1.3.70'
- }
+ apply from: 'config.gradle'
+
repositories {
google()
- jcenter()
-
+ mavenCentral()
+ maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.6.1'
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
-
-
- // NOTE: Do not place your application dependencies here; they belong
- // in the individual module build.gradle files
+ classpath "com.android.tools.build:gradle:$versions.gradlePluginVersion"
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$versions.kotlinVersion"
}
}
-allprojects {
- repositories {
- google()
- jcenter()
-
- }
-}
+apply from: 'config.gradle'
task clean(type: Delete) {
delete rootProject.buildDir
diff --git a/config.gradle b/config.gradle
new file mode 100644
index 0000000..d72d4ba
--- /dev/null
+++ b/config.gradle
@@ -0,0 +1,11 @@
+ext {
+ versions = [
+ gradlePluginVersion: '7.2.1',
+ compileSdk : 33,
+ minSdk : 21,
+ targetSdk : 33,
+ godotLibVersion : '4.0.3.stable',
+ javaVersion : JavaVersion.VERSION_11,
+ kotlinVersion : '1.7.21',
+ ]
+}
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 3a02130..63c7136 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
diff --git a/hello_signals/build.gradle b/hello_signals/build.gradle
index 55bee0e..cf82b7b 100644
--- a/hello_signals/build.gradle
+++ b/hello_signals/build.gradle
@@ -1,14 +1,14 @@
-apply plugin: 'com.android.library'
-apply plugin: 'kotlin-android'
-apply plugin: 'kotlin-android-extensions'
+plugins {
+ id 'com.android.library'
+ id 'org.jetbrains.kotlin.android'
+}
android {
- compileSdkVersion 29
- buildToolsVersion "29.0.1"
+ compileSdk versions.compileSdk
defaultConfig {
- minSdkVersion 18
- targetSdkVersion 29
+ minSdk versions.minSdk
+ targetSdk versions.targetSdk
versionCode 1
versionName "1.0"
}
@@ -23,15 +23,21 @@ android {
}
dependencies {
- /*
- Used to provide dependency on the Godot Android library. A version of that
- library will be made available for each stable release of Godot.
-
- `compileOnly` is used instead of `implementation` to ensure that the
- godot library is not bundled with the generated plugin AAR file. This is
- necessary since the Godot editor will also provide a version of the godot
- library when building the final binary.
- */
- compileOnly fileTree(dir: '../libs', include: ['godot-lib*.aar'])
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+ compileOnly "org.godotengine:godot:$versions.godotLibVersion"
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$versions.kotlinVersion"
+}
+
+task copyDebugAARToAddons(type: Copy) {
+ from 'build/outputs/aar'
+ include 'HelloSignals.debug.aar'
+ into 'demo/addons/hello_signals_plugin'
}
+
+task copyReleaseAARToAddons(type: Copy) {
+ from 'build/outputs/aar'
+ include 'HelloSignals.release.aar'
+ into 'demo/addons/hello_signals_plugin'
+}
+
+assemble.finalizedBy(copyDebugAARToAddons)
+assemble.finalizedBy(copyReleaseAARToAddons)
diff --git a/hello_signals/demo/Main.gd b/hello_signals/demo/Main.gd
index 22e5255..1b3e972 100644
--- a/hello_signals/demo/Main.gd
+++ b/hello_signals/demo/Main.gd
@@ -7,9 +7,9 @@ var helloSignals
func _ready():
if Engine.has_singleton("HelloSignals"):
helloSignals = Engine.get_singleton("HelloSignals")
- helloSignals.connect("TikTok", self, "_on_tiktok")
+ helloSignals.connect("TikTok", Callable(self, "_on_tiktok"))
- $Button.connect("pressed", self, "_on_Button_pressed")
+ $Button.connect("pressed", Callable(self, "_on_Button_pressed"))
else:
print("Couldn't find HelloSignals singleton")
diff --git a/hello_signals/demo/Main.tscn b/hello_signals/demo/Main.tscn
index 41e5fb4..2f51657 100644
--- a/hello_signals/demo/Main.tscn
+++ b/hello_signals/demo/Main.tscn
@@ -1,34 +1,26 @@
-[gd_scene load_steps=3 format=2]
+[gd_scene load_steps=3 format=3 uid="uid://bdybkbximkyj2"]
-[ext_resource path="res://Main.gd" type="Script" id=1]
+[ext_resource type="Script" path="res://Main.gd" id="1"]
-[sub_resource type="StyleBoxEmpty" id=1]
+[sub_resource type="StyleBoxEmpty" id="1"]
[node name="Main" type="Node2D"]
-script = ExtResource( 1 )
+script = ExtResource("1")
[node name="Button" type="Button" parent="."]
-margin_left = 90.0
-margin_top = 178.0
-margin_right = 281.0
-margin_bottom = 261.0
-rect_scale = Vector2( 2, 2 )
+offset_left = 90.0
+offset_top = 178.0
+offset_right = 281.0
+offset_bottom = 261.0
+scale = Vector2(2, 2)
text = "Start Timer"
-__meta__ = {
-"_edit_use_anchors_": false
-}
[node name="Label" type="Label" parent="."]
-margin_left = 515.0
-margin_top = 217.0
-margin_right = 591.0
-margin_bottom = 265.0
-rect_scale = Vector2( 2, 2 )
-custom_styles/normal = SubResource( 1 )
+offset_left = 515.0
+offset_top = 217.0
+offset_right = 591.0
+offset_bottom = 265.0
+scale = Vector2(2, 2)
+theme_override_styles/normal = SubResource("1")
text = "00"
-align = 1
-valign = 1
uppercase = true
-__meta__ = {
-"_edit_use_anchors_": false
-}
diff --git a/hello_signals/demo/addons/hello_signals_plugin/.gdignore b/hello_signals/demo/addons/hello_signals_plugin/.gdignore
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/hello_signals/demo/addons/hello_signals_plugin/.gdignore
@@ -0,0 +1 @@
+
diff --git a/hello_signals/demo/addons/hello_signals_plugin/HelloSignals.debug.aar b/hello_signals/demo/addons/hello_signals_plugin/HelloSignals.debug.aar
new file mode 100644
index 0000000..3e445c6
--- /dev/null
+++ b/hello_signals/demo/addons/hello_signals_plugin/HelloSignals.debug.aar
Binary files differ
diff --git a/hello_signals/demo/addons/hello_signals_plugin/HelloSignals.release.aar b/hello_signals/demo/addons/hello_signals_plugin/HelloSignals.release.aar
new file mode 100644
index 0000000..6440048
--- /dev/null
+++ b/hello_signals/demo/addons/hello_signals_plugin/HelloSignals.release.aar
Binary files differ
diff --git a/hello_signals/demo/addons/hello_signals_plugin/hello_signals_export_plugin.gd b/hello_signals/demo/addons/hello_signals_plugin/hello_signals_export_plugin.gd
new file mode 100644
index 0000000..afc4162
--- /dev/null
+++ b/hello_signals/demo/addons/hello_signals_plugin/hello_signals_export_plugin.gd
@@ -0,0 +1,16 @@
+@tool
+extends EditorExportPlugin
+
+func _supports_platform(platform):
+ if platform is EditorExportPlatformAndroid:
+ return true
+ return false
+
+func _get_android_libraries(platform, debug):
+ if debug:
+ return PackedStringArray(["hello_signals_plugin/HelloSignals.debug.aar"])
+ else:
+ return PackedStringArray(["hello_signals_plugin/HelloSignals.release.aar"])
+
+func _get_name():
+ return "Hello Signals plugin"
diff --git a/hello_signals/demo/addons/hello_signals_plugin/hello_signals_plugin.gd b/hello_signals/demo/addons/hello_signals_plugin/hello_signals_plugin.gd
new file mode 100644
index 0000000..65d8034
--- /dev/null
+++ b/hello_signals/demo/addons/hello_signals_plugin/hello_signals_plugin.gd
@@ -0,0 +1,17 @@
+@tool
+extends EditorPlugin
+
+# A class member to hold the export plugin during its lifecycle
+var export_plugin : EditorExportPlugin
+
+func _enter_tree():
+ # Initialization of the plugin goes here.
+ export_plugin = preload("hello_signals_export_plugin.gd").new()
+ add_export_plugin(export_plugin)
+ pass
+
+
+func _exit_tree():
+ # Clean-up of the plugin goes here.
+ remove_export_plugin(export_plugin)
+ export_plugin = null
diff --git a/hello_signals/demo/addons/hello_signals_plugin/plugin.cfg b/hello_signals/demo/addons/hello_signals_plugin/plugin.cfg
new file mode 100644
index 0000000..8fb2c37
--- /dev/null
+++ b/hello_signals/demo/addons/hello_signals_plugin/plugin.cfg
@@ -0,0 +1,7 @@
+[plugin]
+
+name="Hello Signals plugin"
+description="Showcases how to package a sample Android plugin"
+author="Fredia Huya-Kouadio"
+version=""
+script="hello_signals_plugin.gd"
diff --git a/hello_signals/demo/default_env.tres b/hello_signals/demo/default_env.tres
index 20207a4..529d705 100644
--- a/hello_signals/demo/default_env.tres
+++ b/hello_signals/demo/default_env.tres
@@ -1,7 +1,7 @@
-[gd_resource type="Environment" load_steps=2 format=2]
+[gd_resource type="Environment" load_steps=2 format=3 uid="uid://gucbhj6rar4r"]
-[sub_resource type="ProceduralSky" id=1]
+[sub_resource type="Sky" id="1"]
[resource]
background_mode = 2
-background_sky = SubResource( 1 )
+sky = SubResource("1")
diff --git a/hello_signals/demo/export_presets.cfg b/hello_signals/demo/export_presets.cfg
index 76c50f1..fda6651 100644
--- a/hello_signals/demo/export_presets.cfg
+++ b/hello_signals/demo/export_presets.cfg
@@ -3,56 +3,56 @@
name="Android"
platform="Android"
runnable=true
+dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path=""
-patch_list=PoolStringArray( )
-script_export_mode=1
-script_encryption_key=""
+encryption_include_filters=""
+encryption_exclude_filters=""
+encrypt_pck=false
+encrypt_directory=false
[preset.0.options]
-graphics/32_bits_framebuffer=true
-xr_features/xr_mode=0
-xr_features/degrees_of_freedom=0
-xr_features/hand_tracking=0
-one_click_deploy/clear_previous_install=false
custom_template/debug=""
custom_template/release=""
-custom_template/use_custom_build=true
-custom_template/plugins="HelloSignals"
-command_line/extra_args=""
+gradle_build/use_gradle_build=true
+gradle_build/export_format=0
+gradle_build/min_sdk=""
+gradle_build/target_sdk=""
+architectures/armeabi-v7a=true
+architectures/arm64-v8a=true
+architectures/x86=false
+architectures/x86_64=false
version/code=1
version/name="1.0"
package/unique_name="fhuyakou.godot.plugin.android.hellosignals.demo"
package/name=""
package/signed=true
+package/app_category=2
+package/retain_data_on_uninstall=false
+package/exclude_from_recents=false
+launcher_icons/main_192x192=""
+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/orientation=0
screen/support_small=true
screen/support_normal=true
screen/support_large=true
screen/support_xlarge=true
-screen/opengl_debug=false
-launcher_icons/main_192x192=""
-launcher_icons/adaptive_foreground_432x432=""
-launcher_icons/adaptive_background_432x432=""
-keystore/debug=""
-keystore/debug_user=""
-keystore/debug_password=""
-keystore/release=""
-keystore/release_user=""
-keystore/release_password=""
+user_data_backup/allow=false
+command_line/extra_args=""
apk_expansion/enable=false
apk_expansion/SALT=""
apk_expansion/public_key=""
-architectures/armeabi-v7a=true
-architectures/arm64-v8a=true
-architectures/x86=false
-architectures/x86_64=false
-permissions/custom_permissions=PoolStringArray( )
+permissions/custom_permissions=PackedStringArray()
permissions/access_checkin_properties=false
permissions/access_coarse_location=false
permissions/access_fine_location=false
@@ -125,6 +125,7 @@ permissions/location_hardware=false
permissions/manage_accounts=false
permissions/manage_app_tokens=false
permissions/manage_documents=false
+permissions/manage_external_storage=false
permissions/master_clear=false
permissions/media_content_control=false
permissions/modify_audio_settings=false
diff --git a/hello_signals/demo/project.godot b/hello_signals/demo/project.godot
index b0283f4..d71c32c 100644
--- a/hello_signals/demo/project.godot
+++ b/hello_signals/demo/project.godot
@@ -6,22 +6,27 @@
; [section] ; section goes between []
; param=value ; assign values to parameters
-config_version=4
-
-_global_script_classes=[ ]
-_global_script_class_icons={
-
-}
+config_version=5
[application]
config/name="Hello Signals Plugin Demo"
run/main_scene="res://Main.tscn"
+config/features=PackedStringArray("4.1")
config/icon="res://icon.png"
+[debug]
+
+settings/stdout/verbose_stdout=true
+
+[editor_plugins]
+
+enabled=PackedStringArray("res://addons/hello_signals_plugin/plugin.cfg")
+
[rendering]
+renderer/rendering_method="gl_compatibility"
+textures/vram_compression/import_etc2_astc=true
+environment/defaults/default_environment="res://default_env.tres"
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
-vram_compression/import_etc2=false
-environment/default_environment="res://default_env.tres"
diff --git a/hello_signals/src/main/java/fhuyakou/godot/plugin/android/hellosignals/HelloSignalsPlugin.kt b/hello_signals/src/main/java/fhuyakou/godot/plugin/android/hellosignals/HelloSignalsPlugin.kt
index 9f6eb87..d6df7ef 100644
--- a/hello_signals/src/main/java/fhuyakou/godot/plugin/android/hellosignals/HelloSignalsPlugin.kt
+++ b/hello_signals/src/main/java/fhuyakou/godot/plugin/android/hellosignals/HelloSignalsPlugin.kt
@@ -4,6 +4,7 @@ import android.util.Log
import org.godotengine.godot.Godot
import org.godotengine.godot.plugin.GodotPlugin
import org.godotengine.godot.plugin.SignalInfo
+import org.godotengine.godot.plugin.UsedByGodot
import java.util.concurrent.Executors
import java.util.concurrent.ScheduledFuture
import java.util.concurrent.TimeUnit
@@ -28,8 +29,6 @@ class HelloSignalsPlugin(godot: Godot) : GodotPlugin(godot) {
return setOf(tikTokSignalInfo)
}
- override fun getPluginMethods() = listOf("onButtonPressed")
-
private fun startTikTok(): Boolean {
if (tikTokTask == null || tikTokTask!!.isDone) {
Log.i(TAG, "Starting tiktok...")
@@ -50,10 +49,11 @@ class HelloSignalsPlugin(godot: Godot) : GodotPlugin(godot) {
}
}
+ @UsedByGodot
private fun onButtonPressed() {
Log.i(TAG, "OnButtonPressed from Kotlin")
if (!startTikTok()) {
stopTikTok()
}
}
-} \ No newline at end of file
+}
diff --git a/hello_world/build.gradle b/hello_world/build.gradle
index 71da365..003ea6f 100644
--- a/hello_world/build.gradle
+++ b/hello_world/build.gradle
@@ -1,12 +1,14 @@
-apply plugin: 'com.android.library'
+plugins {
+ id 'com.android.library'
+ id 'org.jetbrains.kotlin.android'
+}
android {
- compileSdkVersion 29
- buildToolsVersion "29.0.1"
+ compileSdk versions.compileSdk
defaultConfig {
- minSdkVersion 18
- targetSdkVersion 29
+ minSdk versions.minSdk
+ targetSdk versions.targetSdk
versionCode 1
versionName "1.0"
}
@@ -21,14 +23,21 @@ android {
}
dependencies {
- /*
- Used to provide dependency on the Godot Android library. A version of that
- library will be made available for each stable release of Godot.
-
- `compileOnly` is used instead of `implementation` to ensure that the
- godot library is not bundled with the generated plugin AAR file. This is
- necessary since the Godot editor will also provide a version of the godot
- library when building the final binary.
- */
- compileOnly fileTree(dir: '../libs', include: ['godot-lib*.aar'])
+ compileOnly "org.godotengine:godot:$versions.godotLibVersion"
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$versions.kotlinVersion"
+}
+
+task copyDebugAARToAddons(type: Copy) {
+ from 'build/outputs/aar'
+ include 'HelloWorld.debug.aar'
+ into 'demo/addons/hello_world_plugin'
}
+
+task copyReleaseAARToAddons(type: Copy) {
+ from 'build/outputs/aar'
+ include 'HelloWorld.release.aar'
+ into 'demo/addons/hello_world_plugin'
+}
+
+assemble.finalizedBy(copyDebugAARToAddons)
+assemble.finalizedBy(copyReleaseAARToAddons)
diff --git a/hello_world/demo/Main.tscn b/hello_world/demo/Main.tscn
index bcb42ad..57d3eb0 100644
--- a/hello_world/demo/Main.tscn
+++ b/hello_world/demo/Main.tscn
@@ -1,20 +1,19 @@
-[gd_scene load_steps=2 format=2]
+[gd_scene load_steps=2 format=3 uid="uid://bgtr75kiyu5fh"]
-[ext_resource path="res://Main.gd" type="Script" id=1]
+[ext_resource type="Script" path="res://Main.gd" id="1"]
[node name="Main" type="Node2D"]
-script = ExtResource( 1 )
+script = ExtResource("1")
[node name="Button" type="Button" parent="."]
+anchors_preset = 14
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
-margin_left = 40.0
-margin_top = 250.0
-margin_right = 320.0
-margin_bottom = 312.0
+offset_left = 40.0
+offset_top = 250.0
+offset_right = 320.0
+offset_bottom = 312.0
text = "Hello World"
-__meta__ = {
-"_edit_use_anchors_": true
-}
+
[connection signal="pressed" from="Button" to="." method="_on_Button_pressed"]
diff --git a/hello_world/demo/addons/hello_world_plugin/.gdignore b/hello_world/demo/addons/hello_world_plugin/.gdignore
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/hello_world/demo/addons/hello_world_plugin/.gdignore
@@ -0,0 +1 @@
+
diff --git a/hello_world/demo/addons/hello_world_plugin/HelloWorld.debug.aar b/hello_world/demo/addons/hello_world_plugin/HelloWorld.debug.aar
new file mode 100644
index 0000000..ddb9986
--- /dev/null
+++ b/hello_world/demo/addons/hello_world_plugin/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/HelloWorld.release.aar
new file mode 100644
index 0000000..8277aa5
--- /dev/null
+++ b/hello_world/demo/addons/hello_world_plugin/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/hello_world_export_plugin.gd
new file mode 100644
index 0000000..6749497
--- /dev/null
+++ b/hello_world/demo/addons/hello_world_plugin/hello_world_export_plugin.gd
@@ -0,0 +1,16 @@
+@tool
+extends EditorExportPlugin
+
+func _supports_platform(platform):
+ if platform is EditorExportPlatformAndroid:
+ return true
+ return false
+
+func _get_android_libraries(platform, debug):
+ if debug:
+ return PackedStringArray(["hello_world_plugin/HelloWorld.debug.aar"])
+ else:
+ return PackedStringArray(["hello_world_plugin/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/hello_world_plugin.gd
new file mode 100644
index 0000000..05bb37a
--- /dev/null
+++ b/hello_world/demo/addons/hello_world_plugin/hello_world_plugin.gd
@@ -0,0 +1,17 @@
+@tool
+extends EditorPlugin
+
+# A class member to hold the export plugin during its lifecycle.
+var export_plugin : EditorExportPlugin
+
+func _enter_tree():
+ # Initialization of the plugin goes here.
+ export_plugin = preload("hello_world_export_plugin.gd").new()
+ add_export_plugin(export_plugin)
+ pass
+
+
+func _exit_tree():
+ # Clean-up of the plugin goes here.
+ remove_export_plugin(export_plugin)
+ export_plugin = null
diff --git a/hello_world/demo/addons/hello_world_plugin/plugin.cfg b/hello_world/demo/addons/hello_world_plugin/plugin.cfg
new file mode 100644
index 0000000..0024e5f
--- /dev/null
+++ b/hello_world/demo/addons/hello_world_plugin/plugin.cfg
@@ -0,0 +1,7 @@
+[plugin]
+
+name="HelloWorldPlugin"
+description="Sample to showcase how to package a Godot Android plugin "
+author="Fredia Huya-Kouadio (m4gr3d)"
+version=""
+script="hello_world_plugin.gd"
diff --git a/hello_world/demo/default_env.tres b/hello_world/demo/default_env.tres
index 20207a4..3868def 100644
--- a/hello_world/demo/default_env.tres
+++ b/hello_world/demo/default_env.tres
@@ -1,7 +1,7 @@
-[gd_resource type="Environment" load_steps=2 format=2]
+[gd_resource type="Environment" load_steps=2 format=3 uid="uid://bi2meuxrf37pv"]
-[sub_resource type="ProceduralSky" id=1]
+[sub_resource type="Sky" id="1"]
[resource]
background_mode = 2
-background_sky = SubResource( 1 )
+sky = SubResource("1")
diff --git a/hello_world/demo/export_presets.cfg b/hello_world/demo/export_presets.cfg
index 45a64ca..3892c84 100644
--- a/hello_world/demo/export_presets.cfg
+++ b/hello_world/demo/export_presets.cfg
@@ -3,56 +3,56 @@
name="Android"
platform="Android"
runnable=true
+dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
-export_path=""
-patch_list=PoolStringArray( )
-script_export_mode=1
-script_encryption_key=""
+export_path="android/Hello World Plugin Demo.apk"
+encryption_include_filters=""
+encryption_exclude_filters=""
+encrypt_pck=false
+encrypt_directory=false
[preset.0.options]
-graphics/32_bits_framebuffer=true
-xr_features/xr_mode=0
-xr_features/degrees_of_freedom=0
-xr_features/hand_tracking=0
-one_click_deploy/clear_previous_install=false
custom_template/debug=""
custom_template/release=""
-custom_template/use_custom_build=true
-custom_template/plugins="HelloWorld"
-command_line/extra_args=""
+gradle_build/use_gradle_build=true
+gradle_build/export_format=0
+gradle_build/min_sdk=""
+gradle_build/target_sdk=""
+architectures/armeabi-v7a=true
+architectures/arm64-v8a=true
+architectures/x86=false
+architectures/x86_64=false
version/code=1
version/name="1.0"
package/unique_name="fhuyakou.godot.plugin.android.helloworld.demo"
package/name=""
package/signed=true
+package/app_category=2
+package/retain_data_on_uninstall=false
+package/exclude_from_recents=false
+launcher_icons/main_192x192=""
+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/orientation=0
screen/support_small=true
screen/support_normal=true
screen/support_large=true
screen/support_xlarge=true
-screen/opengl_debug=false
-launcher_icons/main_192x192=""
-launcher_icons/adaptive_foreground_432x432=""
-launcher_icons/adaptive_background_432x432=""
-keystore/debug=""
-keystore/debug_user=""
-keystore/debug_password=""
-keystore/release=""
-keystore/release_user=""
-keystore/release_password=""
+user_data_backup/allow=false
+command_line/extra_args=""
apk_expansion/enable=false
apk_expansion/SALT=""
apk_expansion/public_key=""
-architectures/armeabi-v7a=true
-architectures/arm64-v8a=true
-architectures/x86=false
-architectures/x86_64=false
-permissions/custom_permissions=PoolStringArray( )
+permissions/custom_permissions=PackedStringArray()
permissions/access_checkin_properties=false
permissions/access_coarse_location=false
permissions/access_fine_location=false
@@ -125,6 +125,7 @@ permissions/location_hardware=false
permissions/manage_accounts=false
permissions/manage_app_tokens=false
permissions/manage_documents=false
+permissions/manage_external_storage=false
permissions/master_clear=false
permissions/media_content_control=false
permissions/modify_audio_settings=false
diff --git a/hello_world/demo/project.godot b/hello_world/demo/project.godot
index b0f5fb8..a9cf847 100644
--- a/hello_world/demo/project.godot
+++ b/hello_world/demo/project.godot
@@ -6,22 +6,27 @@
; [section] ; section goes between []
; param=value ; assign values to parameters
-config_version=4
-
-_global_script_classes=[ ]
-_global_script_class_icons={
-
-}
+config_version=5
[application]
config/name="Hello World Plugin Demo"
run/main_scene="res://Main.tscn"
+config/features=PackedStringArray("4.1")
config/icon="res://icon.png"
+[debug]
+
+settings/stdout/verbose_stdout=true
+
+[editor_plugins]
+
+enabled=PackedStringArray("res://addons/hello_world_plugin/plugin.cfg")
+
[rendering]
+renderer/rendering_method="gl_compatibility"
+textures/vram_compression/import_etc2_astc=true
+environment/defaults/default_environment="res://default_env.tres"
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
-vram_compression/import_etc2=false
-environment/default_environment="res://default_env.tres"
diff --git a/hello_world/src/main/java/fhuyakou/godot/plugin/android/helloworld/HelloWorldPlugin.java b/hello_world/src/main/java/fhuyakou/godot/plugin/android/helloworld/HelloWorldPlugin.java
index fe0a319..1dfa1b2 100644
--- a/hello_world/src/main/java/fhuyakou/godot/plugin/android/helloworld/HelloWorldPlugin.java
+++ b/hello_world/src/main/java/fhuyakou/godot/plugin/android/helloworld/HelloWorldPlugin.java
@@ -2,10 +2,9 @@ package fhuyakou.godot.plugin.android.helloworld;
import android.app.Activity;
import android.view.View;
-import java.util.Collections;
-import java.util.List;
import org.godotengine.godot.Godot;
import org.godotengine.godot.plugin.GodotPlugin;
+import org.godotengine.godot.plugin.UsedByGodot;
public class HelloWorldPlugin extends GodotPlugin {
@@ -23,12 +22,7 @@ public class HelloWorldPlugin extends GodotPlugin {
}
@Override
- public List<String> getPluginMethods() {
- return Collections.singletonList("helloWorld");
- }
-
- @Override
- public View onMainCreateView(Activity activity) {
+ public View onMainCreate(Activity activity) {
View view = activity.getLayoutInflater().inflate(R.layout.hello_world_view, null);
helloWorldContainer = view.findViewById(R.id.hello_world_container);
return view;
@@ -37,16 +31,14 @@ public class HelloWorldPlugin extends GodotPlugin {
/**
* Show/hide, print and return "Hello World".
*/
+ @UsedByGodot
public String helloWorld() {
if (helloWorldContainer != null) {
- helloWorldContainer.post(new Runnable() {
- @Override
- public void run() {
- if (helloWorldContainer.getVisibility() == View.VISIBLE) {
- helloWorldContainer.setVisibility(View.GONE);
- } else {
- helloWorldContainer.setVisibility(View.VISIBLE);
- }
+ helloWorldContainer.post(() -> {
+ if (helloWorldContainer.getVisibility() == View.VISIBLE) {
+ helloWorldContainer.setVisibility(View.GONE);
+ } else {
+ helloWorldContainer.setVisibility(View.VISIBLE);
}
});
}
diff --git a/libs/godot-lib.release.aar b/libs/godot-lib.release.aar
deleted file mode 100644
index 63102ec..0000000
--- a/libs/godot-lib.release.aar
+++ /dev/null
Binary files differ
diff --git a/settings.gradle b/settings.gradle
index 153a4a9..ed12156 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,4 +1,18 @@
-rootProject.name='Godot Android Plugins'
+pluginManagement {
+ apply from: 'config.gradle'
-include ':hello_world'
-include ':hello_signals'
+ repositories {
+ gradlePluginPortal()
+ google()
+ }
+}
+
+dependencyResolutionManagement {
+ repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
+ repositories {
+ google()
+ mavenCentral()
+ }
+}
+rootProject.name = "Godot Android Plugins"
+include ':hello_world', ':hello_signals'