diff options
Diffstat (limited to 'platform/android')
22 files changed, 139 insertions, 67 deletions
diff --git a/platform/android/SCsub b/platform/android/SCsub index 31fee5722c..807506000f 100644 --- a/platform/android/SCsub +++ b/platform/android/SCsub @@ -1,12 +1,12 @@ #!/usr/bin/env python +Import('env') + import shutil from compat import open_utf8 from distutils.version import LooseVersion from detect import get_ndk_version -Import('env') - android_files = [ 'os_android.cpp', @@ -26,10 +26,6 @@ android_files = [ # 'power_android.cpp' ] -# env.Depends('#core/math/vector3.h', 'vector3_psp.h') - -#obj = env.SharedObject('godot_android.cpp') - env_android = env.Clone() if env['target'] == "profile": env_android.Append(CPPFLAGS=['-DPROFILER_ENABLED']) @@ -174,4 +170,4 @@ if lib_arch_dir != '': ndk_version = get_ndk_version(env["ANDROID_NDK_ROOT"]) if ndk_version != None and LooseVersion(ndk_version) >= LooseVersion("15.0.4075724"): stl_lib_path = str(env['ANDROID_NDK_ROOT']) + '/sources/cxx-stl/llvm-libc++/libs/' + lib_arch_dir + '/libc++_shared.so' - env_android.Command(out_dir + '/libc++_shared.so', stl_lib_path, Copy("$TARGET", "$SOURCE"))
\ No newline at end of file + env_android.Command(out_dir + '/libc++_shared.so', stl_lib_path, Copy("$TARGET", "$SOURCE")) diff --git a/platform/android/audio_driver_jandroid.cpp b/platform/android/audio_driver_jandroid.cpp index 46bd691290..4fab40d534 100644 --- a/platform/android/audio_driver_jandroid.cpp +++ b/platform/android/audio_driver_jandroid.cpp @@ -30,8 +30,8 @@ #include "audio_driver_jandroid.h" -#include "os/os.h" -#include "project_settings.h" +#include "core/os/os.h" +#include "core/project_settings.h" #include "thread_jandroid.h" #ifndef ANDROID_NATIVE_ACTIVITY diff --git a/platform/android/audio_driver_opensl.h b/platform/android/audio_driver_opensl.h index 88cb122414..8e879b27c5 100644 --- a/platform/android/audio_driver_opensl.h +++ b/platform/android/audio_driver_opensl.h @@ -31,7 +31,7 @@ #ifndef AUDIO_DRIVER_OPENSL_H #define AUDIO_DRIVER_OPENSL_H -#include "os/mutex.h" +#include "core/os/mutex.h" #include "servers/audio_server.h" #include <SLES/OpenSLES.h> diff --git a/platform/android/detect.py b/platform/android/detect.py index b22e85b2c1..953a2fa6d2 100644 --- a/platform/android/detect.py +++ b/platform/android/detect.py @@ -258,9 +258,10 @@ def configure(env): if ndk_version != None and LooseVersion(ndk_version) >= LooseVersion("15.0.4075724"): if LooseVersion(ndk_version) >= LooseVersion("17.1.4828580"): env.Append(LINKFLAGS=['-Wl,--exclude-libs,libgcc.a','-Wl,--exclude-libs,libatomic.a','-nostdlib++']) + else: + env.Append(LINKFLAGS=[env["ANDROID_NDK_ROOT"] +"/sources/cxx-stl/llvm-libc++/libs/"+arch_subpath+"/libandroid_support.a"]) env.Append(LINKFLAGS=['-shared', '--sysroot=' + lib_sysroot, '-Wl,--warn-shared-textrel']) env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/llvm-libc++/libs/"+arch_subpath+"/"]) - env.Append(LINKFLAGS=[env["ANDROID_NDK_ROOT"] +"/sources/cxx-stl/llvm-libc++/libs/"+arch_subpath+"/libandroid_support.a"]) env.Append(LINKFLAGS=[env["ANDROID_NDK_ROOT"] +"/sources/cxx-stl/llvm-libc++/libs/"+arch_subpath+"/libc++_shared.so"]) else: env.Append(LINKFLAGS=['-shared', '--sysroot=' + lib_sysroot, '-Wl,--warn-shared-textrel']) diff --git a/platform/android/dir_access_android.h b/platform/android/dir_access_android.h index 085d7160cd..3ac0bd6332 100644 --- a/platform/android/dir_access_android.h +++ b/platform/android/dir_access_android.h @@ -33,7 +33,7 @@ #ifdef ANDROID_NATIVE_ACTIVITY -#include "os/dir_access.h" +#include "core/os/dir_access.h" #include <android/asset_manager.h> #include <android/log.h> #include <android_native_app_glue.h> diff --git a/platform/android/dir_access_jandroid.cpp b/platform/android/dir_access_jandroid.cpp index ee5ae156b7..6a95277585 100644 --- a/platform/android/dir_access_jandroid.cpp +++ b/platform/android/dir_access_jandroid.cpp @@ -31,8 +31,8 @@ #ifndef ANDROID_NATIVE_ACTIVITY #include "dir_access_jandroid.h" +#include "core/print_string.h" #include "file_access_jandroid.h" -#include "print_string.h" #include "thread_jandroid.h" jobject DirAccessJAndroid::io = NULL; diff --git a/platform/android/dir_access_jandroid.h b/platform/android/dir_access_jandroid.h index 8dc52ab9c8..1653fb0aa5 100644 --- a/platform/android/dir_access_jandroid.h +++ b/platform/android/dir_access_jandroid.h @@ -33,8 +33,8 @@ #ifndef ANDROID_NATIVE_ACTIVITY +#include "core/os/dir_access.h" #include "java_glue.h" -#include "os/dir_access.h" #include <stdio.h> class DirAccessJAndroid : public DirAccess { diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 5c8d9e078f..021a92ca1e 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -30,17 +30,17 @@ #include "export.h" +#include "core/io/marshalls.h" +#include "core/io/zip_io.h" +#include "core/os/file_access.h" +#include "core/os/os.h" +#include "core/project_settings.h" +#include "core/version.h" #include "editor/editor_export.h" #include "editor/editor_node.h" #include "editor/editor_settings.h" -#include "io/marshalls.h" -#include "io/zip_io.h" -#include "os/file_access.h" -#include "os/os.h" #include "platform/android/logo.gen.h" #include "platform/android/run_icon.gen.h" -#include "project_settings.h" -#include "version.h" #include <string.h> @@ -194,8 +194,8 @@ static const char *android_perms[] = { }; struct LauncherIcon { - char *option_id; - char *export_path; + const char *option_id; + const char *export_path; }; static const LauncherIcon launcher_icons[] = { @@ -344,6 +344,7 @@ class EditorExportAndroid : public EditorExportPlatform { } d.name = vendor + " " + device; + if (device == String()) continue; } ndevices.push_back(d); @@ -576,11 +577,11 @@ class EditorExportAndroid : public EditorExportPlatform { uint32_t ofs = 8; uint32_t string_count = 0; - uint32_t styles_count = 0; + //uint32_t styles_count = 0; uint32_t string_flags = 0; uint32_t string_data_offset = 0; - uint32_t styles_offset = 0; + //uint32_t styles_offset = 0; uint32_t string_table_begins = 0; uint32_t string_table_ends = 0; Vector<uint8_t> stable_extra; @@ -630,16 +631,16 @@ class EditorExportAndroid : public EditorExportPlatform { int iofs = ofs + 8; string_count = decode_uint32(&p_manifest[iofs]); - styles_count = decode_uint32(&p_manifest[iofs + 4]); + //styles_count = decode_uint32(&p_manifest[iofs + 4]); string_flags = decode_uint32(&p_manifest[iofs + 8]); string_data_offset = decode_uint32(&p_manifest[iofs + 12]); - styles_offset = decode_uint32(&p_manifest[iofs + 16]); + //styles_offset = decode_uint32(&p_manifest[iofs + 16]); /* printf("string count: %i\n",string_count); printf("flags: %i\n",string_flags); printf("sdata ofs: %i\n",string_data_offset); printf("styles ofs: %i\n",styles_offset); - */ + */ uint32_t st_offset = iofs + 20; string_table.resize(string_count); uint32_t string_end = 0; @@ -759,7 +760,6 @@ class EditorExportAndroid : public EditorExportPlatform { // save manifest ending so we can restore it Vector<uint8_t> manifest_end; uint32_t manifest_cur_size = p_manifest.size(); - uint32_t node_size = size; manifest_end.resize(p_manifest.size() - ofs); memcpy(manifest_end.ptrw(), &p_manifest[ofs], manifest_end.size()); @@ -1054,7 +1054,12 @@ public: if (api == 0) r_features->push_back("etc"); else*/ - r_features->push_back("etc2"); + String driver = ProjectSettings::get_singleton()->get("rendering/quality/driver/driver_name"); + if (driver == "GLES2") { + r_features->push_back("etc"); + } else { + r_features->push_back("etc2"); + } Vector<String> abis = get_enabled_abis(p_preset); for (int i = 0; i < abis.size(); ++i) { @@ -1081,7 +1086,7 @@ public: r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "screen/support_large"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "screen/support_xlarge"), true)); - for (int i = 0; i < sizeof(launcher_icons) / sizeof(launcher_icons[0]); ++i) { + for (unsigned int i = 0; i < sizeof(launcher_icons) / sizeof(launcher_icons[0]); ++i) { r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, launcher_icons[i].option_id, PROPERTY_HINT_FILE, "*.png"), "")); } @@ -1337,7 +1342,7 @@ public: if (!FileAccess::exists(adb)) { valid = false; - err += "ADB executable not configured in editor settings.\n"; + err += "ADB executable not configured in the Editor Settings.\n"; } String js = EditorSettings::get_singleton()->get("export/android/jarsigner"); @@ -1345,7 +1350,7 @@ public: if (!FileAccess::exists(js)) { valid = false; - err += "OpenJDK 6 jarsigner not configured in editor settings.\n"; + err += "OpenJDK 8 jarsigner not configured in the Editor Settings.\n"; } String dk = EditorSettings::get_singleton()->get("export/android/debug_keystore"); @@ -1353,7 +1358,7 @@ public: if (!FileAccess::exists(dk)) { valid = false; - err += "Debug Keystore not configured in editor settings.\n"; + err += "Debug keystore not configured in the Editor Settings.\n"; } bool apk_expansion = p_preset->get("apk_expansion/enable"); @@ -1372,7 +1377,7 @@ public: if (apk_expansion_pkey == "") { valid = false; - err += "Invalid public key for apk expansion.\n"; + err += "Invalid public key for APK expansion.\n"; } } @@ -1485,7 +1490,7 @@ public: if (file == "res/drawable/icon.png") { bool found = false; - for (int i = 0; i < sizeof(launcher_icons) / sizeof(launcher_icons[0]); ++i) { + for (unsigned int i = 0; i < sizeof(launcher_icons) / sizeof(launcher_icons[0]); ++i) { String icon_path = String(p_preset->get(launcher_icons[i].option_id)).strip_edges(); if (icon_path != "" && icon_path.ends_with(".png")) { FileAccess *f = FileAccess::open(icon_path, FileAccess::READ); @@ -1619,7 +1624,7 @@ public: APKExportData ed; ed.ep = &ep; ed.apk = unaligned_apk; - for (int i = 0; i < sizeof(launcher_icons) / sizeof(launcher_icons[0]); ++i) { + for (unsigned int i = 0; i < sizeof(launcher_icons) / sizeof(launcher_icons[0]); ++i) { String icon_path = String(p_preset->get(launcher_icons[i].option_id)).strip_edges(); if (icon_path != "" && icon_path.ends_with(".png") && FileAccess::exists(icon_path)) { Vector<uint8_t> data = FileAccess::get_file_as_array(icon_path); @@ -1680,7 +1685,7 @@ public: String jarsigner = EditorSettings::get_singleton()->get("export/android/jarsigner"); if (!FileAccess::exists(jarsigner)) { - EditorNode::add_io_error("'jarsigner' could not be found.\nPlease supply a path in the editor settings.\nResulting apk is unsigned."); + EditorNode::add_io_error("'jarsigner' could not be found.\nPlease supply a path in the Editor Settings.\nThe resulting APK is unsigned."); return OK; } @@ -1692,14 +1697,14 @@ public: password = EditorSettings::get_singleton()->get("export/android/debug_keystore_pass"); user = EditorSettings::get_singleton()->get("export/android/debug_keystore_user"); - ep.step("Signing Debug APK...", 103); + ep.step("Signing debug APK...", 103); } else { keystore = release_keystore; password = release_password; user = release_username; - ep.step("Signing Release APK...", 103); + ep.step("Signing release APK...", 103); } if (!FileAccess::exists(keystore)) { @@ -1742,7 +1747,7 @@ public: OS::get_singleton()->execute(jarsigner, args, true, NULL, NULL, &retval); if (retval) { - EditorNode::add_io_error("'jarsigner' verification of APK failed. Make sure to use jarsigner from Java 6."); + EditorNode::add_io_error("'jarsigner' verification of APK failed. Make sure to use a jarsigner from OpenJDK 8."); return ERR_CANT_CREATE; } } diff --git a/platform/android/file_access_android.cpp b/platform/android/file_access_android.cpp index c2eed50e4c..4c7436a5dc 100644 --- a/platform/android/file_access_android.cpp +++ b/platform/android/file_access_android.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "file_access_android.h" -#include "print_string.h" +#include "core/print_string.h" AAssetManager *FileAccessAndroid::asset_manager = NULL; diff --git a/platform/android/file_access_android.h b/platform/android/file_access_android.h index 03f4c59521..1ee8697fa4 100644 --- a/platform/android/file_access_android.h +++ b/platform/android/file_access_android.h @@ -31,7 +31,7 @@ #ifndef FILE_ACCESS_ANDROID_H #define FILE_ACCESS_ANDROID_H -#include "os/file_access.h" +#include "core/os/file_access.h" #include <android/asset_manager.h> #include <android/log.h> #include <stdio.h> diff --git a/platform/android/file_access_jandroid.cpp b/platform/android/file_access_jandroid.cpp index 214e273d9b..573200bcf9 100644 --- a/platform/android/file_access_jandroid.cpp +++ b/platform/android/file_access_jandroid.cpp @@ -31,7 +31,7 @@ #ifndef ANDROID_NATIVE_ACTIVITY #include "file_access_jandroid.h" -#include "os/os.h" +#include "core/os/os.h" #include "thread_jandroid.h" #include <unistd.h> diff --git a/platform/android/file_access_jandroid.h b/platform/android/file_access_jandroid.h index 72f81ee02e..39c201ba85 100644 --- a/platform/android/file_access_jandroid.h +++ b/platform/android/file_access_jandroid.h @@ -33,8 +33,8 @@ #ifndef ANDROID_NATIVE_ACTIVITY +#include "core/os/file_access.h" #include "java_glue.h" -#include "os/file_access.h" class FileAccessJAndroid : public FileAccess { static jobject io; diff --git a/platform/android/globals/global_defaults.cpp b/platform/android/globals/global_defaults.cpp index a315f80452..efeb8598e5 100644 --- a/platform/android/globals/global_defaults.cpp +++ b/platform/android/globals/global_defaults.cpp @@ -29,7 +29,7 @@ /*************************************************************************/ #include "global_defaults.h" -#include "project_settings.h" +#include "core/project_settings.h" void register_android_global_defaults() { } diff --git a/platform/android/godot_android.cpp b/platform/android/godot_android.cpp index 061e05f5ee..54692dc831 100644 --- a/platform/android/godot_android.cpp +++ b/platform/android/godot_android.cpp @@ -30,11 +30,11 @@ #ifdef ANDROID_NATIVE_ACTIVITY -#include "engine.h" +#include "core/engine.h" +#include "core/project_settings.h" #include "file_access_android.h" #include "main/main.h" #include "os_android.h" -#include "project_settings.h" #include <EGL/egl.h> #include <android/log.h> diff --git a/platform/android/java/src/org/godotengine/godot/Godot.java b/platform/android/java/src/org/godotengine/godot/Godot.java index ef798fc790..c23037f3e0 100644 --- a/platform/android/java/src/org/godotengine/godot/Godot.java +++ b/platform/android/java/src/org/godotengine/godot/Godot.java @@ -59,6 +59,9 @@ import android.content.pm.PackageManager.NameNotFoundException; import android.net.Uri; import android.media.MediaPlayer; +import android.content.ClipboardManager; +import android.content.ClipData; + import java.lang.reflect.Method; import java.util.List; import java.util.ArrayList; @@ -103,6 +106,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC private TextView mAverageSpeed; private TextView mTimeRemaining; private ProgressBar mPB; + private ClipboardManager mClipboard; private View mDashboard; private View mCellMessage; @@ -180,6 +184,9 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC protected void onMainActivityResult(int requestCode, int resultCode, Intent data) { } + protected void onMainRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { + } + protected void onMainPause() {} protected void onMainResume() {} protected void onMainDestroy() {} @@ -247,6 +254,13 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC } }; + @Override + public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { + for (int i = 0; i < singleton_count; i++) { + singletons[i].onMainRequestPermissionsResult(requestCode, permissions, grantResults); + } + }; + public void onVideoInit() { boolean use_gl3 = getGLESVersionCode() >= 0x00030000; @@ -441,6 +455,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC Window window = getWindow(); //window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); + mClipboard = (ClipboardManager)getSystemService(Context.CLIPBOARD_SERVICE); //check for apk expansion API if (true) { @@ -607,6 +622,24 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC } } + public String getClipboard() { + + String copiedText = ""; + + if (mClipboard.getPrimaryClip() != null) { + ClipData.Item item = mClipboard.getPrimaryClip().getItemAt(0); + copiedText = item.getText().toString(); + } + + return copiedText; + } + + public void setClipboard(String p_text) { + + ClipData clip = ClipData.newPlainText("myLabel", p_text); + mClipboard.setPrimaryClip(clip); + } + @Override protected void onResume() { super.onResume(); diff --git a/platform/android/java_class_wrapper.h b/platform/android/java_class_wrapper.h index 648c147ca8..ea3760452f 100644 --- a/platform/android/java_class_wrapper.h +++ b/platform/android/java_class_wrapper.h @@ -31,7 +31,7 @@ #ifndef JAVA_CLASS_WRAPPER_H #define JAVA_CLASS_WRAPPER_H -#include "reference.h" +#include "core/reference.h" #include <android/log.h> #include <jni.h> diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp index 8bb1c38345..6cf49758bc 100644 --- a/platform/android/java_glue.cpp +++ b/platform/android/java_glue.cpp @@ -33,16 +33,16 @@ #include "java_glue.h" #include "android/asset_manager_jni.h" #include "audio_driver_jandroid.h" +#include "core/engine.h" #include "core/os/keyboard.h" +#include "core/project_settings.h" #include "dir_access_jandroid.h" -#include "engine.h" #include "file_access_android.h" #include "file_access_jandroid.h" #include "java_class_wrapper.h" #include "main/input_default.h" #include "main/main.h" #include "os_android.h" -#include "project_settings.h" #include "thread_jandroid.h" #include <unistd.h> @@ -607,6 +607,8 @@ static jobject _godot_instance; static jmethodID _openURI = 0; static jmethodID _getDataDir = 0; static jmethodID _getLocale = 0; +static jmethodID _getClipboard = 0; +static jmethodID _setClipboard = 0; static jmethodID _getModel = 0; static jmethodID _getScreenDPI = 0; static jmethodID _showKeyboard = 0; @@ -646,6 +648,19 @@ static String _get_locale() { return String(env->GetStringUTFChars(s, NULL)); } +static String _get_clipboard() { + JNIEnv *env = ThreadAndroid::get_env(); + jstring s = (jstring)env->CallObjectMethod(_godot_instance, _getClipboard); + return String(env->GetStringUTFChars(s, NULL)); +} + +static void _set_clipboard(const String &p_text) { + + JNIEnv *env = ThreadAndroid::get_env(); + jstring jStr = env->NewStringUTF(p_text.utf8().get_data()); + env->CallVoidMethod(_godot_instance, _setClipboard, jStr); +} + static String _get_model() { JNIEnv *env = ThreadAndroid::get_env(); @@ -774,6 +789,8 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *en _setKeepScreenOn = env->GetMethodID(cls, "setKeepScreenOn", "(Z)V"); _alertDialog = env->GetMethodID(cls, "alert", "(Ljava/lang/String;Ljava/lang/String;)V"); _getGLESVersionCode = env->GetMethodID(cls, "getGLESVersionCode", "()I"); + _getClipboard = env->GetMethodID(cls, "getClipboard", "()Ljava/lang/String;"); + _setClipboard = env->GetMethodID(cls, "setClipboard", "(Ljava/lang/String;)V"); jclass clsio = env->FindClass("org/godotengine/godot/Godot"); if (cls) { @@ -807,7 +824,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv *en AudioDriverAndroid::setup(gob); } - os_android = new OS_Android(_gfx_init_func, env, _open_uri, _get_user_data_dir, _get_locale, _get_model, _get_screen_dpi, _show_vk, _hide_vk, _get_vk_height, _set_screen_orient, _get_unique_id, _get_system_dir, _get_gles_version_code, _play_video, _is_video_playing, _pause_video, _stop_video, _set_keep_screen_on, _alert, p_use_apk_expansion); + os_android = new OS_Android(_gfx_init_func, env, _open_uri, _get_user_data_dir, _get_locale, _get_model, _get_screen_dpi, _show_vk, _hide_vk, _get_vk_height, _set_screen_orient, _get_unique_id, _get_system_dir, _get_gles_version_code, _play_video, _is_video_playing, _pause_video, _stop_video, _set_keep_screen_on, _alert, _set_clipboard, _get_clipboard, p_use_apk_expansion); os_android->set_need_reload_hooks(p_need_reload_hook); char wd[500]; diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index 74c40bde72..484ca4fff8 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -257,13 +257,10 @@ int OS_Android::get_mouse_button_state() const { return 0; } + void OS_Android::set_window_title(const String &p_title) { } -//interesting byt not yet -//void set_clipboard(const String& p_text); -//String get_clipboard() const; - void OS_Android::set_video_mode(const VideoMode &p_video_mode, int p_screen) { } @@ -599,6 +596,23 @@ String OS_Android::get_locale() const { return OS_Unix::get_locale(); } +void OS_Android::set_clipboard(const String &p_text) { + + if (set_clipboard_func) { + set_clipboard_func(p_text); + } else { + OS_Unix::set_clipboard(p_text); + } +} + +String OS_Android::get_clipboard() const { + if (get_clipboard_func) { + return get_clipboard_func(); + } + + return OS_Unix::get_clipboard(); +} + String OS_Android::get_model_name() const { if (get_model_func) @@ -732,7 +746,7 @@ bool OS_Android::_check_internal_feature_support(const String &p_feature) { return false; } -OS_Android::OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetUserDataDirFunc p_get_user_data_dir_func, GetLocaleFunc p_get_locale_func, GetModelFunc p_get_model_func, GetScreenDPIFunc p_get_screen_dpi_func, ShowVirtualKeyboardFunc p_show_vk, HideVirtualKeyboardFunc p_hide_vk, VirtualKeyboardHeightFunc p_vk_height_func, SetScreenOrientationFunc p_screen_orient, GetUniqueIDFunc p_get_unique_id, GetSystemDirFunc p_get_sdir_func, GetGLVersionCodeFunc p_get_gl_version_func, VideoPlayFunc p_video_play_func, VideoIsPlayingFunc p_video_is_playing_func, VideoPauseFunc p_video_pause_func, VideoStopFunc p_video_stop_func, SetKeepScreenOnFunc p_set_keep_screen_on_func, AlertFunc p_alert_func, bool p_use_apk_expansion) { +OS_Android::OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetUserDataDirFunc p_get_user_data_dir_func, GetLocaleFunc p_get_locale_func, GetModelFunc p_get_model_func, GetScreenDPIFunc p_get_screen_dpi_func, ShowVirtualKeyboardFunc p_show_vk, HideVirtualKeyboardFunc p_hide_vk, VirtualKeyboardHeightFunc p_vk_height_func, SetScreenOrientationFunc p_screen_orient, GetUniqueIDFunc p_get_unique_id, GetSystemDirFunc p_get_sdir_func, GetGLVersionCodeFunc p_get_gl_version_func, VideoPlayFunc p_video_play_func, VideoIsPlayingFunc p_video_is_playing_func, VideoPauseFunc p_video_pause_func, VideoStopFunc p_video_stop_func, SetKeepScreenOnFunc p_set_keep_screen_on_func, AlertFunc p_alert_func, SetClipboardFunc p_set_clipboard_func, GetClipboardFunc p_get_clipboard_func, bool p_use_apk_expansion) { use_apk_expansion = p_use_apk_expansion; default_videomode.width = 800; @@ -765,6 +779,9 @@ OS_Android::OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURI hide_virtual_keyboard_func = p_hide_vk; get_virtual_keyboard_height_func = p_vk_height_func; + set_clipboard_func = p_set_clipboard_func; + get_clipboard_func = p_get_clipboard_func; + set_screen_orientation_func = p_screen_orient; set_keep_screen_on_func = p_set_keep_screen_on_func; alert_func = p_alert_func; diff --git a/platform/android/os_android.h b/platform/android/os_android.h index c4220906a3..9594c6fdf4 100644 --- a/platform/android/os_android.h +++ b/platform/android/os_android.h @@ -33,10 +33,10 @@ #include "audio_driver_jandroid.h" #include "audio_driver_opensl.h" +#include "core/os/input.h" +#include "core/os/main_loop.h" #include "drivers/unix/os_unix.h" #include "main/input_default.h" -#include "os/input.h" -#include "os/main_loop.h" //#include "power_android.h" #include "servers/audio_server.h" #include "servers/visual/rasterizer.h" @@ -51,6 +51,8 @@ typedef void (*GFXInitFunc)(void *ud, bool gl2); typedef int (*OpenURIFunc)(const String &); typedef String (*GetUserDataDirFunc)(); typedef String (*GetLocaleFunc)(); +typedef void (*SetClipboardFunc)(const String &); +typedef String (*GetClipboardFunc)(); typedef String (*GetModelFunc)(); typedef int (*GetScreenDPIFunc)(); typedef String (*GetUniqueIDFunc)(); @@ -119,6 +121,8 @@ private: OpenURIFunc open_uri_func; GetUserDataDirFunc get_user_data_dir_func; GetLocaleFunc get_locale_func; + SetClipboardFunc set_clipboard_func; + GetClipboardFunc get_clipboard_func; GetModelFunc get_model_func; GetScreenDPIFunc get_screen_dpi_func; ShowVirtualKeyboardFunc show_virtual_keyboard_func; @@ -140,7 +144,7 @@ private: int video_driver_index; public: - // functions used by main to initialize/deintialize the OS + // functions used by main to initialize/deinitialize the OS virtual int get_video_driver_count() const; virtual const char *get_video_driver_name(int p_driver) const; @@ -172,9 +176,6 @@ public: virtual int get_mouse_button_state() const; virtual void set_window_title(const String &p_title); - //virtual void set_clipboard(const String& p_text); - //virtual String get_clipboard() const; - virtual void set_video_mode(const VideoMode &p_video_mode, int p_screen = 0); virtual VideoMode get_video_mode(int p_screen = 0) const; virtual void get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen = 0) const; @@ -218,6 +219,8 @@ public: virtual String get_user_data_dir() const; virtual String get_resource_dir() const; virtual String get_locale() const; + virtual void set_clipboard(const String &p_text); + virtual String get_clipboard() const; virtual String get_model_name() const; virtual int get_screen_dpi(int p_screen = 0) const; @@ -244,7 +247,7 @@ public: void joy_connection_changed(int p_device, bool p_connected, String p_name); virtual bool _check_internal_feature_support(const String &p_feature); - OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetUserDataDirFunc p_get_user_data_dir_func, GetLocaleFunc p_get_locale_func, GetModelFunc p_get_model_func, GetScreenDPIFunc p_get_screen_dpi_func, ShowVirtualKeyboardFunc p_show_vk, HideVirtualKeyboardFunc p_hide_vk, VirtualKeyboardHeightFunc p_vk_height_func, SetScreenOrientationFunc p_screen_orient, GetUniqueIDFunc p_get_unique_id, GetSystemDirFunc p_get_sdir_func, GetGLVersionCodeFunc p_get_gl_version_func, VideoPlayFunc p_video_play_func, VideoIsPlayingFunc p_video_is_playing_func, VideoPauseFunc p_video_pause_func, VideoStopFunc p_video_stop_func, SetKeepScreenOnFunc p_set_keep_screen_on_func, AlertFunc p_alert_func, bool p_use_apk_expansion); + OS_Android(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetUserDataDirFunc p_get_user_data_dir_func, GetLocaleFunc p_get_locale_func, GetModelFunc p_get_model_func, GetScreenDPIFunc p_get_screen_dpi_func, ShowVirtualKeyboardFunc p_show_vk, HideVirtualKeyboardFunc p_hide_vk, VirtualKeyboardHeightFunc p_vk_height_func, SetScreenOrientationFunc p_screen_orient, GetUniqueIDFunc p_get_unique_id, GetSystemDirFunc p_get_sdir_func, GetGLVersionCodeFunc p_get_gl_version_func, VideoPlayFunc p_video_play_func, VideoIsPlayingFunc p_video_is_playing_func, VideoPauseFunc p_video_pause_func, VideoStopFunc p_video_stop_func, SetKeepScreenOnFunc p_set_keep_screen_on_func, AlertFunc p_alert_func, SetClipboardFunc p_set_clipboard, GetClipboardFunc p_get_clipboard, bool p_use_apk_expansion); ~OS_Android(); }; diff --git a/platform/android/power_android.h b/platform/android/power_android.h index f0d1bee1e2..c39764222e 100644 --- a/platform/android/power_android.h +++ b/platform/android/power_android.h @@ -31,7 +31,7 @@ #ifndef PLATFORM_ANDROID_POWER_ANDROID_H_ #define PLATFORM_ANDROID_POWER_ANDROID_H_ -#include "os/os.h" +#include "core/os/os.h" #include <android/native_window_jni.h> class power_android { diff --git a/platform/android/thread_jandroid.cpp b/platform/android/thread_jandroid.cpp index b13baf69c2..6795315e63 100644 --- a/platform/android/thread_jandroid.cpp +++ b/platform/android/thread_jandroid.cpp @@ -30,9 +30,9 @@ #include "thread_jandroid.h" +#include "core/os/memory.h" #include "core/safe_refcount.h" -#include "os/memory.h" -#include "script_language.h" +#include "core/script_language.h" static pthread_key_t _create_thread_id_key() { pthread_key_t key; diff --git a/platform/android/thread_jandroid.h b/platform/android/thread_jandroid.h index 2bb64f3db2..a57bc47e6d 100644 --- a/platform/android/thread_jandroid.h +++ b/platform/android/thread_jandroid.h @@ -35,7 +35,7 @@ @author Juan Linietsky <reduzio@gmail.com> */ -#include "os/thread.h" +#include "core/os/thread.h" #include <jni.h> #include <pthread.h> #include <sys/types.h> |