summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfhuya <fhuya@google.com>2020-02-23 13:43:08 -0500
committerfhuya <fhuya@google.com>2020-02-23 13:43:08 -0500
commit84aa6bbbe4f13072181c0437103d2430f8ea6551 (patch)
treebe18caa4ff1c51d1aee35c04ab4c4a1193af48b7
parent259ae7a9fdcfad643412eedec84e0be883debec0 (diff)
downloadgodot-android-samples-84aa6bbbe4f13072181c0437103d2430f8ea6551.tar.gz
godot-android-samples-84aa6bbbe4f13072181c0437103d2430f8ea6551.tar.bz2
godot-android-samples-84aa6bbbe4f13072181c0437103d2430f8ea6551.zip
Add sample hello world plugin and demo project.
-rw-r--r--hello_world/.gitignore14
-rw-r--r--hello_world/build.gradle29
-rw-r--r--hello_world/demo/Main.gd12
-rw-r--r--hello_world/demo/Main.tscn20
-rw-r--r--hello_world/demo/default_env.tres7
-rw-r--r--hello_world/demo/export_presets.cfg200
-rw-r--r--hello_world/demo/icon.pngbin0 -> 7370 bytes
-rw-r--r--hello_world/demo/project.godot27
-rw-r--r--hello_world/gradle.properties15
-rw-r--r--hello_world/gradle/wrapper/gradle-wrapper.jarbin0 -> 54329 bytes
-rw-r--r--hello_world/gradle/wrapper/gradle-wrapper.properties6
-rwxr-xr-xhello_world/gradlew172
-rw-r--r--hello_world/gradlew.bat84
-rw-r--r--hello_world/plugin/.gitignore1
-rw-r--r--hello_world/plugin/build.gradle34
-rw-r--r--hello_world/plugin/libs/godot-lib.release.aarbin0 -> 9139166 bytes
-rw-r--r--hello_world/plugin/src/main/AndroidManifest.xml20
-rw-r--r--hello_world/plugin/src/main/java/fhuyakou/godot/plugin/android/helloworld/HelloWorldPlugin.java57
-rw-r--r--hello_world/plugin/src/main/res/layout/hello_world_view.xml16
-rw-r--r--hello_world/plugin/src/main/res/values/strings.xml4
-rw-r--r--hello_world/settings.gradle2
21 files changed, 720 insertions, 0 deletions
diff --git a/hello_world/.gitignore b/hello_world/.gitignore
new file mode 100644
index 0000000..603b140
--- /dev/null
+++ b/hello_world/.gitignore
@@ -0,0 +1,14 @@
+*.iml
+.gradle
+/local.properties
+/.idea/caches
+/.idea/libraries
+/.idea/modules.xml
+/.idea/workspace.xml
+/.idea/navEditor.xml
+/.idea/assetWizardSettings.xml
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
diff --git a/hello_world/build.gradle b/hello_world/build.gradle
new file mode 100644
index 0000000..f084cc9
--- /dev/null
+++ b/hello_world/build.gradle
@@ -0,0 +1,29 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+
+ repositories {
+ google()
+ jcenter()
+
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:3.5.3'
+
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ google()
+ jcenter()
+
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/hello_world/demo/Main.gd b/hello_world/demo/Main.gd
new file mode 100644
index 0000000..11b332b
--- /dev/null
+++ b/hello_world/demo/Main.gd
@@ -0,0 +1,12 @@
+extends Node2D
+
+var hello_world
+
+func _ready():
+ if Engine.has_singleton("HelloWorld"):
+ hello_world = Engine.get_singleton("HelloWorld")
+
+
+func _on_Button_pressed():
+ if hello_world:
+ hello_world.helloWorld()
diff --git a/hello_world/demo/Main.tscn b/hello_world/demo/Main.tscn
new file mode 100644
index 0000000..bcb42ad
--- /dev/null
+++ b/hello_world/demo/Main.tscn
@@ -0,0 +1,20 @@
+[gd_scene load_steps=2 format=2]
+
+[ext_resource path="res://Main.gd" type="Script" id=1]
+
+[node name="Main" type="Node2D"]
+script = ExtResource( 1 )
+
+[node name="Button" type="Button" parent="."]
+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
+text = "Hello World"
+__meta__ = {
+"_edit_use_anchors_": true
+}
+[connection signal="pressed" from="Button" to="." method="_on_Button_pressed"]
diff --git a/hello_world/demo/default_env.tres b/hello_world/demo/default_env.tres
new file mode 100644
index 0000000..20207a4
--- /dev/null
+++ b/hello_world/demo/default_env.tres
@@ -0,0 +1,7 @@
+[gd_resource type="Environment" load_steps=2 format=2]
+
+[sub_resource type="ProceduralSky" id=1]
+
+[resource]
+background_mode = 2
+background_sky = SubResource( 1 )
diff --git a/hello_world/demo/export_presets.cfg b/hello_world/demo/export_presets.cfg
new file mode 100644
index 0000000..dd2a8eb
--- /dev/null
+++ b/hello_world/demo/export_presets.cfg
@@ -0,0 +1,200 @@
+[preset.0]
+
+name="Android"
+platform="Android"
+runnable=true
+custom_features=""
+export_filter="all_resources"
+include_filter=""
+exclude_filter=""
+export_path=""
+patch_list=PoolStringArray( )
+script_export_mode=1
+script_encryption_key=""
+
+[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/v2_plugins="HelloWorld"
+command_line/extra_args=""
+version/code=1
+version/name="1.0"
+package/unique_name="fhuyakou.godot.plugin.android.helloworld.demo"
+package/name=""
+package/signed=true
+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=""
+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/access_checkin_properties=false
+permissions/access_coarse_location=false
+permissions/access_fine_location=false
+permissions/access_location_extra_commands=false
+permissions/access_mock_location=false
+permissions/access_network_state=false
+permissions/access_surface_flinger=false
+permissions/access_wifi_state=false
+permissions/account_manager=false
+permissions/add_voicemail=false
+permissions/authenticate_accounts=false
+permissions/battery_stats=false
+permissions/bind_accessibility_service=false
+permissions/bind_appwidget=false
+permissions/bind_device_admin=false
+permissions/bind_input_method=false
+permissions/bind_nfc_service=false
+permissions/bind_notification_listener_service=false
+permissions/bind_print_service=false
+permissions/bind_remoteviews=false
+permissions/bind_text_service=false
+permissions/bind_vpn_service=false
+permissions/bind_wallpaper=false
+permissions/bluetooth=false
+permissions/bluetooth_admin=false
+permissions/bluetooth_privileged=false
+permissions/brick=false
+permissions/broadcast_package_removed=false
+permissions/broadcast_sms=false
+permissions/broadcast_sticky=false
+permissions/broadcast_wap_push=false
+permissions/call_phone=false
+permissions/call_privileged=false
+permissions/camera=false
+permissions/capture_audio_output=false
+permissions/capture_secure_video_output=false
+permissions/capture_video_output=false
+permissions/change_component_enabled_state=false
+permissions/change_configuration=false
+permissions/change_network_state=false
+permissions/change_wifi_multicast_state=false
+permissions/change_wifi_state=false
+permissions/clear_app_cache=false
+permissions/clear_app_user_data=false
+permissions/control_location_updates=false
+permissions/delete_cache_files=false
+permissions/delete_packages=false
+permissions/device_power=false
+permissions/diagnostic=false
+permissions/disable_keyguard=false
+permissions/dump=false
+permissions/expand_status_bar=false
+permissions/factory_test=false
+permissions/flashlight=false
+permissions/force_back=false
+permissions/get_accounts=false
+permissions/get_package_size=false
+permissions/get_tasks=false
+permissions/get_top_activity_info=false
+permissions/global_search=false
+permissions/hardware_test=false
+permissions/inject_events=false
+permissions/install_location_provider=false
+permissions/install_packages=false
+permissions/install_shortcut=false
+permissions/internal_system_window=false
+permissions/internet=false
+permissions/kill_background_processes=false
+permissions/location_hardware=false
+permissions/manage_accounts=false
+permissions/manage_app_tokens=false
+permissions/manage_documents=false
+permissions/master_clear=false
+permissions/media_content_control=false
+permissions/modify_audio_settings=false
+permissions/modify_phone_state=false
+permissions/mount_format_filesystems=false
+permissions/mount_unmount_filesystems=false
+permissions/nfc=false
+permissions/persistent_activity=false
+permissions/process_outgoing_calls=false
+permissions/read_calendar=false
+permissions/read_call_log=false
+permissions/read_contacts=false
+permissions/read_external_storage=false
+permissions/read_frame_buffer=false
+permissions/read_history_bookmarks=false
+permissions/read_input_state=false
+permissions/read_logs=false
+permissions/read_phone_state=false
+permissions/read_profile=false
+permissions/read_sms=false
+permissions/read_social_stream=false
+permissions/read_sync_settings=false
+permissions/read_sync_stats=false
+permissions/read_user_dictionary=false
+permissions/reboot=false
+permissions/receive_boot_completed=false
+permissions/receive_mms=false
+permissions/receive_sms=false
+permissions/receive_wap_push=false
+permissions/record_audio=false
+permissions/reorder_tasks=false
+permissions/restart_packages=false
+permissions/send_respond_via_message=false
+permissions/send_sms=false
+permissions/set_activity_watcher=false
+permissions/set_alarm=false
+permissions/set_always_finish=false
+permissions/set_animation_scale=false
+permissions/set_debug_app=false
+permissions/set_orientation=false
+permissions/set_pointer_speed=false
+permissions/set_preferred_applications=false
+permissions/set_process_limit=false
+permissions/set_time=false
+permissions/set_time_zone=false
+permissions/set_wallpaper=false
+permissions/set_wallpaper_hints=false
+permissions/signal_persistent_processes=false
+permissions/status_bar=false
+permissions/subscribed_feeds_read=false
+permissions/subscribed_feeds_write=false
+permissions/system_alert_window=false
+permissions/transmit_ir=false
+permissions/uninstall_shortcut=false
+permissions/update_device_stats=false
+permissions/use_credentials=false
+permissions/use_sip=false
+permissions/vibrate=false
+permissions/wake_lock=false
+permissions/write_apn_settings=false
+permissions/write_calendar=false
+permissions/write_call_log=false
+permissions/write_contacts=false
+permissions/write_external_storage=false
+permissions/write_gservices=false
+permissions/write_history_bookmarks=false
+permissions/write_profile=false
+permissions/write_secure_settings=false
+permissions/write_settings=false
+permissions/write_sms=false
+permissions/write_social_stream=false
+permissions/write_sync_settings=false
+permissions/write_user_dictionary=false
diff --git a/hello_world/demo/icon.png b/hello_world/demo/icon.png
new file mode 100644
index 0000000..5f7f827
--- /dev/null
+++ b/hello_world/demo/icon.png
Binary files differ
diff --git a/hello_world/demo/project.godot b/hello_world/demo/project.godot
new file mode 100644
index 0000000..b0f5fb8
--- /dev/null
+++ b/hello_world/demo/project.godot
@@ -0,0 +1,27 @@
+; Engine configuration file.
+; It's best edited using the editor UI and not directly,
+; since the parameters that go here are not all obvious.
+;
+; Format:
+; [section] ; section goes between []
+; param=value ; assign values to parameters
+
+config_version=4
+
+_global_script_classes=[ ]
+_global_script_class_icons={
+
+}
+
+[application]
+
+config/name="Hello World Plugin Demo"
+run/main_scene="res://Main.tscn"
+config/icon="res://icon.png"
+
+[rendering]
+
+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/gradle.properties b/hello_world/gradle.properties
new file mode 100644
index 0000000..82618ce
--- /dev/null
+++ b/hello_world/gradle.properties
@@ -0,0 +1,15 @@
+# Project-wide Gradle settings.
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx1536m
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
+
+
diff --git a/hello_world/gradle/wrapper/gradle-wrapper.jar b/hello_world/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..f6b961f
--- /dev/null
+++ b/hello_world/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/hello_world/gradle/wrapper/gradle-wrapper.properties b/hello_world/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..3a02130
--- /dev/null
+++ b/hello_world/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Sun Feb 23 11:49:45 EST 2020
+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
diff --git a/hello_world/gradlew b/hello_world/gradlew
new file mode 100755
index 0000000..cccdd3d
--- /dev/null
+++ b/hello_world/gradlew
@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+ cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"
diff --git a/hello_world/gradlew.bat b/hello_world/gradlew.bat
new file mode 100644
index 0000000..f955316
--- /dev/null
+++ b/hello_world/gradlew.bat
@@ -0,0 +1,84 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/hello_world/plugin/.gitignore b/hello_world/plugin/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/hello_world/plugin/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/hello_world/plugin/build.gradle b/hello_world/plugin/build.gradle
new file mode 100644
index 0000000..2d1e7fa
--- /dev/null
+++ b/hello_world/plugin/build.gradle
@@ -0,0 +1,34 @@
+apply plugin: 'com.android.library'
+
+android {
+ compileSdkVersion 29
+ buildToolsVersion "29.0.1"
+
+ defaultConfig {
+ minSdkVersion 18
+ targetSdkVersion 29
+ versionCode 1
+ versionName "1.0"
+ }
+
+ // Used to customize the name of generated AAR file.
+ libraryVariants.all { variant ->
+ variant.outputs.all { output ->
+ output.outputFileName = "HelloWorld.${variant.name}.aar"
+ }
+ }
+
+}
+
+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'])
+}
diff --git a/hello_world/plugin/libs/godot-lib.release.aar b/hello_world/plugin/libs/godot-lib.release.aar
new file mode 100644
index 0000000..ee116a4
--- /dev/null
+++ b/hello_world/plugin/libs/godot-lib.release.aar
Binary files differ
diff --git a/hello_world/plugin/src/main/AndroidManifest.xml b/hello_world/plugin/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..63ec50f
--- /dev/null
+++ b/hello_world/plugin/src/main/AndroidManifest.xml
@@ -0,0 +1,20 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="fhuyakou.godot.plugin.android.helloworld">
+
+ <application>
+ <!--
+ Plugin metadata:
+
+ - In the `android:name` attribute, the `org.godotengine.plugin.v2` prefix
+ is required so Godot can recognize the project as a valid Godot
+ Android plugin. The plugin name following the prefix should match the value
+ of the plugin name returned by the plugin initializer.
+
+ - The `android:value` attribute should be the classpath to the plugin
+ initializer.
+ -->
+ <meta-data
+ android:name="org.godotengine.plugin.v2.HelloWorld"
+ android:value="fhuyakou.godot.plugin.android.helloworld.HelloWorldPlugin" />
+ </application>
+</manifest>
diff --git a/hello_world/plugin/src/main/java/fhuyakou/godot/plugin/android/helloworld/HelloWorldPlugin.java b/hello_world/plugin/src/main/java/fhuyakou/godot/plugin/android/helloworld/HelloWorldPlugin.java
new file mode 100644
index 0000000..fe0a319
--- /dev/null
+++ b/hello_world/plugin/src/main/java/fhuyakou/godot/plugin/android/helloworld/HelloWorldPlugin.java
@@ -0,0 +1,57 @@
+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;
+
+public class HelloWorldPlugin extends GodotPlugin {
+
+ private static final String HELLO_WORLD = "Hello World";
+
+ private View helloWorldContainer;
+
+ public HelloWorldPlugin(Godot godot) {
+ super(godot);
+ }
+
+ @Override
+ public String getPluginName() {
+ return "HelloWorld";
+ }
+
+ @Override
+ public List<String> getPluginMethods() {
+ return Collections.singletonList("helloWorld");
+ }
+
+ @Override
+ public View onMainCreateView(Activity activity) {
+ View view = activity.getLayoutInflater().inflate(R.layout.hello_world_view, null);
+ helloWorldContainer = view.findViewById(R.id.hello_world_container);
+ return view;
+ }
+
+ /**
+ * Show/hide, print and return "Hello World".
+ */
+ 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);
+ }
+ }
+ });
+ }
+
+ System.out.println(HELLO_WORLD);
+ return HELLO_WORLD;
+ }
+}
diff --git a/hello_world/plugin/src/main/res/layout/hello_world_view.xml b/hello_world/plugin/src/main/res/layout/hello_world_view.xml
new file mode 100644
index 0000000..e831d87
--- /dev/null
+++ b/hello_world/plugin/src/main/res/layout/hello_world_view.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/hello_world_container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:visibility="gone">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:padding="10dp"
+ android:text="@string/hello_world"
+ android:textSize="20sp" />
+
+</FrameLayout> \ No newline at end of file
diff --git a/hello_world/plugin/src/main/res/values/strings.xml b/hello_world/plugin/src/main/res/values/strings.xml
new file mode 100644
index 0000000..d2cf3ac
--- /dev/null
+++ b/hello_world/plugin/src/main/res/values/strings.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="hello_world">Hello World</string>
+</resources> \ No newline at end of file
diff --git a/hello_world/settings.gradle b/hello_world/settings.gradle
new file mode 100644
index 0000000..475b38d
--- /dev/null
+++ b/hello_world/settings.gradle
@@ -0,0 +1,2 @@
+rootProject.name='HelloWorldPlugin'
+include ':plugin'