diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-01-02 19:12:25 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-01-02 19:12:25 -0300 |
commit | ce26eb74bca48f16e9a34b4eb1c34e50dfc5daae (patch) | |
tree | 5f9c387037d0142d40f7275575436483dc0a7237 /platform/android | |
parent | ab4126f51061277e87b41c48b40e7b54942d4eca (diff) | |
parent | 45c5c89de961357a7042d9e1f063e288d7a510cf (diff) |
Merge branch 'master' of https://github.com/godotengine/godot
Diffstat (limited to 'platform/android')
50 files changed, 418 insertions, 365 deletions
diff --git a/platform/android/SCsub b/platform/android/SCsub index 4f9a9709cb..146f7c25a3 100644 --- a/platform/android/SCsub +++ b/platform/android/SCsub @@ -6,127 +6,127 @@ Import('env') android_files = [ - 'os_android.cpp', - 'godot_android.cpp', - 'file_access_android.cpp', - 'dir_access_android.cpp', - 'audio_driver_opensl.cpp', - 'file_access_jandroid.cpp', - 'dir_access_jandroid.cpp', - 'thread_jandroid.cpp', - 'audio_driver_jandroid.cpp', - 'ifaddrs_android.cpp', - 'android_native_app_glue.c', - 'java_glue.cpp', - 'cpu-features.c', - 'java_class_wrapper.cpp' + 'os_android.cpp', + 'godot_android.cpp', + 'file_access_android.cpp', + 'dir_access_android.cpp', + 'audio_driver_opensl.cpp', + 'file_access_jandroid.cpp', + 'dir_access_jandroid.cpp', + 'thread_jandroid.cpp', + 'audio_driver_jandroid.cpp', + 'ifaddrs_android.cpp', + 'android_native_app_glue.c', + 'java_glue.cpp', + 'cpu-features.c', + 'java_class_wrapper.cpp' ] -#env.Depends('#core/math/vector3.h', 'vector3_psp.h') +# 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']) + env_android.Append(CPPFLAGS=['-DPROFILER_ENABLED']) -android_objects=[] +android_objects = [] for x in android_files: - android_objects.append( env_android.SharedObject( x ) ) + android_objects.append(env_android.SharedObject(x)) prog = None -abspath=env.Dir(".").abspath +abspath = env.Dir(".").abspath -gradle_basein = open(abspath+"/build.gradle.template","rb") -gradle_baseout = open(abspath+"/java/build.gradle","wb") +gradle_basein = open(abspath + "/build.gradle.template", "rb") +gradle_baseout = open(abspath + "/java/build.gradle", "wb") gradle_text = gradle_basein.read() -gradle_maven_repos_text="" +gradle_maven_repos_text = "" if len(env.android_maven_repos) > 0: - gradle_maven_repos_text+="maven {\n" - for x in env.android_maven_repos: - gradle_maven_repos_text+="\t\t"+x+"\n" - gradle_maven_repos_text+="\t}\n" + gradle_maven_repos_text += "maven {\n" + for x in env.android_maven_repos: + gradle_maven_repos_text += "\t\t" + x + "\n" + gradle_maven_repos_text += "\t}\n" -gradle_maven_dependencies_text="" +gradle_maven_dependencies_text = "" for x in env.android_dependencies: - gradle_maven_dependencies_text+=x+"\n" + gradle_maven_dependencies_text += x + "\n" -gradle_java_dirs_text="" +gradle_java_dirs_text = "" for x in env.android_java_dirs: - gradle_java_dirs_text+=",'"+x.replace("\\","/")+"'" + gradle_java_dirs_text += ",'" + x.replace("\\", "/") + "'" -gradle_res_dirs_text="" +gradle_res_dirs_text = "" for x in env.android_res_dirs: - gradle_res_dirs_text+=",'"+x.replace("\\","/")+"'" + gradle_res_dirs_text += ",'" + x.replace("\\", "/") + "'" -gradle_aidl_dirs_text="" +gradle_aidl_dirs_text = "" for x in env.android_aidl_dirs: - gradle_aidl_dirs_text+=",'"+x.replace("\\","/")+"'" + gradle_aidl_dirs_text += ",'" + x.replace("\\", "/") + "'" -gradle_jni_dirs_text="" +gradle_jni_dirs_text = "" for x in env.android_jni_dirs: - gradle_jni_dirs_text+=",'"+x.replace("\\","/")+"'" + gradle_jni_dirs_text += ",'" + x.replace("\\", "/") + "'" -gradle_asset_dirs_text="" +gradle_asset_dirs_text = "" -gradle_default_config_text="" +gradle_default_config_text = "" for x in env.android_default_config: - gradle_default_config_text+=x+"\n\t\t" + gradle_default_config_text += x + "\n\t\t" -gradle_text = gradle_text.replace("$$GRADLE_REPOSITORY_URLS$$",gradle_maven_repos_text) -gradle_text = gradle_text.replace("$$GRADLE_DEPENDENCIES$$",gradle_maven_dependencies_text) -gradle_text = gradle_text.replace("$$GRADLE_JAVA_DIRS$$",gradle_java_dirs_text) -gradle_text = gradle_text.replace("$$GRADLE_RES_DIRS$$",gradle_res_dirs_text) -gradle_text = gradle_text.replace("$$GRADLE_ASSET_DIRS$$",gradle_asset_dirs_text) -gradle_text = gradle_text.replace("$$GRADLE_AIDL_DIRS$$",gradle_aidl_dirs_text) -gradle_text = gradle_text.replace("$$GRADLE_JNI_DIRS$$",gradle_jni_dirs_text) -gradle_text = gradle_text.replace("$$GRADLE_DEFAULT_CONFIG$$",gradle_default_config_text) +gradle_text = gradle_text.replace("$$GRADLE_REPOSITORY_URLS$$", gradle_maven_repos_text) +gradle_text = gradle_text.replace("$$GRADLE_DEPENDENCIES$$", gradle_maven_dependencies_text) +gradle_text = gradle_text.replace("$$GRADLE_JAVA_DIRS$$", gradle_java_dirs_text) +gradle_text = gradle_text.replace("$$GRADLE_RES_DIRS$$", gradle_res_dirs_text) +gradle_text = gradle_text.replace("$$GRADLE_ASSET_DIRS$$", gradle_asset_dirs_text) +gradle_text = gradle_text.replace("$$GRADLE_AIDL_DIRS$$", gradle_aidl_dirs_text) +gradle_text = gradle_text.replace("$$GRADLE_JNI_DIRS$$", gradle_jni_dirs_text) +gradle_text = gradle_text.replace("$$GRADLE_DEFAULT_CONFIG$$", gradle_default_config_text) -gradle_baseout.write( gradle_text ) +gradle_baseout.write(gradle_text) gradle_baseout.close() -pp_basein = open(abspath+"/AndroidManifest.xml.template","rb") -pp_baseout = open(abspath+"/java/AndroidManifest.xml","wb") +pp_basein = open(abspath + "/AndroidManifest.xml.template", "rb") +pp_baseout = open(abspath + "/java/AndroidManifest.xml", "wb") manifest = pp_basein.read() -manifest = manifest.replace("$$ADD_APPLICATION_CHUNKS$$",env.android_manifest_chunk) -manifest = manifest.replace("$$ADD_PERMISSION_CHUNKS$$",env.android_permission_chunk) -manifest = manifest.replace("$$ADD_APPATTRIBUTE_CHUNKS$$",env.android_appattributes_chunk) -pp_baseout.write( manifest ) +manifest = manifest.replace("$$ADD_APPLICATION_CHUNKS$$", env.android_manifest_chunk) +manifest = manifest.replace("$$ADD_PERMISSION_CHUNKS$$", env.android_permission_chunk) +manifest = manifest.replace("$$ADD_APPATTRIBUTE_CHUNKS$$", env.android_appattributes_chunk) +pp_baseout.write(manifest) -env_android.SharedLibrary("#bin/libgodot",[android_objects],SHLIBSUFFIX=env["SHLIBSUFFIX"]) +env_android.SharedLibrary("#bin/libgodot", [android_objects], SHLIBSUFFIX=env["SHLIBSUFFIX"]) lib_arch_dir = '' if env['android_arch'] == 'armv6': - lib_arch_dir = 'armeabi' + lib_arch_dir = 'armeabi' elif env['android_arch'] == 'armv7': - lib_arch_dir = 'armeabi-v7a' + lib_arch_dir = 'armeabi-v7a' elif env['android_arch'] == 'x86': - lib_arch_dir = 'x86' + lib_arch_dir = 'x86' else: - print 'WARN: Architecture not suitable for embedding into APK; keeping .so at \\bin' + print 'WARN: Architecture not suitable for embedding into APK; keeping .so at \\bin' if lib_arch_dir != '': - if env['target'] == 'release': - lib_type_dir = 'release' - else: # release_debug, debug - lib_type_dir = 'debug' - - out_dir = '#platform/android/java/libs/'+lib_type_dir+'/'+lib_arch_dir - env_android.Command(out_dir+'/libgodot_android.so', '#bin/libgodot'+env['SHLIBSUFFIX'], Move("$TARGET", "$SOURCE")) + if env['target'] == 'release': + lib_type_dir = 'release' + else: # release_debug, debug + lib_type_dir = 'debug' + + out_dir = '#platform/android/java/libs/' + lib_type_dir + '/' + lib_arch_dir + env_android.Command(out_dir + '/libgodot_android.so', '#bin/libgodot' + env['SHLIBSUFFIX'], Move("$TARGET", "$SOURCE")) diff --git a/platform/android/audio_driver_jandroid.cpp b/platform/android/audio_driver_jandroid.cpp index 419ed977b5..8c57eaaab6 100644 --- a/platform/android/audio_driver_jandroid.cpp +++ b/platform/android/audio_driver_jandroid.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/audio_driver_jandroid.h b/platform/android/audio_driver_jandroid.h index f79057efe5..01ce31be8f 100644 --- a/platform/android/audio_driver_jandroid.h +++ b/platform/android/audio_driver_jandroid.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/audio_driver_opensl.cpp b/platform/android/audio_driver_opensl.cpp index b7ef1424e5..5e3cfcbbab 100644 --- a/platform/android/audio_driver_opensl.cpp +++ b/platform/android/audio_driver_opensl.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/audio_driver_opensl.h b/platform/android/audio_driver_opensl.h index 1b04f32fd2..8839d20bab 100644 --- a/platform/android/audio_driver_opensl.h +++ b/platform/android/audio_driver_opensl.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/detect.py b/platform/android/detect.py index 842036f986..d1073e0c7b 100644 --- a/platform/android/detect.py +++ b/platform/android/detect.py @@ -3,248 +3,263 @@ import sys import string import platform + def is_active(): - return True + return True + def get_name(): - return "Android" + return "Android" + def can_build(): - import os - if (not os.environ.has_key("ANDROID_NDK_ROOT")): - return False + import os + if (not os.environ.has_key("ANDROID_NDK_ROOT")): + return False + + return True - return True def get_opts(): - return [ - ('ANDROID_NDK_ROOT', 'the path to Android NDK', os.environ.get("ANDROID_NDK_ROOT", 0)), - ('NDK_TARGET', 'toolchain to use for the NDK',os.environ.get("NDK_TARGET", "arm-linux-androideabi-4.9")), - ('NDK_TARGET_X86', 'toolchain to use for the NDK x86',os.environ.get("NDK_TARGET_X86", "x86-4.9")), - ('ndk_platform', 'compile for platform: (android-<api> , example: android-14)',"android-14"), - ('android_arch', 'select compiler architecture: (armv7/armv6/x86)',"armv7"), - ('android_neon','enable neon (armv7 only)',"yes"), - ('android_stl','enable STL support in android port (for modules)',"no") - ] + return [ + ('ANDROID_NDK_ROOT', 'the path to Android NDK', + os.environ.get("ANDROID_NDK_ROOT", 0)), + ('ndk_platform', 'compile for platform: (android-<api> , example: android-14)', "android-14"), + ('android_arch', 'select compiler architecture: (armv7/armv6/x86)', "armv7"), + ('android_neon', 'enable neon (armv7 only)', "yes"), + ('android_stl', 'enable STL support in android port (for modules)', "no") + ] def get_flags(): - return [ - ('tools', 'no'), - ('openssl', 'builtin'), #use builtin openssl - ] + return [ + ('tools', 'no'), + ] def create(env): - tools = env['TOOLS'] - if "mingw" in tools: - tools.remove('mingw') - if "applelink" in tools: - tools.remove("applelink") - env.Tool('gcc') - return env.Clone(tools=tools); + tools = env['TOOLS'] + if "mingw" in tools: + tools.remove('mingw') + if "applelink" in tools: + tools.remove("applelink") + env.Tool('gcc') + return env.Clone(tools=tools) + def configure(env): - # Workaround for MinGW. See: - # http://www.scons.org/wiki/LongCmdLinesOnWin32 - import os - if (os.name=="nt"): - - import subprocess - - def mySubProcess(cmdline,env): - #print "SPAWNED : " + cmdline - startupinfo = subprocess.STARTUPINFO() - startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW - proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE, - stderr=subprocess.PIPE, startupinfo=startupinfo, shell = False, env = env) - data, err = proc.communicate() - rv = proc.wait() - if rv: - print "=====" - print err - print "=====" - return rv - - def mySpawn(sh, escape, cmd, args, env): - - newargs = ' '.join(args[1:]) - cmdline = cmd + " " + newargs - - rv=0 - if len(cmdline) > 32000 and cmd.endswith("ar") : - cmdline = cmd + " " + args[1] + " " + args[2] + " " - for i in range(3,len(args)) : - rv = mySubProcess( cmdline + args[i], env ) - if rv : - break - else: - rv = mySubProcess( cmdline, env ) - - return rv - - env['SPAWN'] = mySpawn - - ndk_platform=env['ndk_platform'] - - if env['android_arch'] not in ['armv7','armv6','x86']: - env['android_arch']='armv7' - - if env['android_arch']=='x86': - env['NDK_TARGET']=env['NDK_TARGET_X86'] - env["x86_libtheora_opt_gcc"]=True - - if env['PLATFORM'] == 'win32': - env.Tool('gcc') - env['SHLIBSUFFIX'] = '.so' - - - neon_text="" - if env["android_arch"]=="armv7" and env['android_neon']=='yes': - neon_text=" (with neon)" - print("Godot Android!!!!! ("+env['android_arch']+")"+neon_text) - - env.Append(CPPPATH=['#platform/android']) - - if env['android_arch']=='x86': - env.extra_suffix=".x86"+env.extra_suffix - elif env['android_arch']=='armv6': - env.extra_suffix=".armv6"+env.extra_suffix - elif env["android_arch"]=="armv7": - if env['android_neon']=='yes': - env.extra_suffix=".armv7.neon"+env.extra_suffix - else: - env.extra_suffix=".armv7"+env.extra_suffix - - gcc_path=env["ANDROID_NDK_ROOT"]+"/toolchains/"+env["NDK_TARGET"]+"/prebuilt/"; - - if (sys.platform.startswith("linux")): - if (platform.machine().endswith('64')): - gcc_path=gcc_path+"/linux-x86_64/bin" - else: - gcc_path=gcc_path+"/linux-x86/bin" - elif (sys.platform.startswith("darwin")): - gcc_path=gcc_path+"/darwin-x86_64/bin" - env['SHLINKFLAGS'][1] = '-shared' - env['SHLIBSUFFIX'] = '.so' - elif (sys.platform.startswith('win')): - if (platform.machine().endswith('64')): - gcc_path=gcc_path+"/windows-x86_64/bin" - else: - gcc_path=gcc_path+"/windows-x86/bin" - - env['ENV']['PATH'] = gcc_path+":"+env['ENV']['PATH'] - if env['android_arch']=='x86': - env['CC'] = gcc_path+'/i686-linux-android-gcc' - env['CXX'] = gcc_path+'/i686-linux-android-g++' - env['AR'] = gcc_path+"/i686-linux-android-ar" - env['RANLIB'] = gcc_path+"/i686-linux-android-ranlib" - env['AS'] = gcc_path+"/i686-linux-android-as" - else: - env['CC'] = gcc_path+'/arm-linux-androideabi-gcc' - env['CXX'] = gcc_path+'/arm-linux-androideabi-g++' - env['AR'] = gcc_path+"/arm-linux-androideabi-ar" - env['RANLIB'] = gcc_path+"/arm-linux-androideabi-ranlib" - env['AS'] = gcc_path+"/arm-linux-androideabi-as" - - if env['android_arch']=='x86': - env['ARCH'] = 'arch-x86' - else: - env['ARCH'] = 'arch-arm' - - import string - #include path - gcc_include=env["ANDROID_NDK_ROOT"]+"/platforms/"+ndk_platform+"/"+env['ARCH'] +"/usr/include" - ld_sysroot=env["ANDROID_NDK_ROOT"]+"/platforms/"+ndk_platform+"/"+env['ARCH'] - #glue_include=env["ANDROID_NDK_ROOT"]+"/sources/android/native_app_glue" - ld_path=env["ANDROID_NDK_ROOT"]+"/platforms/"+ndk_platform+"/"+env['ARCH']+"/usr/lib" - env.Append(CPPPATH=[gcc_include]) -# env['CCFLAGS'] = string.split('-DNO_THREADS -MMD -MP -MF -fpic -ffunction-sections -funwind-tables -fstack-protector -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -fno-exceptions -mthumb -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED ') - - env['neon_enabled']=False - if env['android_arch']=='x86': - env.Append(CCFLAGS=string.split('-DNO_STATVFS -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__GLIBC__ -Wno-psabi -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED')) - elif env["android_arch"]=="armv6": - env.Append(CCFLAGS=string.split('-DNO_STATVFS -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__ARM_ARCH_6__ -D__GLIBC__ -Wno-psabi -march=armv6 -mfpu=vfp -mfloat-abi=softfp -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED')) - elif env["android_arch"]=="armv7": - env.Append(CCFLAGS=string.split('-DNO_STATVFS -fpic -ffunction-sections -funwind-tables -fstack-protector -fvisibility=hidden -D__ARM_ARCH_7__ -D__ARM_ARCH_7A__ -D__GLIBC__ -Wno-psabi -march=armv7-a -mfloat-abi=softfp -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED')) - if env['android_neon']=='yes': - env['neon_enabled']=True - env.Append(CCFLAGS=['-mfpu=neon','-D__ARM_NEON__']) - else: - env.Append(CCFLAGS=['-mfpu=vfpv3-d16']) - - env.Append(LDPATH=[ld_path]) - env.Append(LIBS=['OpenSLES']) -# env.Append(LIBS=['c','m','stdc++','log','EGL','GLESv1_CM','GLESv2','OpenSLES','supc++','android']) - env.Append(LIBS=['EGL','OpenSLES','android']) - env.Append(LIBS=['c','m','stdc++','log','GLESv1_CM','GLESv2', 'z']) - - env["LINKFLAGS"]= string.split(" -g --sysroot="+ld_sysroot+" -Wl,--no-undefined -Wl,-z,noexecstack ") - env.Append(LINKFLAGS=["-Wl,-soname,libgodot_android.so"]) - - if (env["target"]=="release"): - - env.Append(CCFLAGS=['-O2', '-ffast-math','-fomit-frame-pointer']) - - elif (env["target"]=="release_debug"): - - env.Append(CCFLAGS=['-O2', '-ffast-math','-DDEBUG_ENABLED']) - - elif (env["target"]=="debug"): - - env.Append(CCFLAGS=['-D_DEBUG', '-g1', '-Wall', '-O0', '-DDEBUG_ENABLED']) - env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC']) - - env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED', '-DNO_FCNTL','-DMPC_FIXED_POINT']) -# env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED','-DMPC_FIXED_POINT']) - - # TODO: Move that to opus module's config - if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"): - if (env["android_arch"]=="armv6" or env["android_arch"]=="armv7"): - env.Append(CFLAGS=["-DOPUS_ARM_OPT"]) - env.opus_fixed_point="yes" - - if (env['android_stl']=='yes'): - #env.Append(CCFLAGS=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/system/include"]) - env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/include"]) - if env['android_arch']=='x86': - env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86/include"]) - env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86"]) - elif env['android_arch']=='armv6': - env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include"]) - env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi"]) - elif env["android_arch"]=="armv7": - env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include"]) - env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a"]) - - env.Append(LIBS=["gnustl_static","supc++"]) - env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cpufeatures"]) - - #env.Append(CCFLAGS=["-I"+env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/stlport/stlport"]) - #env.Append(CCFLAGS=["-I"+env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include"]) - #env.Append(LINKFLAGS=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/libs/armeabi/libstdc++.a"]) - else: - - env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/include"]) - env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cpufeatures"]) - if env['android_arch']=='x86': - env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86"]) - elif env["android_arch"]=="armv6": - env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi"]) - elif env["android_arch"]=="armv7": - env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a"]) - env.Append(LIBS=['gnustl_static']) - env.Append(CCFLAGS=["-fno-exceptions",'-DNO_SAFE_CAST']) - - - import methods - env.Append( BUILDERS = { 'GLSL120' : env.Builder(action = methods.build_legacygl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) - env.Append( BUILDERS = { 'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) - env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } ) - - env.use_windows_spawn_fix() + # Workaround for MinGW. See: + # http://www.scons.org/wiki/LongCmdLinesOnWin32 + import os + if (os.name == "nt"): + + import subprocess + + def mySubProcess(cmdline, env): + # print "SPAWNED : " + cmdline + startupinfo = subprocess.STARTUPINFO() + startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW + proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE, + stderr=subprocess.PIPE, startupinfo=startupinfo, shell=False, env=env) + data, err = proc.communicate() + rv = proc.wait() + if rv: + print "=====" + print err + print "=====" + return rv + + def mySpawn(sh, escape, cmd, args, env): + + newargs = ' '.join(args[1:]) + cmdline = cmd + " " + newargs + + rv = 0 + if len(cmdline) > 32000 and cmd.endswith("ar"): + cmdline = cmd + " " + args[1] + " " + args[2] + " " + for i in range(3, len(args)): + rv = mySubProcess(cmdline + args[i], env) + if rv: + break + else: + rv = mySubProcess(cmdline, env) + + return rv + + env['SPAWN'] = mySpawn + + ndk_platform = env['ndk_platform'] + + if env['android_arch'] not in ['armv7', 'armv6', 'x86']: + env['android_arch'] = 'armv7' + + if env['android_arch'] == 'x86': + env["x86_libtheora_opt_gcc"] = True + + if env['PLATFORM'] == 'win32': + env.Tool('gcc') + env['SHLIBSUFFIX'] = '.so' + + neon_text = "" + if env["android_arch"] == "armv7" and env['android_neon'] == 'yes': + neon_text = " (with neon)" + print("Godot Android!!!!! (" + env['android_arch'] + ")" + neon_text) + + env.Append(CPPPATH=['#platform/android']) + + if env['android_arch'] == 'x86': + env.extra_suffix = ".x86" + env.extra_suffix + target_subpath = "x86-4.9" + abi_subpath = "i686-linux-android" + arch_subpath = "x86" + elif env['android_arch'] == 'armv6': + env.extra_suffix = ".armv6" + env.extra_suffix + target_subpath = "arm-linux-androideabi-4.9" + abi_subpath = "arm-linux-androideabi" + arch_subpath = "armeabi" + elif env["android_arch"] == "armv7": + target_subpath = "arm-linux-androideabi-4.9" + abi_subpath = "arm-linux-androideabi" + arch_subpath = "armeabi-v7a" + if env['android_neon'] == 'yes': + env.extra_suffix = ".armv7.neon" + env.extra_suffix + else: + env.extra_suffix = ".armv7" + env.extra_suffix + + mt_link = True + if (sys.platform.startswith("linux")): + host_subpath = "linux-x86_64" + elif (sys.platform.startswith("darwin")): + host_subpath = "darwin-x86_64" + elif (sys.platform.startswith('win')): + if (platform.machine().endswith('64')): + host_subpath = "windows-x86_64" + else: + mt_link = False + host_subpath = "windows" + + compiler_path = env["ANDROID_NDK_ROOT"] + \ + "/toolchains/llvm/prebuilt/" + host_subpath + "/bin" + gcc_toolchain_path = env["ANDROID_NDK_ROOT"] + \ + "/toolchains/" + target_subpath + "/prebuilt/" + host_subpath + tools_path = gcc_toolchain_path + "/" + abi_subpath + "/bin" + + # For Clang to find NDK tools in preference of those system-wide + env.PrependENVPath('PATH', tools_path) + + env['CC'] = compiler_path + '/clang' + env['CXX'] = compiler_path + '/clang++' + env['AR'] = tools_path + "/ar" + env['RANLIB'] = tools_path + "/ranlib" + env['AS'] = tools_path + "/as" + + if env['android_arch'] == 'x86': + env['ARCH'] = 'arch-x86' + else: + env['ARCH'] = 'arch-arm' + + sysroot = env["ANDROID_NDK_ROOT"] + \ + "/platforms/" + ndk_platform + "/" + env['ARCH'] + common_opts = ['-fno-integrated-as', '-gcc-toolchain', gcc_toolchain_path] + + env.Append(CPPFLAGS=["-isystem", sysroot + "/usr/include"]) + env.Append(CPPFLAGS=string.split( + '-Wno-invalid-command-line-argument -Wno-unused-command-line-argument')) + env.Append(CPPFLAGS=string.split( + '-fpic -ffunction-sections -funwind-tables -fstack-protector-strong -fvisibility=hidden -fno-strict-aliasing -Wa,--noexecstack')) + env.Append(CPPFLAGS=string.split('-DANDROID -DNO_STATVFS -DGLES2_ENABLED')) + + env['neon_enabled'] = False + if env['android_arch'] == 'x86': + can_vectorize = True + target_opts = ['-target', 'i686-none-linux-android'] + elif env["android_arch"] == "armv6": + can_vectorize = False + target_opts = ['-target', 'armv6-none-linux-androideabi'] + env.Append(CPPFLAGS=string.split( + '-D__ARM_ARCH_6__ -march=armv6 -mfpu=vfp -mfloat-abi=softfp')) + elif env["android_arch"] == "armv7": + can_vectorize = True + target_opts = ['-target', 'armv7-none-linux-androideabi'] + env.Append(CPPFLAGS=string.split( + '-D__ARM_ARCH_7__ -D__ARM_ARCH_7A__ -march=armv7-a -mfloat-abi=softfp')) + if env['android_neon'] == 'yes': + env['neon_enabled'] = True + env.Append(CPPFLAGS=['-mfpu=neon', '-D__ARM_NEON__']) + else: + env.Append(CPPFLAGS=['-mfpu=vfpv3-d16']) + + env.Append(CPPFLAGS=target_opts) + env.Append(CPPFLAGS=common_opts) + + env.Append(LIBS=['OpenSLES']) + env.Append(LIBS=['EGL', 'OpenSLES', 'android']) + env.Append(LIBS=['log', 'GLESv1_CM', 'GLESv2', 'z']) + + if (sys.platform.startswith("darwin")): + env['SHLIBSUFFIX'] = '.so' + + env['LINKFLAGS'] = ['-shared', '--sysroot=' + + sysroot, '-Wl,--warn-shared-textrel'] + env.Append(LINKFLAGS=string.split( + '-Wl,--fix-cortex-a8')) + env.Append(LINKFLAGS=string.split( + '-Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now')) + env.Append(LINKFLAGS=string.split( + '-Wl,-soname,libgodot_android.so -Wl,--gc-sections')) + if mt_link: + env.Append(LINKFLAGS=['-Wl,--threads']) + env.Append(LINKFLAGS=target_opts) + env.Append(LINKFLAGS=common_opts) + + env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + '/toolchains/arm-linux-androideabi-4.9/prebuilt/' + + host_subpath + '/lib/gcc/' + abi_subpath + '/4.9.x']) + env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + + '/toolchains/arm-linux-androideabi-4.9/prebuilt/' + host_subpath + '/' + abi_subpath + '/lib']) + + if (env["target"].startswith("release")): + env.Append(LINKFLAGS=['-O2']) + env.Append(CPPFLAGS=['-O2', '-DNDEBUG', '-ffast-math', + '-funsafe-math-optimizations', '-fomit-frame-pointer']) + if (can_vectorize): + env.Append(CPPFLAGS=['-ftree-vectorize']) + if (env["target"] == "release_debug"): + env.Append(CPPFLAGS=['-DDEBUG_ENABLED']) + elif (env["target"] == "debug"): + env.Append(LINKFLAGS=['-O0']) + env.Append(CPPFLAGS=['-O0', '-D_DEBUG', '-UNDEBUG', '-DDEBUG_ENABLED', + '-DDEBUG_MEMORY_ALLOC', '-g', '-fno-limit-debug-info']) + + env.Append(CPPFLAGS=['-DANDROID_ENABLED', + '-DUNIX_ENABLED', '-DNO_FCNTL', '-DMPC_FIXED_POINT']) + + # TODO: Move that to opus module's config + if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"): + if (env["android_arch"] == "armv6" or env["android_arch"] == "armv7"): + env.Append(CFLAGS=["-DOPUS_ARM_OPT"]) + env.opus_fixed_point = "yes" + + if (env['android_stl'] == 'yes'): + env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"] + + "/sources/cxx-stl/gnu-libstdc++/4.9/include"]) + env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"] + + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/" + arch_subpath + "/include"]) + env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/" + arch_subpath]) + env.Append(LIBS=["gnustl_static"]) + else: + env.Append(CXXFLAGS=['-fno-rtti', '-fno-exceptions', '-DNO_SAFE_CAST']) + + import methods + env.Append(BUILDERS={'GLSL120': env.Builder( + action=methods.build_legacygl_headers, suffix='glsl.h', src_suffix='.glsl')}) + env.Append(BUILDERS={'GLSL': env.Builder( + action=methods.build_glsl_headers, suffix='glsl.h', src_suffix='.glsl')}) + env.Append(BUILDERS={'GLSL120GLES': env.Builder( + action=methods.build_gles2_headers, suffix='glsl.h', src_suffix='.glsl')}) + + env.use_windows_spawn_fix() diff --git a/platform/android/dir_access_android.cpp b/platform/android/dir_access_android.cpp index 79ba83b3ee..f1a488cec2 100644 --- a/platform/android/dir_access_android.cpp +++ b/platform/android/dir_access_android.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/dir_access_android.h b/platform/android/dir_access_android.h index 9477ca48fd..15c29a9a02 100644 --- a/platform/android/dir_access_android.h +++ b/platform/android/dir_access_android.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/dir_access_jandroid.cpp b/platform/android/dir_access_jandroid.cpp index 57376f8103..bbd041f6c7 100644 --- a/platform/android/dir_access_jandroid.cpp +++ b/platform/android/dir_access_jandroid.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -154,7 +154,7 @@ Error DirAccessJAndroid::change_dir(String p_dir){ String DirAccessJAndroid::get_current_dir(){ - return "/"+current_dir; + return "res://"+current_dir; } bool DirAccessJAndroid::file_exists(String p_file){ @@ -268,6 +268,6 @@ DirAccessJAndroid::DirAccessJAndroid() { DirAccessJAndroid::~DirAccessJAndroid() { - list_dir_end();; + list_dir_end(); } #endif diff --git a/platform/android/dir_access_jandroid.h b/platform/android/dir_access_jandroid.h index 356828dcc1..bfd7912aaf 100644 --- a/platform/android/dir_access_jandroid.h +++ b/platform/android/dir_access_jandroid.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 4735a91f43..72e109fb5d 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -531,9 +531,9 @@ void EditorExportPlatformAndroid::_fix_resources(Vector<uint8_t>& p_manifest) { Vector<String> string_table; - printf("stirng block len: %i\n",string_block_len); - printf("stirng count: %i\n",string_count); - printf("flags: %x\n",string_flags); + //printf("stirng block len: %i\n",string_block_len); + //printf("stirng count: %i\n",string_count); + //printf("flags: %x\n",string_flags); for(uint32_t i=0;i<string_count;i++) { @@ -617,7 +617,7 @@ void EditorExportPlatformAndroid::_fix_resources(Vector<uint8_t>& p_manifest) { p_manifest=ret; - printf("end\n"); + //printf("end\n"); } String EditorExportPlatformAndroid::get_project_name() const { @@ -778,16 +778,16 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool else nspace=""; - printf("ATTR %i NSPACE: %i\n",i,attr_nspace); - printf("ATTR %i NAME: %i (%s)\n",i,attr_name,attrname.utf8().get_data()); - printf("ATTR %i VALUE: %i (%s)\n",i,attr_value,value.utf8().get_data()); - printf("ATTR %i FLAGS: %x\n",i,attr_flags); - printf("ATTR %i RESID: %x\n",i,attr_resid); + //printf("ATTR %i NSPACE: %i\n",i,attr_nspace); + //printf("ATTR %i NAME: %i (%s)\n",i,attr_name,attrname.utf8().get_data()); + //printf("ATTR %i VALUE: %i (%s)\n",i,attr_value,value.utf8().get_data()); + //printf("ATTR %i FLAGS: %x\n",i,attr_flags); + //printf("ATTR %i RESID: %x\n",i,attr_resid); //replace project information if (tname=="manifest" && attrname=="package") { - print_line("FOUND PACKAGE"); + print_line("FOUND package"); string_table[attr_value]=get_package_name(); } @@ -796,14 +796,14 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool //print_line("attrname: "+attrname); if (tname=="manifest" && /*nspace=="android" &&*/ attrname=="versionCode") { - print_line("FOUND versioncode"); + print_line("FOUND versionCode"); encode_uint32(version_code,&p_manifest[iofs+16]); } if (tname=="manifest" && /*nspace=="android" &&*/ attrname=="versionName") { - print_line("FOUND versionname"); + print_line("FOUND versionName"); if (attr_value==0xFFFFFFFF) { WARN_PRINT("Version name in a resource, should be plaintext") } else @@ -834,10 +834,10 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool } else if (value.begins_with("godot.")) { String perm = value.get_slice(".",1); - print_line("PERM: "+perm+" HAS: "+itos(perms.has(perm))); if (perms.has(perm) || (p_give_internet && perm=="INTERNET")) { + print_line("PERM: "+perm); string_table[attr_value]="android.permission."+perm; } @@ -871,12 +871,12 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool } break; } - printf("chunk %x: size: %d\n",chunk,size); + //printf("chunk %x: size: %d\n",chunk,size); ofs+=size; } - printf("end\n"); + //printf("end\n"); //create new andriodmanifest binary @@ -893,14 +893,14 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool encode_uint32(ofs,&ret[string_table_begins+i*4]); ofs+=string_table[i].length()*2+2+2; - print_line("ofs: "+itos(i)+": "+itos(ofs)); + //print_line("ofs: "+itos(i)+": "+itos(ofs)); } ret.resize(ret.size()+ofs); uint8_t *chars=&ret[ret.size()-ofs]; for(int i=0;i<string_table.size();i++) { String s = string_table[i]; - print_line("savint string :"+s); + //print_line("savint string :"+s); encode_uint16(s.length(),chars); chars+=2; for(int j=0;j<s.length();j++) { //include zero? @@ -934,7 +934,7 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool encode_uint32(new_stable_end-8,&ret[12]); //update new string table size - print_line("file size: "+itos(ret.size())); + //print_line("file size: "+itos(ret.size())); p_manifest=ret; @@ -949,7 +949,7 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool header[i]=decode_uint32(&p_manifest[i*4]); } - print_line("STO: "+itos(header[3])); + //print_line("STO: "+itos(header[3])); uint32_t st_offset=9*4; //ERR_FAIL_COND(header[3]!=0x24) uint32_t string_count=header[4]; diff --git a/platform/android/export/export.h b/platform/android/export/export.h index a9421e692e..468b484177 100644 --- a/platform/android/export/export.h +++ b/platform/android/export/export.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/file_access_android.cpp b/platform/android/file_access_android.cpp index aefa16ca9c..2828d3c074 100644 --- a/platform/android/file_access_android.cpp +++ b/platform/android/file_access_android.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/file_access_android.h b/platform/android/file_access_android.h index 3fcd7836c3..3d54eb2027 100644 --- a/platform/android/file_access_android.h +++ b/platform/android/file_access_android.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/file_access_jandroid.cpp b/platform/android/file_access_jandroid.cpp index 3d2e525bbc..4755f1d029 100644 --- a/platform/android/file_access_jandroid.cpp +++ b/platform/android/file_access_jandroid.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/file_access_jandroid.h b/platform/android/file_access_jandroid.h index d576af93d6..38f441ea71 100644 --- a/platform/android/file_access_jandroid.h +++ b/platform/android/file_access_jandroid.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/globals/global_defaults.cpp b/platform/android/globals/global_defaults.cpp index 9a4252bde0..3ec1094ee1 100644 --- a/platform/android/globals/global_defaults.cpp +++ b/platform/android/globals/global_defaults.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/globals/global_defaults.h b/platform/android/globals/global_defaults.h index 6f240572d8..49d7f6393c 100644 --- a/platform/android/globals/global_defaults.h +++ b/platform/android/globals/global_defaults.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/godot_android.cpp b/platform/android/godot_android.cpp index 2371274d9d..d3683d8420 100644 --- a/platform/android/godot_android.cpp +++ b/platform/android/godot_android.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/java/src/org/godotengine/godot/Dictionary.java b/platform/android/java/src/org/godotengine/godot/Dictionary.java index e003c245bb..72f0b7a60e 100644 --- a/platform/android/java/src/org/godotengine/godot/Dictionary.java +++ b/platform/android/java/src/org/godotengine/godot/Dictionary.java @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/java/src/org/godotengine/godot/Godot.java b/platform/android/java/src/org/godotengine/godot/Godot.java index 4b80db7e33..d2533378dc 100644 --- a/platform/android/java/src/org/godotengine/godot/Godot.java +++ b/platform/android/java/src/org/godotengine/godot/Godot.java @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -295,6 +295,25 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC }); } } + + public void alert(final String message, final String title) { + runOnUiThread(new Runnable() { + @Override + public void run() { + AlertDialog.Builder builder = new AlertDialog.Builder(getInstance()); + builder.setMessage(message).setTitle(title); + builder.setPositiveButton( + "OK", + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + dialog.cancel(); + } + }); + AlertDialog dialog = builder.create(); + dialog.show(); + } + }); + } private static Godot _self; diff --git a/platform/android/java/src/org/godotengine/godot/GodotDownloaderAlarmReceiver.java b/platform/android/java/src/org/godotengine/godot/GodotDownloaderAlarmReceiver.java index ea6c070fae..5a07d680b3 100644 --- a/platform/android/java/src/org/godotengine/godot/GodotDownloaderAlarmReceiver.java +++ b/platform/android/java/src/org/godotengine/godot/GodotDownloaderAlarmReceiver.java @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/java/src/org/godotengine/godot/GodotDownloaderService.java b/platform/android/java/src/org/godotengine/godot/GodotDownloaderService.java index 4ea3f13021..878528f7c7 100644 --- a/platform/android/java/src/org/godotengine/godot/GodotDownloaderService.java +++ b/platform/android/java/src/org/godotengine/godot/GodotDownloaderService.java @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/java/src/org/godotengine/godot/GodotIO.java b/platform/android/java/src/org/godotengine/godot/GodotIO.java index 55e330924a..33c1c03ace 100644 --- a/platform/android/java/src/org/godotengine/godot/GodotIO.java +++ b/platform/android/java/src/org/godotengine/godot/GodotIO.java @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -288,6 +288,11 @@ public class GodotIO { try { ad.files = am.list(path); + // no way to find path is directory or file exactly. + // but if ad.files.length==0, then it's an empty directory or file. + if (ad.files.length==0) { + return -1; + } } catch (IOException e) { System.out.printf("Exception on dir_open: %s\n",e); diff --git a/platform/android/java/src/org/godotengine/godot/GodotLib.java b/platform/android/java/src/org/godotengine/godot/GodotLib.java index 9a2ea7df10..57856cfd6b 100644 --- a/platform/android/java/src/org/godotengine/godot/GodotLib.java +++ b/platform/android/java/src/org/godotengine/godot/GodotLib.java @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/java/src/org/godotengine/godot/GodotPaymentV3.java b/platform/android/java/src/org/godotengine/godot/GodotPaymentV3.java index b7de31ada3..6eee8da91b 100644 --- a/platform/android/java/src/org/godotengine/godot/GodotPaymentV3.java +++ b/platform/android/java/src/org/godotengine/godot/GodotPaymentV3.java @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/java/src/org/godotengine/godot/GodotView.java b/platform/android/java/src/org/godotengine/godot/GodotView.java index e210161e8b..db67144bcc 100644 --- a/platform/android/java/src/org/godotengine/godot/GodotView.java +++ b/platform/android/java/src/org/godotengine/godot/GodotView.java @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/java/src/org/godotengine/godot/input/GodotEditText.java b/platform/android/java/src/org/godotengine/godot/input/GodotEditText.java index aa92eeae0f..f0dae03a81 100644 --- a/platform/android/java/src/org/godotengine/godot/input/GodotEditText.java +++ b/platform/android/java/src/org/godotengine/godot/input/GodotEditText.java @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java b/platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java index 13c8c8b3ec..80cded6fb5 100644 --- a/platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java +++ b/platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/java/src/org/godotengine/godot/payments/ConsumeTask.java b/platform/android/java/src/org/godotengine/godot/payments/ConsumeTask.java index 16b669fbe8..13a24994f8 100644 --- a/platform/android/java/src/org/godotengine/godot/payments/ConsumeTask.java +++ b/platform/android/java/src/org/godotengine/godot/payments/ConsumeTask.java @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/java/src/org/godotengine/godot/payments/GenericConsumeTask.java b/platform/android/java/src/org/godotengine/godot/payments/GenericConsumeTask.java index 175d401c87..20feaef581 100644 --- a/platform/android/java/src/org/godotengine/godot/payments/GenericConsumeTask.java +++ b/platform/android/java/src/org/godotengine/godot/payments/GenericConsumeTask.java @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/java/src/org/godotengine/godot/payments/HandlePurchaseTask.java b/platform/android/java/src/org/godotengine/godot/payments/HandlePurchaseTask.java index e63230c4f8..1aa210265d 100644 --- a/platform/android/java/src/org/godotengine/godot/payments/HandlePurchaseTask.java +++ b/platform/android/java/src/org/godotengine/godot/payments/HandlePurchaseTask.java @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/java/src/org/godotengine/godot/payments/PaymentsCache.java b/platform/android/java/src/org/godotengine/godot/payments/PaymentsCache.java index 0635385f53..88fd1a0fe4 100644 --- a/platform/android/java/src/org/godotengine/godot/payments/PaymentsCache.java +++ b/platform/android/java/src/org/godotengine/godot/payments/PaymentsCache.java @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java b/platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java index 753c0a6f93..73d1cc3bc8 100644 --- a/platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java +++ b/platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/java/src/org/godotengine/godot/payments/PurchaseTask.java b/platform/android/java/src/org/godotengine/godot/payments/PurchaseTask.java index 9e92d8b5a5..d154ef0c78 100644 --- a/platform/android/java/src/org/godotengine/godot/payments/PurchaseTask.java +++ b/platform/android/java/src/org/godotengine/godot/payments/PurchaseTask.java @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/java/src/org/godotengine/godot/payments/ReleaseAllConsumablesTask.java b/platform/android/java/src/org/godotengine/godot/payments/ReleaseAllConsumablesTask.java index 2dc7dcf6b1..c74269890d 100644 --- a/platform/android/java/src/org/godotengine/godot/payments/ReleaseAllConsumablesTask.java +++ b/platform/android/java/src/org/godotengine/godot/payments/ReleaseAllConsumablesTask.java @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/java/src/org/godotengine/godot/payments/ValidateTask.java b/platform/android/java/src/org/godotengine/godot/payments/ValidateTask.java index f3532f311f..dafab13ad7 100644 --- a/platform/android/java/src/org/godotengine/godot/payments/ValidateTask.java +++ b/platform/android/java/src/org/godotengine/godot/payments/ValidateTask.java @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/java/src/org/godotengine/godot/utils/Crypt.java b/platform/android/java/src/org/godotengine/godot/utils/Crypt.java index ef7793c1e6..f8936bef2b 100644 --- a/platform/android/java/src/org/godotengine/godot/utils/Crypt.java +++ b/platform/android/java/src/org/godotengine/godot/utils/Crypt.java @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/java/src/org/godotengine/godot/utils/CustomSSLSocketFactory.java b/platform/android/java/src/org/godotengine/godot/utils/CustomSSLSocketFactory.java index f2b0e8786e..823c75d186 100644 --- a/platform/android/java/src/org/godotengine/godot/utils/CustomSSLSocketFactory.java +++ b/platform/android/java/src/org/godotengine/godot/utils/CustomSSLSocketFactory.java @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/java/src/org/godotengine/godot/utils/HttpRequester.java b/platform/android/java/src/org/godotengine/godot/utils/HttpRequester.java index 5687b3c1e1..9dd08a9563 100644 --- a/platform/android/java/src/org/godotengine/godot/utils/HttpRequester.java +++ b/platform/android/java/src/org/godotengine/godot/utils/HttpRequester.java @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/java/src/org/godotengine/godot/utils/RequestParams.java b/platform/android/java/src/org/godotengine/godot/utils/RequestParams.java index d66dfe9531..bb00f1f468 100644 --- a/platform/android/java/src/org/godotengine/godot/utils/RequestParams.java +++ b/platform/android/java/src/org/godotengine/godot/utils/RequestParams.java @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/java_class_wrapper.cpp b/platform/android/java_class_wrapper.cpp index cc1e5b61d1..26123b10af 100644 --- a/platform/android/java_class_wrapper.cpp +++ b/platform/android/java_class_wrapper.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/java_class_wrapper.h b/platform/android/java_class_wrapper.h index 012e7854fe..8165d636c7 100644 --- a/platform/android/java_class_wrapper.h +++ b/platform/android/java_class_wrapper.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp index e5b655e5d5..27219ac56c 100644 --- a/platform/android/java_glue.cpp +++ b/platform/android/java_glue.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -679,6 +679,7 @@ static jmethodID _isVideoPlaying=0; static jmethodID _pauseVideo=0; static jmethodID _stopVideo=0; static jmethodID _setKeepScreenOn=0; +static jmethodID _alertDialog=0; static void _gfx_init_func(void* ud, bool gl2) { @@ -783,6 +784,13 @@ static void _set_keep_screen_on(bool p_enabled) { env->CallVoidMethod(_godot_instance, _setKeepScreenOn, p_enabled); } +static void _alert(const String& p_message, const String& p_title) { + JNIEnv* env = ThreadAndroid::get_env(); + jstring jStrMessage = env->NewStringUTF(p_message.utf8().get_data()); + jstring jStrTitle = env->NewStringUTF(p_title.utf8().get_data()); + env->CallVoidMethod(_godot_instance, _alertDialog, jStrMessage, jStrTitle); +} + JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv * env, jobject obj, jobject activity,jboolean p_need_reload_hook, jobjectArray p_cmdline,jobject p_asset_manager) { __android_log_print(ANDROID_LOG_INFO,"godot","**INIT EVENT! - %p\n",env); @@ -820,6 +828,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv * e _on_video_init = env->GetMethodID(cls, "onVideoInit", "(Z)V"); _setKeepScreenOn = env->GetMethodID(cls,"setKeepScreenOn","(Z)V"); + _alertDialog = env->GetMethodID(cls,"alert","(Ljava/lang/String;Ljava/lang/String;)V"); jclass clsio = env->FindClass("org/godotengine/godot/Godot"); if (cls) { @@ -883,7 +892,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv * e __android_log_print(ANDROID_LOG_INFO,"godot","CMDLINE LEN %i - APK EXPANSION %I\n",cmdlen,int(use_apk_expansion)); - os_android = new OS_Android(_gfx_init_func,env,_open_uri,_get_data_dir,_get_locale, _get_model, _get_screen_dpi, _show_vk, _hide_vk,_set_screen_orient,_get_unique_id, _get_system_dir, _play_video,_is_video_playing, _pause_video, _stop_video, _set_keep_screen_on, use_apk_expansion); + os_android = new OS_Android(_gfx_init_func,env,_open_uri,_get_data_dir,_get_locale, _get_model, _get_screen_dpi, _show_vk, _hide_vk,_set_screen_orient,_get_unique_id, _get_system_dir, _play_video,_is_video_playing, _pause_video, _stop_video, _set_keep_screen_on, _alert, use_apk_expansion); os_android->set_need_reload_hooks(p_need_reload_hook); char wd[500]; diff --git a/platform/android/java_glue.h b/platform/android/java_glue.h index f1c83f01e8..bc4628b9d4 100644 --- a/platform/android/java_glue.h +++ b/platform/android/java_glue.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index 862709fc7d..54af4cde13 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -246,9 +246,11 @@ void OS_Android::print(const char *p_format, ... ) { } -void OS_Android::alert(const String& p_alert) { +void OS_Android::alert(const String& p_alert,const String& p_title) { print("ALERT: %s\n",p_alert.utf8().get_data()); + if (alert_func) + alert_func(p_alert, p_title); } @@ -812,7 +814,7 @@ String OS_Android::get_joy_guid(int p_device) const { return input->get_joy_guid_remapped(p_device); } -OS_Android::OS_Android(GFXInitFunc p_gfx_init_func,void*p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetDataDirFunc p_get_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, SetScreenOrientationFunc p_screen_orient,GetUniqueIDFunc p_get_unique_id,GetSystemDirFunc p_get_sdir_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, bool p_use_apk_expansion) { +OS_Android::OS_Android(GFXInitFunc p_gfx_init_func,void*p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetDataDirFunc p_get_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, SetScreenOrientationFunc p_screen_orient,GetUniqueIDFunc p_get_unique_id,GetSystemDirFunc p_get_sdir_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) { use_apk_expansion=p_use_apk_expansion; default_videomode.width=800; @@ -846,6 +848,7 @@ OS_Android::OS_Android(GFXInitFunc p_gfx_init_func,void*p_gfx_init_ud, OpenURIFu set_screen_orientation_func=p_screen_orient; set_keep_screen_on_func = p_set_keep_screen_on_func; + alert_func = p_alert_func; use_reload_hooks=false; } diff --git a/platform/android/os_android.h b/platform/android/os_android.h index d383fd2036..68b50b2087 100644 --- a/platform/android/os_android.h +++ b/platform/android/os_android.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -75,6 +75,7 @@ typedef bool (*VideoIsPlayingFunc)(); typedef void (*VideoPauseFunc)(); typedef void (*VideoStopFunc)(); typedef void (*SetKeepScreenOnFunc)(bool p_enabled); +typedef void (*AlertFunc)(const String&, const String&); class OS_Android : public OS_Unix { public: @@ -154,6 +155,7 @@ private: VideoPauseFunc video_pause_func; VideoStopFunc video_stop_func; SetKeepScreenOnFunc set_keep_screen_on_func; + AlertFunc alert_func; public: @@ -181,7 +183,7 @@ public: virtual void vprint(const char* p_format, va_list p_list, bool p_stderr=false); virtual void print(const char *p_format, ... ); - virtual void alert(const String& p_alert); + virtual void alert(const String& p_alert,const String& p_title="ALERT!"); virtual void set_mouse_show(bool p_show); @@ -260,7 +262,7 @@ public: virtual String get_joy_guid(int p_device) const; void joy_connection_changed(int p_device, bool p_connected, String p_name); - OS_Android(GFXInitFunc p_gfx_init_func,void*p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetDataDirFunc p_get_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, SetScreenOrientationFunc p_screen_orient,GetUniqueIDFunc p_get_unique_id,GetSystemDirFunc p_get_sdir_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, bool p_use_apk_expansion); + OS_Android(GFXInitFunc p_gfx_init_func,void*p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetDataDirFunc p_get_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, SetScreenOrientationFunc p_screen_orient,GetUniqueIDFunc p_get_unique_id,GetSystemDirFunc p_get_sdir_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(); }; diff --git a/platform/android/platform_config.h b/platform/android/platform_config.h index 143f16c1fa..cdef185ff0 100644 --- a/platform/android/platform_config.h +++ b/platform/android/platform_config.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/thread_jandroid.cpp b/platform/android/thread_jandroid.cpp index 73818b282f..aa40d995d9 100644 --- a/platform/android/thread_jandroid.cpp +++ b/platform/android/thread_jandroid.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/android/thread_jandroid.h b/platform/android/thread_jandroid.h index c8ad6c8735..6f52b730f1 100644 --- a/platform/android/thread_jandroid.h +++ b/platform/android/thread_jandroid.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ |