diff options
author | Fredia Huya-Kouadio <fhuya@meta.com> | 2023-07-14 13:46:24 -0700 |
---|---|---|
committer | Fredia Huya-Kouadio <fhuya@meta.com> | 2023-07-14 13:46:24 -0700 |
commit | b4844e98619766232645d70f80a29c2a53bc2709 (patch) | |
tree | 500a6deee2dfbd36f4356d69a2d5cb762314b03f /plugins/hello_signals/demo | |
parent | 1d19d5912d1ac5bfa3cf6cc30f086aee8f0464f2 (diff) | |
download | godot-android-samples-b4844e98619766232645d70f80a29c2a53bc2709.tar.gz godot-android-samples-b4844e98619766232645d70f80a29c2a53bc2709.tar.bz2 godot-android-samples-b4844e98619766232645d70f80a29c2a53bc2709.zip |
Update the directory structure to make room for additional Godot Android samples besides plugins
Diffstat (limited to 'plugins/hello_signals/demo')
14 files changed, 364 insertions, 0 deletions
diff --git a/plugins/hello_signals/demo/.gitignore b/plugins/hello_signals/demo/.gitignore new file mode 100644 index 0000000..b405634 --- /dev/null +++ b/plugins/hello_signals/demo/.gitignore @@ -0,0 +1,2 @@ +*.import +/android/ diff --git a/plugins/hello_signals/demo/Main.gd b/plugins/hello_signals/demo/Main.gd new file mode 100644 index 0000000..2dca0db --- /dev/null +++ b/plugins/hello_signals/demo/Main.gd @@ -0,0 +1,27 @@ +extends Node2D + +var timerCount = 0 +var timerRunning = false +var helloSignalsPlugin : HelloSignalsPlugin + +func _ready(): + helloSignalsPlugin = preload("res://addons/hello_signals_plugin/interface/hello_signals_plugin.gd").new() + helloSignalsPlugin.registerForTikTok(Callable(self, "_on_tiktok")) + + $Button.connect("pressed", Callable(self, "_on_Button_pressed")) + + +func _on_tiktok(): + print("TikTok signal received") + timerCount = timerCount + 1 + $Label.text = str(timerCount) + + +func _on_Button_pressed(): + print("on button pressed from GDScript") + helloSignalsPlugin.toggleTikTok() + timerRunning = !timerRunning + if (timerRunning): + $Button.text = "Stop Timer" + else: + $Button.text = "Start Timer" diff --git a/plugins/hello_signals/demo/Main.tscn b/plugins/hello_signals/demo/Main.tscn new file mode 100644 index 0000000..2f51657 --- /dev/null +++ b/plugins/hello_signals/demo/Main.tscn @@ -0,0 +1,26 @@ +[gd_scene load_steps=3 format=3 uid="uid://bdybkbximkyj2"] + +[ext_resource type="Script" path="res://Main.gd" id="1"] + +[sub_resource type="StyleBoxEmpty" id="1"] + +[node name="Main" type="Node2D"] +script = ExtResource("1") + +[node name="Button" type="Button" parent="."] +offset_left = 90.0 +offset_top = 178.0 +offset_right = 281.0 +offset_bottom = 261.0 +scale = Vector2(2, 2) +text = "Start Timer" + +[node name="Label" type="Label" parent="."] +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" +uppercase = true diff --git a/plugins/hello_signals/demo/addons/hello_signals_plugin/export/.gdignore b/plugins/hello_signals/demo/addons/hello_signals_plugin/export/.gdignore new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/plugins/hello_signals/demo/addons/hello_signals_plugin/export/.gdignore @@ -0,0 +1 @@ + diff --git a/plugins/hello_signals/demo/addons/hello_signals_plugin/export/HelloSignals.debug.aar b/plugins/hello_signals/demo/addons/hello_signals_plugin/export/HelloSignals.debug.aar Binary files differnew file mode 100644 index 0000000..d241ab1 --- /dev/null +++ b/plugins/hello_signals/demo/addons/hello_signals_plugin/export/HelloSignals.debug.aar diff --git a/plugins/hello_signals/demo/addons/hello_signals_plugin/export/HelloSignals.release.aar b/plugins/hello_signals/demo/addons/hello_signals_plugin/export/HelloSignals.release.aar Binary files differnew file mode 100644 index 0000000..6dae345 --- /dev/null +++ b/plugins/hello_signals/demo/addons/hello_signals_plugin/export/HelloSignals.release.aar diff --git a/plugins/hello_signals/demo/addons/hello_signals_plugin/export/hello_signals_editor_export_plugin.gd b/plugins/hello_signals/demo/addons/hello_signals_plugin/export/hello_signals_editor_export_plugin.gd new file mode 100644 index 0000000..f0f3288 --- /dev/null +++ b/plugins/hello_signals/demo/addons/hello_signals_plugin/export/hello_signals_editor_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/export/HelloSignals.debug.aar"]) + else: + return PackedStringArray(["hello_signals_plugin/export/HelloSignals.release.aar"]) + +func _get_name(): + return "Hello Signals plugin" diff --git a/plugins/hello_signals/demo/addons/hello_signals_plugin/export/hello_signals_editor_plugin.gd b/plugins/hello_signals/demo/addons/hello_signals_plugin/export/hello_signals_editor_plugin.gd new file mode 100644 index 0000000..5c71083 --- /dev/null +++ b/plugins/hello_signals/demo/addons/hello_signals_plugin/export/hello_signals_editor_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_editor_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/plugins/hello_signals/demo/addons/hello_signals_plugin/interface/hello_signals_plugin.gd b/plugins/hello_signals/demo/addons/hello_signals_plugin/interface/hello_signals_plugin.gd new file mode 100644 index 0000000..0cc9c1d --- /dev/null +++ b/plugins/hello_signals/demo/addons/hello_signals_plugin/interface/hello_signals_plugin.gd @@ -0,0 +1,27 @@ +class_name HelloSignalsPlugin extends Object + +## Interface used to access the functionality provided by the HelloSignals plugin + +var _hello_signals_singleton + +func _init(): + if Engine.has_singleton("HelloSignals"): + _hello_signals_singleton = Engine.get_singleton("HelloSignals") + else: + printerr("Couldn't find HelloSignals singleton") + + +## Register for the tiktok signals emitted +func registerForTikTok(callback: Callable) -> void: + if _hello_signals_singleton: + _hello_signals_singleton.connect("TikTok", callback) + else: + printerr("Unable to register for tiktok") + + +## Start tiktok if not started, otherwise stop it +func toggleTikTok(): + if _hello_signals_singleton: + _hello_signals_singleton.onButtonPressed() + else: + printerr("Unable to toggle tiktok") diff --git a/plugins/hello_signals/demo/addons/hello_signals_plugin/plugin.cfg b/plugins/hello_signals/demo/addons/hello_signals_plugin/plugin.cfg new file mode 100644 index 0000000..b32555f --- /dev/null +++ b/plugins/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="export/hello_signals_editor_plugin.gd" diff --git a/plugins/hello_signals/demo/default_env.tres b/plugins/hello_signals/demo/default_env.tres new file mode 100644 index 0000000..529d705 --- /dev/null +++ b/plugins/hello_signals/demo/default_env.tres @@ -0,0 +1,7 @@ +[gd_resource type="Environment" load_steps=2 format=3 uid="uid://gucbhj6rar4r"] + +[sub_resource type="Sky" id="1"] + +[resource] +background_mode = 2 +sky = SubResource("1") diff --git a/plugins/hello_signals/demo/export_presets.cfg b/plugins/hello_signals/demo/export_presets.cfg new file mode 100644 index 0000000..1d4cb1f --- /dev/null +++ b/plugins/hello_signals/demo/export_presets.cfg @@ -0,0 +1,201 @@ +[preset.0] + +name="Android" +platform="Android" +runnable=true +dedicated_server=false +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="android/Hello Signals Plugin Demo.apk" +encryption_include_filters="" +encryption_exclude_filters="" +encrypt_pck=false +encrypt_directory=false + +[preset.0.options] + +custom_template/debug="" +custom_template/release="" +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 +screen/immersive_mode=true +screen/support_small=true +screen/support_normal=true +screen/support_large=true +screen/support_xlarge=true +user_data_backup/allow=false +command_line/extra_args="" +apk_expansion/enable=false +apk_expansion/SALT="" +apk_expansion/public_key="" +permissions/custom_permissions=PackedStringArray() +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/manage_external_storage=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 +xr_features/hand_tracking=0 +xr_features/hand_tracking_frequency=0 +xr_features/passthrough=0 diff --git a/plugins/hello_signals/demo/icon.png b/plugins/hello_signals/demo/icon.png Binary files differnew file mode 100644 index 0000000..c98fbb6 --- /dev/null +++ b/plugins/hello_signals/demo/icon.png diff --git a/plugins/hello_signals/demo/project.godot b/plugins/hello_signals/demo/project.godot new file mode 100644 index 0000000..655eefc --- /dev/null +++ b/plugins/hello_signals/demo/project.godot @@ -0,0 +1,33 @@ +; 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=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" +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" +vram_compression/import_etc=true |