summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
Diffstat (limited to 'platform')
-rw-r--r--platform/android/SCsub132
-rw-r--r--platform/android/audio_driver_jandroid.cpp10
-rw-r--r--platform/android/audio_driver_jandroid.h9
-rw-r--r--platform/android/audio_driver_opensl.cpp19
-rw-r--r--platform/android/audio_driver_opensl.h14
-rw-r--r--platform/android/build.gradle.template3
-rw-r--r--platform/android/detect.py465
-rw-r--r--platform/android/dir_access_android.cpp10
-rw-r--r--platform/android/dir_access_android.h4
-rw-r--r--platform/android/dir_access_jandroid.cpp14
-rw-r--r--platform/android/dir_access_jandroid.h4
-rw-r--r--platform/android/export/export.cpp130
-rw-r--r--platform/android/export/export.h2
-rw-r--r--platform/android/file_access_android.cpp2
-rw-r--r--platform/android/file_access_android.h2
-rw-r--r--platform/android/file_access_jandroid.cpp4
-rw-r--r--platform/android/file_access_jandroid.h2
-rw-r--r--platform/android/globals/global_defaults.cpp9
-rw-r--r--platform/android/globals/global_defaults.h2
-rw-r--r--platform/android/godot_android.cpp82
-rw-r--r--platform/android/java/src/org/godotengine/godot/Dictionary.java2
-rw-r--r--platform/android/java/src/org/godotengine/godot/Godot.java53
-rw-r--r--platform/android/java/src/org/godotengine/godot/GodotDownloaderAlarmReceiver.java2
-rw-r--r--platform/android/java/src/org/godotengine/godot/GodotDownloaderService.java4
-rw-r--r--platform/android/java/src/org/godotengine/godot/GodotIO.java7
-rw-r--r--platform/android/java/src/org/godotengine/godot/GodotLib.java2
-rw-r--r--platform/android/java/src/org/godotengine/godot/GodotPaymentV3.java2
-rw-r--r--platform/android/java/src/org/godotengine/godot/GodotView.java4
-rw-r--r--platform/android/java/src/org/godotengine/godot/input/GodotEditText.java2
-rw-r--r--platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java2
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/ConsumeTask.java18
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/GenericConsumeTask.java6
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/HandlePurchaseTask.java24
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/PaymentsCache.java6
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java2
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/PurchaseTask.java24
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/ReleaseAllConsumablesTask.java16
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/ValidateTask.java12
-rw-r--r--platform/android/java/src/org/godotengine/godot/utils/Crypt.java2
-rw-r--r--platform/android/java/src/org/godotengine/godot/utils/CustomSSLSocketFactory.java2
-rw-r--r--platform/android/java/src/org/godotengine/godot/utils/HttpRequester.java16
-rw-r--r--platform/android/java/src/org/godotengine/godot/utils/RequestParams.java2
-rw-r--r--platform/android/java_class_wrapper.cpp6
-rw-r--r--platform/android/java_class_wrapper.h24
-rw-r--r--platform/android/java_glue.cpp136
-rw-r--r--platform/android/java_glue.h2
-rw-r--r--platform/android/os_android.cpp47
-rw-r--r--platform/android/os_android.h35
-rw-r--r--platform/android/platform_config.h2
-rw-r--r--platform/android/thread_jandroid.cpp2
-rw-r--r--platform/android/thread_jandroid.h2
-rw-r--r--platform/bb10/SCsub14
-rw-r--r--platform/bb10/audio_driver_bb10.cpp16
-rw-r--r--platform/bb10/audio_driver_bb10.h10
-rw-r--r--platform/bb10/bbutil.c2
-rw-r--r--platform/bb10/bbutil.h6
-rw-r--r--platform/bb10/detect.py117
-rw-r--r--platform/bb10/export/export.cpp56
-rw-r--r--platform/bb10/export/export.h2
-rw-r--r--platform/bb10/godot_bb10.cpp2
-rw-r--r--platform/bb10/os_bb10.cpp55
-rw-r--r--platform/bb10/os_bb10.h14
-rw-r--r--platform/bb10/payment_service.cpp10
-rw-r--r--platform/bb10/payment_service.h4
-rw-r--r--platform/bb10/platform_config.h2
-rw-r--r--platform/haiku/SCsub25
-rw-r--r--platform/haiku/audio_driver_media_kit.cpp8
-rw-r--r--platform/haiku/audio_driver_media_kit.h10
-rw-r--r--platform/haiku/context_gl_haiku.cpp2
-rw-r--r--platform/haiku/context_gl_haiku.h2
-rw-r--r--platform/haiku/detect.py96
-rw-r--r--platform/haiku/godot_haiku.cpp2
-rw-r--r--platform/haiku/haiku_application.cpp2
-rw-r--r--platform/haiku/haiku_application.h2
-rw-r--r--platform/haiku/haiku_direct_window.cpp16
-rw-r--r--platform/haiku/haiku_direct_window.h2
-rw-r--r--platform/haiku/haiku_gl_view.cpp2
-rw-r--r--platform/haiku/haiku_gl_view.h2
-rw-r--r--platform/haiku/key_mapping_haiku.cpp2
-rw-r--r--platform/haiku/key_mapping_haiku.h2
-rw-r--r--platform/haiku/os_haiku.cpp36
-rw-r--r--platform/haiku/os_haiku.h12
-rw-r--r--platform/haiku/platform_config.h4
-rw-r--r--platform/iphone/SCsub36
-rw-r--r--platform/iphone/app_delegate.h8
-rw-r--r--platform/iphone/app_delegate.mm109
-rw-r--r--platform/iphone/audio_driver_iphone.cpp6
-rw-r--r--platform/iphone/audio_driver_iphone.h9
-rw-r--r--platform/iphone/detect.py339
-rw-r--r--platform/iphone/game_center.h4
-rw-r--r--platform/iphone/game_center.mm40
-rwxr-xr-xplatform/iphone/gl_view.h2
-rwxr-xr-xplatform/iphone/gl_view.mm6
-rwxr-xr-xplatform/iphone/globals/global_defaults.cpp7
-rw-r--r--platform/iphone/globals/global_defaults.h2
-rw-r--r--platform/iphone/godot_iphone.cpp2
-rw-r--r--platform/iphone/icloud.h4
-rw-r--r--platform/iphone/icloud.mm30
-rw-r--r--platform/iphone/in_app_store.h4
-rw-r--r--platform/iphone/in_app_store.mm28
-rw-r--r--platform/iphone/ios.h4
-rw-r--r--platform/iphone/ios.mm4
-rw-r--r--platform/iphone/main.m2
-rw-r--r--platform/iphone/os_iphone.cpp82
-rw-r--r--platform/iphone/os_iphone.h21
-rw-r--r--platform/iphone/platform_config.h6
-rw-r--r--platform/iphone/platform_refcount.h2
-rw-r--r--platform/iphone/rasterizer_iphone.cpp62
-rw-r--r--platform/iphone/rasterizer_iphone.h28
-rw-r--r--platform/iphone/sem_iphone.cpp2
-rw-r--r--platform/iphone/sem_iphone.h2
-rw-r--r--platform/iphone/view_controller.h2
-rw-r--r--platform/iphone/view_controller.mm2
-rw-r--r--platform/javascript/SCsub41
-rw-r--r--platform/javascript/audio_driver_javascript.cpp33
-rw-r--r--platform/javascript/audio_driver_javascript.h8
-rw-r--r--platform/javascript/audio_server_javascript.cpp204
-rw-r--r--platform/javascript/audio_server_javascript.h9
-rw-r--r--platform/javascript/detect.py157
-rw-r--r--platform/javascript/dom_keys.h2
-rw-r--r--platform/javascript/export/export.cpp29
-rw-r--r--platform/javascript/export/export.h2
-rw-r--r--platform/javascript/godot_shell.html381
-rw-r--r--platform/javascript/javascript_eval.cpp9
-rw-r--r--platform/javascript/javascript_eval.h4
-rw-r--r--platform/javascript/javascript_main.cpp63
-rw-r--r--platform/javascript/os_javascript.cpp364
-rw-r--r--platform/javascript/os_javascript.h43
-rw-r--r--platform/javascript/platform_config.h2
-rw-r--r--platform/osx/SCsub18
-rw-r--r--platform/osx/audio_driver_osx.cpp6
-rw-r--r--platform/osx/audio_driver_osx.h8
-rw-r--r--platform/osx/context_gl_osx.cpp2
-rw-r--r--platform/osx/context_gl_osx.h2
-rw-r--r--platform/osx/detect.py156
-rw-r--r--platform/osx/dir_access_osx.h2
-rw-r--r--platform/osx/dir_access_osx.mm2
-rw-r--r--platform/osx/export/export.cpp12
-rw-r--r--platform/osx/export/export.h2
-rw-r--r--platform/osx/godot_main_osx.mm2
-rw-r--r--platform/osx/godot_osx.h2
-rw-r--r--platform/osx/godot_osx.mm2
-rw-r--r--platform/osx/joypad_osx.cpp (renamed from platform/osx/joystick_osx.cpp)95
-rw-r--r--platform/osx/joypad_osx.h (renamed from platform/osx/joystick_osx.h)38
-rw-r--r--platform/osx/os_osx.h20
-rw-r--r--platform/osx/os_osx.mm158
-rw-r--r--platform/osx/platform_config.h5
-rw-r--r--platform/osx/sem_osx.cpp2
-rw-r--r--platform/osx/sem_osx.h2
-rw-r--r--platform/server/SCsub6
-rw-r--r--platform/server/detect.py121
-rw-r--r--platform/server/godot_server.cpp2
-rw-r--r--platform/server/os_server.cpp26
-rw-r--r--platform/server/os_server.h15
-rw-r--r--platform/server/platform_config.h2
-rw-r--r--platform/uwp/SCsub23
-rw-r--r--platform/uwp/app.cpp (renamed from platform/winrt/app.cpp)18
-rw-r--r--platform/uwp/app.h (renamed from platform/winrt/app.h)78
-rw-r--r--platform/uwp/detect.py170
-rw-r--r--platform/uwp/export/export.cpp (renamed from platform/winrt/export/export.cpp)91
-rw-r--r--platform/uwp/export/export.h (renamed from platform/winrt/export/export.h)4
-rw-r--r--platform/uwp/gl_context_egl.cpp (renamed from platform/winrt/gl_context_egl.cpp)2
-rw-r--r--platform/uwp/gl_context_egl.h (renamed from platform/winrt/gl_context_egl.h)2
-rw-r--r--platform/uwp/joypad_uwp.cpp (renamed from platform/winrt/joystick_winrt.cpp)28
-rw-r--r--platform/uwp/joypad_uwp.h (renamed from platform/winrt/joystick_winrt.h)18
-rw-r--r--platform/uwp/logo.png (renamed from platform/winrt/logo.png)bin1882 -> 1882 bytes
-rw-r--r--platform/uwp/os_uwp.cpp (renamed from platform/winrt/os_winrt.cpp)217
-rw-r--r--platform/uwp/os_uwp.h (renamed from platform/winrt/os_winrt.h)42
-rw-r--r--platform/uwp/platform_config.h (renamed from platform/winrt/platform_config.h)2
-rw-r--r--platform/uwp/thread_uwp.cpp (renamed from platform/winrt/thread_winrt.cpp)30
-rw-r--r--platform/uwp/thread_uwp.h (renamed from platform/winrt/thread_winrt.h)22
-rw-r--r--platform/windows/SCsub32
-rw-r--r--platform/windows/context_gl_win.cpp18
-rw-r--r--platform/windows/context_gl_win.h2
-rw-r--r--platform/windows/ctxgl_procaddr.cpp2
-rw-r--r--platform/windows/ctxgl_procaddr.h2
-rw-r--r--platform/windows/detect.py541
-rw-r--r--platform/windows/export/export.cpp2
-rw-r--r--platform/windows/export/export.h2
-rw-r--r--platform/windows/godot_win.cpp2
-rw-r--r--platform/windows/joypad.cpp (renamed from platform/windows/joystick.cpp)161
-rw-r--r--platform/windows/joypad.h (renamed from platform/windows/joystick.h)41
-rw-r--r--platform/windows/key_mapping_win.cpp4
-rw-r--r--platform/windows/key_mapping_win.h2
-rw-r--r--platform/windows/lang_table.h2
-rw-r--r--platform/windows/os_windows.cpp150
-rw-r--r--platform/windows/os_windows.h30
-rw-r--r--platform/windows/packet_peer_udp_winsock.cpp45
-rw-r--r--platform/windows/packet_peer_udp_winsock.h8
-rw-r--r--platform/windows/platform_config.h4
-rw-r--r--platform/windows/stream_peer_winsock.cpp52
-rw-r--r--platform/windows/stream_peer_winsock.h11
-rw-r--r--platform/windows/tcp_server_winsock.cpp19
-rw-r--r--platform/windows/tcp_server_winsock.h4
-rw-r--r--platform/winrt/SCsub23
-rw-r--r--platform/winrt/detect.py166
-rw-r--r--platform/x11/SCsub12
-rw-r--r--platform/x11/context_gl_x11.cpp26
-rw-r--r--platform/x11/context_gl_x11.h4
-rw-r--r--platform/x11/detect.py389
-rw-r--r--platform/x11/export/export.cpp2
-rw-r--r--platform/x11/export/export.h2
-rw-r--r--platform/x11/godot_x11.cpp2
-rw-r--r--platform/x11/joypad_linux.cpp (renamed from platform/x11/joystick_linux.cpp)109
-rw-r--r--platform/x11/joypad_linux.h (renamed from platform/x11/joystick_linux.h)47
-rw-r--r--platform/x11/key_mapping_x11.cpp6
-rw-r--r--platform/x11/key_mapping_x11.h2
-rw-r--r--platform/x11/os_x11.cpp114
-rw-r--r--platform/x11/os_x11.h24
-rw-r--r--platform/x11/platform_config.h4
210 files changed, 3946 insertions, 3705 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..e0e89e6344 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 */
@@ -27,9 +27,11 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "audio_driver_jandroid.h"
+
#include "globals.h"
#include "os/os.h"
#include "thread_jandroid.h"
+
#ifndef ANDROID_NATIVE_ACTIVITY
AudioDriverAndroid* AudioDriverAndroid::s_ad=NULL;
@@ -71,7 +73,7 @@ Error AudioDriverAndroid::init(){
}
*/
-// Android_JNI_SetupThread();
+ //Android_JNI_SetupThread();
// __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "SDL audio: opening device");
@@ -199,9 +201,9 @@ int AudioDriverAndroid::get_mix_rate() const {
return mix_rate;
}
-AudioDriverSW::OutputFormat AudioDriverAndroid::get_output_format() const{
+AudioDriver::SpeakerMode AudioDriverAndroid::get_speaker_mode() const{
- return OUTPUT_STEREO;
+ return SPEAKER_MODE_STEREO;
}
void AudioDriverAndroid::lock(){
diff --git a/platform/android/audio_driver_jandroid.h b/platform/android/audio_driver_jandroid.h
index f79057efe5..f485df2001 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 */
@@ -29,12 +29,13 @@
#ifndef AUDIO_DRIVER_ANDROID_H
#define AUDIO_DRIVER_ANDROID_H
-#include "servers/audio/audio_server_sw.h"
+#include "servers/audio_server.h"
+
#ifndef ANDROID_NATIVE_ACTIVITY
#include "java_glue.h"
-class AudioDriverAndroid : public AudioDriverSW {
+class AudioDriverAndroid : public AudioDriver {
static Mutex *mutex;
@@ -65,7 +66,7 @@ public:
virtual Error init();
virtual void start();
virtual int get_mix_rate() const ;
- virtual OutputFormat get_output_format() const;
+ virtual SpeakerMode get_speaker_mode() const;
virtual void lock();
virtual void unlock();
virtual void finish();
diff --git a/platform/android/audio_driver_opensl.cpp b/platform/android/audio_driver_opensl.cpp
index b7ef1424e5..2ec80f23c3 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 */
@@ -27,11 +27,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "audio_driver_opensl.h"
-#include <string.h>
-
-
-
+#include <string.h>
#define MAX_NUMBER_INTERFACES 3
#define MAX_NUMBER_OUTPUT_DEVICES 6
@@ -108,7 +105,7 @@ void AudioDriverOpenSL::_buffer_callbacks(
AudioDriverOpenSL *ad = (AudioDriverOpenSL*)pContext;
-// ad->_buffer_callback(queueItf,eventFlags,pBuffer,bufferSize,dataUsed);
+ //ad->_buffer_callback(queueItf,eventFlags,pBuffer,bufferSize,dataUsed);
ad->_buffer_callback(queueItf);
}
@@ -271,8 +268,8 @@ void AudioDriverOpenSL::start(){
ERR_FAIL_COND( res !=SL_RESULT_SUCCESS );
SLDataLocator_AndroidSimpleBufferQueue loc_bufq = {SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, BUFFER_COUNT};
-// bufferQueue.locatorType = SL_DATALOCATOR_BUFFERQUEUE;
-// bufferQueue.numBuffers = BUFFER_COUNT; /* Four buffers in our buffer queue */
+ //bufferQueue.locatorType = SL_DATALOCATOR_BUFFERQUEUE;
+ //bufferQueue.numBuffers = BUFFER_COUNT; /* Four buffers in our buffer queue */
/* Setup the format of the content in the buffer queue */
pcm.formatType = SL_DATAFORMAT_PCM;
pcm.numChannels = 2;
@@ -295,7 +292,7 @@ void AudioDriverOpenSL::start(){
audioSink.pLocator = (void *)&locator_outputmix;
audioSink.pFormat = NULL;
/* Initialize the context for Buffer queue callbacks */
-// cntxt.pDataBase = (void*)&pcmData;
+ //cntxt.pDataBase = (void*)&pcmData;
//cntxt.pData = cntxt.pDataBase;
//cntxt.size = sizeof(pcmData);
/* Set arrays required[] and iidArray[] for SEEK interface
@@ -373,9 +370,9 @@ int AudioDriverOpenSL::get_mix_rate() const {
return 44100;
}
-AudioDriverSW::OutputFormat AudioDriverOpenSL::get_output_format() const{
+AudioDriver::SpeakerMode AudioDriverOpenSL::get_speaker_mode() const{
- return OUTPUT_STEREO;
+ return SPEAKER_MODE_STEREO;
}
void AudioDriverOpenSL::lock(){
diff --git a/platform/android/audio_driver_opensl.h b/platform/android/audio_driver_opensl.h
index 1b04f32fd2..1baaa95052 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 */
@@ -29,15 +29,13 @@
#ifndef AUDIO_DRIVER_OPENSL_H
#define AUDIO_DRIVER_OPENSL_H
-
-
-#include "servers/audio/audio_server_sw.h"
+#include "servers/audio_server.h"
#include "os/mutex.h"
-#include <SLES/OpenSLES.h>
-#include "SLES/OpenSLES_Android.h"
+#include <SLES/OpenSLES.h>
+#include <SLES/OpenSLES_Android.h>
-class AudioDriverOpenSL : public AudioDriverSW {
+class AudioDriverOpenSL : public AudioDriver {
bool active;
Mutex *mutex;
@@ -94,7 +92,7 @@ public:
virtual Error init();
virtual void start();
virtual int get_mix_rate() const ;
- virtual OutputFormat get_output_format() const;
+ virtual SpeakerMode get_speaker_mode() const;
virtual void lock();
virtual void unlock();
virtual void finish();
diff --git a/platform/android/build.gradle.template b/platform/android/build.gradle.template
index 873eef0566..c46a15bd12 100644
--- a/platform/android/build.gradle.template
+++ b/platform/android/build.gradle.template
@@ -52,11 +52,10 @@ android {
java.srcDirs = ['src'
$$GRADLE_JAVA_DIRS$$
]
- resources.srcDirs = [
+ res.srcDirs = [
'res'
$$GRADLE_RES_DIRS$$
]
- res.srcDirs = ['res']
// libs.srcDirs = ['libs']
aidl.srcDirs = [
'aidl'
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..82b2761bb0 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 */
@@ -37,16 +37,16 @@ DirAccess *DirAccessAndroid::create_fs() {
return memnew(DirAccessAndroid);
}
-bool DirAccessAndroid::list_dir_begin() {
+Error DirAccessAndroid::list_dir_begin() {
list_dir_end();
AAssetDir* aad = AAssetManager_openDir(FileAccessAndroid::asset_manager,current_dir.utf8().get_data());
if (!aad)
- return true; //nothing
+ return ERR_CANT_OPEN; //nothing
- return false;
+ return OK;
}
String DirAccessAndroid::get_next(){
@@ -192,6 +192,6 @@ DirAccessAndroid::DirAccessAndroid() {
DirAccessAndroid::~DirAccessAndroid() {
- list_dir_end();;
+ list_dir_end();
}
#endif
diff --git a/platform/android/dir_access_android.h b/platform/android/dir_access_android.h
index 9477ca48fd..72611ceb59 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 */
@@ -49,7 +49,7 @@ class DirAccessAndroid : public DirAccess {
public:
- virtual bool list_dir_begin(); ///< This starts dir listing
+ virtual Error list_dir_begin(); ///< This starts dir listing
virtual String get_next();
virtual bool current_is_dir() const;
virtual bool current_is_hidden() const;
diff --git a/platform/android/dir_access_jandroid.cpp b/platform/android/dir_access_jandroid.cpp
index 57376f8103..2528b18248 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 */
@@ -47,7 +47,7 @@ DirAccess *DirAccessJAndroid::create_fs() {
return memnew(DirAccessJAndroid);
}
-bool DirAccessJAndroid::list_dir_begin() {
+Error DirAccessJAndroid::list_dir_begin() {
list_dir_end();
JNIEnv *env = ThreadAndroid::get_env();
@@ -55,11 +55,11 @@ bool DirAccessJAndroid::list_dir_begin() {
jstring js = env->NewStringUTF(current_dir.utf8().get_data());
int res = env->CallIntMethod(io,_dir_open,js);
if (res<=0)
- return true;
+ return ERR_CANT_OPEN;
id=res;
- return false;
+ return OK;
}
String DirAccessJAndroid::get_next(){
@@ -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){
@@ -257,7 +257,7 @@ void DirAccessJAndroid::setup( jobject p_io) {
__android_log_print(ANDROID_LOG_INFO,"godot","*******GOT METHOD _dir_is_dir ok!!");
}
-// (*env)->CallVoidMethod(env,obj,aMethodID, myvar);
+ //(*env)->CallVoidMethod(env,obj,aMethodID, myvar);
}
@@ -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..5db32b945c 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 */
@@ -58,7 +58,7 @@ class DirAccessJAndroid : public DirAccess {
public:
- virtual bool list_dir_begin(); ///< This starts dir listing
+ virtual Error list_dir_begin(); ///< This starts dir listing
virtual String get_next();
virtual bool current_is_dir() const;
virtual bool current_is_hidden() const;
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 4735a91f43..33283eccea 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 */
@@ -190,7 +190,7 @@ NULL};
class EditorExportPlatformAndroid : public EditorExportPlatform {
- OBJ_TYPE( EditorExportPlatformAndroid,EditorExportPlatform );
+ GDCLASS( EditorExportPlatformAndroid,EditorExportPlatform );
enum {
@@ -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++) {
@@ -553,8 +553,8 @@ void EditorExportPlatformAndroid::_fix_resources(Vector<uint8_t>& p_manifest) {
String lang = str.substr(str.find_last("-")+1,str.length()).replace("-","_");
String prop = "application/name_"+lang;
- if (Globals::get_singleton()->has(prop)) {
- str = Globals::get_singleton()->get(prop);
+ if (GlobalConfig::get_singleton()->has(prop)) {
+ str = GlobalConfig::get_singleton()->get(prop);
} else {
str = get_project_name();
}
@@ -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 {
@@ -626,7 +626,7 @@ String EditorExportPlatformAndroid::get_project_name() const {
if (this->name!="") {
aname=this->name;
} else {
- aname = Globals::get_singleton()->get("application/name");
+ aname = GlobalConfig::get_singleton()->get("application/name");
}
@@ -729,17 +729,17 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool
}
-// print_line("String "+itos(i)+": "+string_table[i]);
+ //print_line("String "+itos(i)+": "+string_table[i]);
}
for(uint32_t i=string_end;i<(ofs+size);i++) {
stable_extra.push_back(p_manifest[i]);
}
-// printf("stable extra: %i\n",int(stable_extra.size()));
+ //printf("stable extra: %i\n",int(stable_extra.size()));
string_table_ends=ofs+size;
-// print_line("STABLE SIZE: "+itos(size)+" ACTUAL: "+itos(string_table_ends));
+ //print_line("STABLE SIZE: "+itos(size)+" ACTUAL: "+itos(string_table_ends));
} break;
case CHUNK_XML_START_TAG: {
@@ -752,7 +752,7 @@ void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool
String tname=string_table[name];
-// printf("NSPACE: %i\n",nspace);
+ //printf("NSPACE: %i\n",nspace);
//printf("NAME: %i (%s)\n",name,tname.utf8().get_data());
//printf("CHECK: %x\n",check);
uint32_t attrcount=decode_uint32(&p_manifest[iofs+20]);
@@ -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];
@@ -1148,7 +1148,7 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
if (!found) {
- String appicon = Globals::get_singleton()->get("application/icon");
+ String appicon = GlobalConfig::get_singleton()->get("application/icon");
if (appicon!="" && appicon.ends_with(".png")) {
FileAccess*f = FileAccess::open(appicon,FileAccess::READ);
if (f) {
@@ -1212,9 +1212,9 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
if (p_flags&EXPORT_DUMB_CLIENT) {
- /*String host = EditorSettings::get_singleton()->get("file_server/host");
- int port = EditorSettings::get_singleton()->get("file_server/post");
- String passwd = EditorSettings::get_singleton()->get("file_server/password");
+ /*String host = EditorSettings::get_singleton()->get("filesystem/file_server/host");
+ int port = EditorSettings::get_singleton()->get("filesystem/file_server/post");
+ String passwd = EditorSettings::get_singleton()->get("filesystem/file_server/password");
cl.push_back("-rfs");
cl.push_back(host+":"+itos(port));
if (passwd!="") {
@@ -1305,7 +1305,7 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
if (_signed) {
- String jarsigner=EditorSettings::get_singleton()->get("android/jarsigner");
+ 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.");
return OK;
@@ -1315,9 +1315,9 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
String password;
String user;
if (p_debug) {
- keystore=EditorSettings::get_singleton()->get("android/debug_keystore");
- password=EditorSettings::get_singleton()->get("android/debug_keystore_pass");
- user=EditorSettings::get_singleton()->get("android/debug_keystore_user");
+ keystore=EditorSettings::get_singleton()->get("export/android/debug_keystore");
+ 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);
@@ -1340,7 +1340,7 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
args.push_back("SHA1");
args.push_back("-sigalg");
args.push_back("MD5withRSA");
- String tsa_url=EditorSettings::get_singleton()->get("android/timestamping_authority_url");
+ String tsa_url=EditorSettings::get_singleton()->get("export/android/timestamping_authority_url");
if (tsa_url != "") {
args.push_back("-tsa");
args.push_back(tsa_url);
@@ -1506,7 +1506,7 @@ void EditorExportPlatformAndroid::_device_poll_thread(void *ud) {
while(!ea->quit_request) {
- String adb=EditorSettings::get_singleton()->get("android/adb");
+ String adb=EditorSettings::get_singleton()->get("export/android/adb");
if (FileAccess::exists(adb)) {
String devices;
@@ -1523,7 +1523,7 @@ void EditorExportPlatformAndroid::_device_poll_thread(void *ud) {
if (dpos==-1)
continue;
d=d.substr(0,dpos).strip_edges();
- // print_line("found devuce: "+d);
+ //print_line("found devuce: "+d);
ldevices.push_back(d);
}
@@ -1602,8 +1602,8 @@ void EditorExportPlatformAndroid::_device_poll_thread(void *ud) {
}
d.name=vendor+" "+device;
- // print_line("name: "+d.name);
- // print_line("description: "+d.description);
+ //print_line("name: "+d.name);
+ //print_line("description: "+d.description);
}
@@ -1628,8 +1628,8 @@ void EditorExportPlatformAndroid::_device_poll_thread(void *ud) {
}
- if (EditorSettings::get_singleton()->get("android/shutdown_adb_on_exit")) {
- String adb=EditorSettings::get_singleton()->get("android/adb");
+ if (EditorSettings::get_singleton()->get("export/android/shutdown_adb_on_exit")) {
+ String adb=EditorSettings::get_singleton()->get("export/android/adb");
if (!FileAccess::exists(adb)) {
return; //adb not configured
}
@@ -1647,7 +1647,7 @@ Error EditorExportPlatformAndroid::run(int p_device, int p_flags) {
EditorProgress ep("run","Running on "+devices[p_device].name,3);
- String adb=EditorSettings::get_singleton()->get("android/adb");
+ String adb=EditorSettings::get_singleton()->get("export/android/adb");
if (adb=="") {
EditorNode::add_io_error("ADB executable not configured in settings, can't run.");
@@ -1659,7 +1659,7 @@ Error EditorExportPlatformAndroid::run(int p_device, int p_flags) {
ep.step("Exporting APK",0);
- bool use_adb_over_usb = bool(EDITOR_DEF("android/use_remote_debug_over_adb",true));
+ bool use_adb_over_usb = bool(EDITOR_DEF("export/android/use_remote_debug_over_adb",true));
if (use_adb_over_usb) {
p_flags|=EXPORT_REMOTE_DEBUG_LOCALHOST;
@@ -1719,7 +1719,7 @@ Error EditorExportPlatformAndroid::run(int p_device, int p_flags) {
args.push_back("--remove-all");
err = OS::get_singleton()->execute(adb,args,true,NULL,NULL,&rv);
- int port = Globals::get_singleton()->get("debug/debug_port");
+ int port = GlobalConfig::get_singleton()->get("network/debug/remote_port");
args.clear();
args.push_back("reverse");
args.push_back("tcp:"+itos(port));
@@ -1728,7 +1728,7 @@ Error EditorExportPlatformAndroid::run(int p_device, int p_flags) {
err = OS::get_singleton()->execute(adb,args,true,NULL,NULL,&rv);
print_line("Reverse result: "+itos(rv));
- int fs_port = EditorSettings::get_singleton()->get("file_server/port");
+ int fs_port = EditorSettings::get_singleton()->get("filesystem/file_server/port");
args.clear();
args.push_back("reverse");
@@ -1748,6 +1748,7 @@ Error EditorExportPlatformAndroid::run(int p_device, int p_flags) {
args.push_back("shell");
args.push_back("am");
args.push_back("start");
+ args.push_back("--user 0");
args.push_back("-a");
args.push_back("android.intent.action.MAIN");
args.push_back("-n");
@@ -1766,7 +1767,7 @@ Error EditorExportPlatformAndroid::run(int p_device, int p_flags) {
String EditorExportPlatformAndroid::get_package_name() {
String pname = package;
- String basename = Globals::get_singleton()->get("application/name");
+ String basename = GlobalConfig::get_singleton()->get("application/name");
basename=basename.to_lower();
String name;
@@ -1822,7 +1823,7 @@ EditorExportPlatformAndroid::EditorExportPlatformAndroid() {
bool EditorExportPlatformAndroid::can_export(String *r_error) const {
bool valid=true;
- String adb=EditorSettings::get_singleton()->get("android/adb");
+ String adb=EditorSettings::get_singleton()->get("export/android/adb");
String err;
if (!FileAccess::exists(adb)) {
@@ -1831,7 +1832,7 @@ bool EditorExportPlatformAndroid::can_export(String *r_error) const {
err+="ADB executable not configured in editor settings.\n";
}
- String js = EditorSettings::get_singleton()->get("android/jarsigner");
+ String js = EditorSettings::get_singleton()->get("export/android/jarsigner");
if (!FileAccess::exists(js)) {
@@ -1839,7 +1840,7 @@ bool EditorExportPlatformAndroid::can_export(String *r_error) const {
err+="OpenJDK 6 jarsigner not configured in editor settings.\n";
}
- String dk = EditorSettings::get_singleton()->get("android/debug_keystore");
+ String dk = EditorSettings::get_singleton()->get("export/android/debug_keystore");
if (!FileAccess::exists(dk)) {
@@ -1864,10 +1865,12 @@ bool EditorExportPlatformAndroid::can_export(String *r_error) const {
if (apk_expansion) {
- //if (apk_expansion_salt=="") {
- // valid=false;
- // err+="Invalid SALT for apk expansion.\n";
- //}
+ /*
+ if (apk_expansion_salt=="") {
+ valid=false;
+ err+="Invalid SALT for apk expansion.\n";
+ }
+ */
if (apk_expansion_pkey=="") {
valid=false;
err+="Invalid public key for apk expansion.\n";
@@ -1893,23 +1896,22 @@ EditorExportPlatformAndroid::~EditorExportPlatformAndroid() {
void register_android_exporter() {
String exe_ext=OS::get_singleton()->get_name()=="Windows"?"exe":"";
- EDITOR_DEF("android/adb","");
+ EDITOR_DEF("export/android/adb","");
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"android/adb",PROPERTY_HINT_GLOBAL_FILE,exe_ext));
- EDITOR_DEF("android/jarsigner","");
+ EDITOR_DEF("export/android/jarsigner","");
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"android/jarsigner",PROPERTY_HINT_GLOBAL_FILE,exe_ext));
- EDITOR_DEF("android/debug_keystore","");
+ EDITOR_DEF("export/android/debug_keystore","");
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"android/debug_keystore",PROPERTY_HINT_GLOBAL_FILE,"keystore"));
- EDITOR_DEF("android/debug_keystore_user","androiddebugkey");
- EDITOR_DEF("android/debug_keystore_pass","android");
+ EDITOR_DEF("export/android/debug_keystore_user","androiddebugkey");
+ EDITOR_DEF("export/android/debug_keystore_pass","android");
//EDITOR_DEF("android/release_keystore","");
//EDITOR_DEF("android/release_username","");
//EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"android/release_keystore",PROPERTY_HINT_GLOBAL_FILE,"*.keystore"));
- EDITOR_DEF("android/timestamping_authority_url","");
- EDITOR_DEF("android/use_remote_debug_over_adb",false);
- EDITOR_DEF("android/shutdown_adb_on_exit",true);
+ EDITOR_DEF("export/android/timestamping_authority_url","");
+ EDITOR_DEF("export/android/use_remote_debug_over_adb",false);
+ EDITOR_DEF("export/android/shutdown_adb_on_exit",true);
Ref<EditorExportPlatformAndroid> exporter = Ref<EditorExportPlatformAndroid>( memnew(EditorExportPlatformAndroid) );
EditorImportExport::get_singleton()->add_export_platform(exporter);
}
-
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..a4e9c191e9 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 */
@@ -236,7 +236,7 @@ void FileAccessJAndroid::setup( jobject p_io) {
__android_log_print(ANDROID_LOG_INFO,"godot","*******GOT METHOD _file_close ok!!");
}
-// (*env)->CallVoidMethod(env,obj,aMethodID, myvar);
+ //(*env)->CallVoidMethod(env,obj,aMethodID, myvar);
}
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..bbf9bd5b0b 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 */
@@ -32,10 +32,11 @@
void register_android_global_defaults() {
- GLOBAL_DEF("rasterizer.Android/use_fragment_lighting",false);
+/* GLOBAL_DEF("rasterizer.Android/use_fragment_lighting",false);
GLOBAL_DEF("rasterizer.Android/fp16_framebuffer",false);
GLOBAL_DEF("display.Android/driver","GLES2");
-// GLOBAL_DEF("rasterizer.Android/trilinear_mipmap_filter",false);
+ //GLOBAL_DEF("rasterizer.Android/trilinear_mipmap_filter",false);
- Globals::get_singleton()->set_custom_property_info("display.Android/driver",PropertyInfo(Variant::STRING,"display.Android/driver",PROPERTY_HINT_ENUM,"GLES2"));
+ GlobalConfig::get_singleton()->set_custom_property_info("display.Android/driver",PropertyInfo(Variant::STRING,"display.Android/driver",PROPERTY_HINT_ENUM,"GLES2"));
+ */
}
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..3c7f7f5854 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 */
@@ -57,7 +57,7 @@ extern "C" {
class JNISingleton : public Object {
- OBJ_TYPE( JNISingleton, Object );
+ GDCLASS( JNISingleton, Object );
struct MethodData {
@@ -153,7 +153,7 @@ public:
} break;
case Variant::STRING_ARRAY: {
- DVector<String> sarray = *p_args[i];
+ PoolVector<String> sarray = *p_args[i];
jobjectArray arr = env->NewObjectArray(sarray.size(),env->FindClass("java/lang/String"),env->NewStringUTF(""));
for(int j=0;j<sarray.size();j++) {
@@ -165,18 +165,18 @@ public:
} break;
case Variant::INT_ARRAY: {
- DVector<int> array = *p_args[i];
+ PoolVector<int> array = *p_args[i];
jintArray arr = env->NewIntArray(array.size());
- DVector<int>::Read r = array.read();
+ PoolVector<int>::Read r = array.read();
env->SetIntArrayRegion(arr,0,array.size(),r.ptr());
v[i].l=arr;
} break;
case Variant::REAL_ARRAY: {
- DVector<float> array = *p_args[i];
+ PoolVector<float> array = *p_args[i];
jfloatArray arr = env->NewFloatArray(array.size());
- DVector<float>::Read r = array.read();
+ PoolVector<float>::Read r = array.read();
env->SetFloatArrayRegion(arr,0,array.size(),r.ptr());
v[i].l=arr;
@@ -225,7 +225,7 @@ public:
jobjectArray arr = (jobjectArray)env->CallObjectMethodA(instance,E->get().method,v);
int stringCount = env->GetArrayLength(arr);
- DVector<String> sarr;
+ PoolVector<String> sarr;
for (int i=0; i<stringCount; i++) {
jstring string = (jstring) env->GetObjectArrayElement(arr, i);
@@ -241,12 +241,12 @@ public:
jintArray arr = (jintArray)env->CallObjectMethodA(instance,E->get().method,v);
int fCount = env->GetArrayLength(arr);
- DVector<int> sarr;
+ PoolVector<int> sarr;
sarr.resize(fCount);
- DVector<int>::Write w = sarr.write();
+ PoolVector<int>::Write w = sarr.write();
env->GetIntArrayRegion(arr,0,fCount,w.ptr());
- w = DVector<int>::Write();
+ w = PoolVector<int>::Write();
ret=sarr;
} break;
case Variant::REAL_ARRAY: {
@@ -254,12 +254,12 @@ public:
jfloatArray arr = (jfloatArray)env->CallObjectMethodA(instance,E->get().method,v);
int fCount = env->GetArrayLength(arr);
- DVector<float> sarr;
+ PoolVector<float> sarr;
sarr.resize(fCount);
- DVector<float>::Write w = sarr.write();
+ PoolVector<float>::Write w = sarr.write();
env->GetFloatArrayRegion(arr,0,fCount,w.ptr());
- w = DVector<float>::Write();
+ w = PoolVector<float>::Write();
ret=sarr;
} break;
default: {
@@ -535,29 +535,33 @@ static int32_t engine_handle_input(struct android_app* app, AInputEvent* event)
case AMOTION_EVENT_ACTION_DOWN: {
engine->os->process_touch(0,0,touchvec);
- //System.out.printf("action down at: %f,%f\n", event.getX(),event.getY());
+ //System.out.printf("action down at: %f,%f\n", event.getX(),event.getY());
} break;
case AMOTION_EVENT_ACTION_MOVE: {
engine->os->process_touch(1,0,touchvec);
- //for(int i=0;i<event.getPointerCount();i++) {
- // System.out.printf("%d - moved to: %f,%f\n",i, event.getX(i),event.getY(i));
- //}
+ /*
+ for(int i=0;i<event.getPointerCount();i++) {
+ System.out.printf("%d - moved to: %f,%f\n",i, event.getX(i),event.getY(i));
+ }
+ */
} break;
case AMOTION_EVENT_ACTION_POINTER_UP: {
engine->os->process_touch(4,pidx,touchvec);
- //System.out.printf("%d - s.up at: %f,%f\n",pointer_idx, event.getX(pointer_idx),event.getY(pointer_idx));
+ //System.out.printf("%d - s.up at: %f,%f\n",pointer_idx, event.getX(pointer_idx),event.getY(pointer_idx));
} break;
case AMOTION_EVENT_ACTION_POINTER_DOWN: {
engine->os->process_touch(3,pidx,touchvec);
- //System.out.printf("%d - s.down at: %f,%f\n",pointer_idx, event.getX(pointer_idx),event.getY(pointer_idx));
+ //System.out.printf("%d - s.down at: %f,%f\n",pointer_idx, event.getX(pointer_idx),event.getY(pointer_idx));
} break;
case AMOTION_EVENT_ACTION_CANCEL:
case AMOTION_EVENT_ACTION_UP: {
engine->os->process_touch(2,0,touchvec);
- //for(int i=0;i<event.getPointerCount();i++) {
- // System.out.printf("%d - up! %f,%f\n",i, event.getX(i),event.getY(i));
- //}
+ /*
+ for(int i=0;i<event.getPointerCount();i++) {
+ System.out.printf("%d - up! %f,%f\n",i, event.getX(i),event.getY(i));
+ }
+ */
} break;
}
@@ -638,8 +642,8 @@ static void engine_handle_cmd(struct android_app* app, int32_t cmd) {
} break;
case APP_CMD_INIT_WINDOW:
- //The window is being shown, get it ready.
- // LOGI("INIT WINDOW");
+ //The window is being shown, get it ready.
+ //LOGI("INIT WINDOW");
if (engine->app->window != NULL) {
if (engine->os==NULL) {
@@ -647,14 +651,14 @@ static void engine_handle_cmd(struct android_app* app, int32_t cmd) {
//do initialization here, when there's OpenGL! hackish but the only way
engine->os = new OS_Android(_gfx_init,engine);
- // char *args[]={"-test","gui",NULL};
+ //char *args[]={"-test","gui",NULL};
__android_log_print(ANDROID_LOG_INFO,"godot","pre asdasd setup...");
#if 0
Error err = Main::setup("apk",2,args);
#else
Error err = Main::setup("apk",0,NULL);
- String modules = Globals::get_singleton()->get("android/modules");
+ String modules = GlobalConfig::get_singleton()->get("android/modules");
Vector<String> mods = modules.split(",",false);
mods.push_back("GodotOS");
__android_log_print(ANDROID_LOG_INFO,"godot","mod count: %i",mods.size());
@@ -722,15 +726,15 @@ static void engine_handle_cmd(struct android_app* app, int32_t cmd) {
engine->animating=1;
engine_draw_frame(engine);
}
- break;
+ break;
case APP_CMD_TERM_WINDOW:
- // The window is being hidden or closed, clean it up.
- // LOGI("TERM WINDOW");
- engine_term_display(engine);
- break;
+ // The window is being hidden or closed, clean it up.
+ //LOGI("TERM WINDOW");
+ engine_term_display(engine);
+ break;
case APP_CMD_GAINED_FOCUS:
- // When our app gains focus, we start monitoring the accelerometer.
- if (engine->accelerometerSensor != NULL) {
+ // When our app gains focus, we start monitoring the accelerometer.
+ if (engine->accelerometerSensor != NULL) {
ASensorEventQueue_enableSensor(engine->sensorEventQueue,
engine->accelerometerSensor);
// We'd like to get 60 events per second (in us).
@@ -833,7 +837,7 @@ void android_main(struct android_app* state) {
// Process this event.
if (source != NULL) {
- // LOGI("process\n");
+ // LOGI("process\n");
source->process(state, source);
} else {
nullmax--;
@@ -883,12 +887,12 @@ void android_main(struct android_app* state) {
return;
}
-// LOGI("end\n");
+ // LOGI("end\n");
}
-// LOGI("engine animating? %i\n",engine.animating);
+ // LOGI("engine animating? %i\n",engine.animating);
if (engine.animating) {
//do os render
@@ -912,7 +916,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_Godot_registerSingleton(JNIEnv
s->set_instance(env->NewGlobalRef(p_object));
jni_singletons[singname]=s;
- Globals::get_singleton()->add_singleton(Globals::Singleton(singname,s));
+ GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton(singname,s));
}
@@ -983,7 +987,7 @@ JNIEXPORT jstring JNICALL Java_org_godotengine_godot_Godot_getGlobal(JNIEnv * en
String js = env->GetStringUTFChars( path, NULL );
- return env->NewStringUTF(Globals::get_singleton()->get(js).operator String().utf8().get_data());
+ return env->NewStringUTF(GlobalConfig::get_singleton()->get(js).operator String().utf8().get_data());
}
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..610f707b47 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 */
@@ -257,8 +257,8 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
public void onVideoInit(boolean use_gl2) {
-// mView = new GodotView(getApplication(),io,use_gl2);
-// setContentView(mView);
+ //mView = new GodotView(getApplication(),io,use_gl2);
+ //setContentView(mView);
layout = new FrameLayout(this);
layout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
@@ -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;
@@ -563,7 +582,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
initializeGodot();
- // instanceSingleton( new GodotFacebook(this) );
+ //instanceSingleton( new GodotFacebook(this) );
}
@@ -702,7 +721,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
@Override public void onBackPressed() {
System.out.printf("** BACK REQUEST!\n");
- GodotLib.quit();
+ GodotLib.back();
}
public void forceQuit() {
@@ -785,9 +804,11 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
} break;
case MotionEvent.ACTION_MOVE: {
GodotLib.touch(1,0,evcount,arr);
- //for(int i=0;i<event.getPointerCount();i++) {
- // System.out.printf("%d - moved to: %f,%f\n",i, event.getX(i),event.getY(i));
- //}
+ /*
+ for(int i=0;i<event.getPointerCount();i++) {
+ System.out.printf("%d - moved to: %f,%f\n",i, event.getX(i),event.getY(i));
+ }
+ */
} break;
case MotionEvent.ACTION_POINTER_UP: {
final int indexPointUp = event.getActionIndex();
@@ -803,9 +824,11 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP: {
GodotLib.touch(2,0,evcount,arr);
- //for(int i=0;i<event.getPointerCount();i++) {
- // System.out.printf("%d - up! %f,%f\n",i, event.getX(i),event.getY(i));
- //}
+ /*
+ for(int i=0;i<event.getPointerCount();i++) {
+ System.out.printf("%d - up! %f,%f\n",i, event.getX(i),event.getY(i));
+ }
+ */
} break;
}
@@ -847,9 +870,11 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
return mPaymentsManager;
}
-// public void setPaymentsManager(PaymentsManager mPaymentsManager) {
-// this.mPaymentsManager = mPaymentsManager;
-// };
+ /*
+ public void setPaymentsManager(PaymentsManager mPaymentsManager) {
+ this.mPaymentsManager = mPaymentsManager;
+ }
+ */
// Audio
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..fba082e80d 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 */
@@ -57,7 +57,7 @@ public class GodotDownloaderService extends DownloaderService {
Log.d("GODOT", "getting public key:" + prefs.getString("store_public_key", null));
return prefs.getString("store_public_key", null);
-// return BASE64_PUBLIC_KEY;
+ //return BASE64_PUBLIC_KEY;
}
/**
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..4cfe295835 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 */
@@ -265,7 +265,7 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener {
if (keyCode == KeyEvent.KEYCODE_BACK) {
GodotLib.quit();
// press 'back' button should not terminate program
- // normal handle 'back' event in game logic
+ //normal handle 'back' event in game logic
return true;
}
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..67293df2a8 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 */
@@ -47,19 +47,19 @@ abstract public class ConsumeTask {
public void consume(final String sku){
-// Log.d("XXX", "Consuming product " + sku);
+ //Log.d("XXX", "Consuming product " + sku);
PaymentsCache pc = new PaymentsCache(context);
Boolean isBlocked = pc.getConsumableFlag("block", sku);
String _token = pc.getConsumableValue("token", sku);
-// Log.d("XXX", "token " + _token);
+ //Log.d("XXX", "token " + _token);
if(!isBlocked && _token == null){
-// _token = "inapp:"+context.getPackageName()+":android.test.purchased";
-// Log.d("XXX", "Consuming product " + sku + " with token " + _token);
+ //_token = "inapp:"+context.getPackageName()+":android.test.purchased";
+ //Log.d("XXX", "Consuming product " + sku + " with token " + _token);
}else if(!isBlocked){
-// Log.d("XXX", "It is not blocked ¿?");
+ //Log.d("XXX", "It is not blocked ¿?");
return;
}else if(_token == null){
-// Log.d("XXX", "No token available");
+ //Log.d("XXX", "No token available");
this.error("No token for sku:" + sku);
return;
}
@@ -69,9 +69,9 @@ abstract public class ConsumeTask {
@Override
protected String doInBackground(String... params) {
try {
-// Log.d("XXX", "Requesting to release item.");
+ //Log.d("XXX", "Requesting to release item.");
int response = mService.consumePurchase(3, context.getPackageName(), token);
-// Log.d("XXX", "release response code: " + response);
+ //Log.d("XXX", "release response code: " + response);
if(response == 0 || response == 8){
return null;
}
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..dfa363ed75 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 */
@@ -60,9 +60,9 @@ abstract public class GenericConsumeTask extends AsyncTask<String, String, Strin
@Override
protected String doInBackground(String... params) {
try {
-// Log.d("godot", "Requesting to consume an item with token ." + token);
+ //Log.d("godot", "Requesting to consume an item with token ." + token);
int response = mService.consumePurchase(3, context.getPackageName(), token);
-// Log.d("godot", "consumePurchase response: " + response);
+ //Log.d("godot", "consumePurchase response: " + response);
if(response == 0 || response == 8){
return null;
}
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..3850453a77 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 */
@@ -56,29 +56,29 @@ abstract public class HandlePurchaseTask {
public void handlePurchaseRequest(int resultCode, Intent data){
-// Log.d("XXX", "Handling purchase response");
-// int responseCode = data.getIntExtra("RESPONSE_CODE", 0);
+ //Log.d("XXX", "Handling purchase response");
+ //int responseCode = data.getIntExtra("RESPONSE_CODE", 0);
PaymentsCache pc = new PaymentsCache(context);
String purchaseData = data.getStringExtra("INAPP_PURCHASE_DATA");
-// Log.d("XXX", "Purchase data:" + purchaseData);
+ //Log.d("XXX", "Purchase data:" + purchaseData);
String dataSignature = data.getStringExtra("INAPP_DATA_SIGNATURE");
//Log.d("XXX", "Purchase signature:" + dataSignature);
if (resultCode == Activity.RESULT_OK) {
try {
-// Log.d("SARLANGA", purchaseData);
+ //Log.d("SARLANGA", purchaseData);
JSONObject jo = new JSONObject(purchaseData);
-// String sku = jo.getString("productId");
-// alert("You have bought the " + sku + ". Excellent choice, aventurer!");
-// String orderId = jo.getString("orderId");
-// String packageName = jo.getString("packageName");
+ //String sku = jo.getString("productId");
+ //alert("You have bought the " + sku + ". Excellent choice, aventurer!");
+ //String orderId = jo.getString("orderId");
+ //String packageName = jo.getString("packageName");
String productId = jo.getString("productId");
-// Long purchaseTime = jo.getLong("purchaseTime");
-// Integer state = jo.getInt("purchaseState");
+ //Long purchaseTime = jo.getLong("purchaseTime");
+ //Integer state = jo.getInt("purchaseState");
String developerPayload = jo.getString("developerPayload");
String purchaseToken = jo.getString("purchaseToken");
@@ -86,7 +86,7 @@ abstract public class HandlePurchaseTask {
error("Untrusted callback");
return;
}
-// Log.d("XXX", "Este es el product ID:" + productId);
+ //Log.d("XXX", "Este es el product ID:" + productId);
pc.setConsumableValue("ticket_signautre", productId, dataSignature);
pc.setConsumableValue("ticket", productId, purchaseData);
pc.setConsumableFlag("block", productId, true);
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..4678dae1b3 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 */
@@ -59,14 +59,14 @@ public class PaymentsCache {
SharedPreferences sharedPref = context.getSharedPreferences("consumables_" + set, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPref.edit();
editor.putString(sku, value);
-// Log.d("XXX", "Setting asset: consumables_" + set + ":" + sku);
+ //Log.d("XXX", "Setting asset: consumables_" + set + ":" + sku);
editor.commit();
}
public String getConsumableValue(String set, String sku){
SharedPreferences sharedPref = context.getSharedPreferences(
"consumables_" + set, Context.MODE_PRIVATE);
-// Log.d("XXX", "Getting asset: consumables_" + set + ":" + sku);
+ //Log.d("XXX", "Getting asset: consumables_" + set + ":" + sku);
return sharedPref.getString(sku, null);
}
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..5ad96b35ee 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 */
@@ -63,18 +63,20 @@ abstract public class PurchaseTask {
Log.d("XXX", "Starting purchase for: " + sku);
PaymentsCache pc = new PaymentsCache(context);
Boolean isBlocked = pc.getConsumableFlag("block", sku);
-// if(isBlocked){
-// Log.d("XXX", "Is awaiting payment confirmation");
-// error("Awaiting payment confirmation");
-// return;
-// }
+ /*
+ if(isBlocked){
+ Log.d("XXX", "Is awaiting payment confirmation");
+ error("Awaiting payment confirmation");
+ return;
+ }
+ */
final String hash = transactionId;
Bundle buyIntentBundle;
try {
buyIntentBundle = mService.getBuyIntent(3, context.getApplicationContext().getPackageName(), sku, "inapp", hash );
} catch (RemoteException e) {
-// Log.d("XXX", "Error: " + e.getMessage());
+ //Log.d("XXX", "Error: " + e.getMessage());
error(e.getMessage());
return;
}
@@ -87,7 +89,7 @@ abstract public class PurchaseTask {
}else if( rc instanceof Long){
responseCode = (int)((Long)rc).longValue();
}
-// Log.d("XXX", "Buy intent response code: " + responseCode);
+ //Log.d("XXX", "Buy intent response code: " + responseCode);
if(responseCode == 1 || responseCode == 3 || responseCode == 4){
canceled();
return;
@@ -102,12 +104,12 @@ abstract public class PurchaseTask {
pc.setConsumableValue("validation_hash", sku, hash);
try {
if(context == null){
-// Log.d("XXX", "No context!");
+ //Log.d("XXX", "No context!");
}
if(pendingIntent == null){
-// Log.d("XXX", "No pending intent");
+ //Log.d("XXX", "No pending intent");
}
-// Log.d("XXX", "Starting activity for purchase!");
+ //Log.d("XXX", "Starting activity for purchase!");
context.startIntentSenderForResult(
pendingIntent.getIntentSender(),
PaymentsManager.REQUEST_CODE_FOR_PURCHASE,
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..60a43a9070 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 */
@@ -56,13 +56,13 @@ abstract public class ReleaseAllConsumablesTask {
public void consumeItAll(){
try{
-// Log.d("godot", "consumeItall for " + context.getPackageName());
+ //Log.d("godot", "consumeItall for " + context.getPackageName());
Bundle bundle = mService.getPurchases(3, context.getPackageName(), "inapp",null);
for (String key : bundle.keySet()) {
- Object value = bundle.get(key);
-// Log.d("godot", String.format("%s %s (%s)", key,
-// value.toString(), value.getClass().getName()));
+ Object value = bundle.get(key);
+ //Log.d("godot", String.format("%s %s (%s)", key,
+ //value.toString(), value.getClass().getName()));
}
@@ -73,13 +73,13 @@ abstract public class ReleaseAllConsumablesTask {
if (myPurchases == null || myPurchases.size() == 0){
-// Log.d("godot", "No purchases!");
+ //Log.d("godot", "No purchases!");
notRequired();
return;
}
-// Log.d("godot", "# products to be consumed:" + myPurchases.size());
+ //Log.d("godot", "# products to be consumed:" + myPurchases.size());
for (int i=0;i<myPurchases.size();i++)
{
@@ -89,7 +89,7 @@ abstract public class ReleaseAllConsumablesTask {
String sku = inappPurchaseData.getString("productId");
String token = inappPurchaseData.getString("purchaseToken");
String signature = mySignatures.get(i);
-// Log.d("godot", "A punto de consumir un item con token:" + token + "\n" + receipt);
+ //Log.d("godot", "A punto de consumir un item con token:" + token + "\n" + receipt);
new GenericConsumeTask(context, mService, sku, receipt,signature, token) {
@Override
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..f09bcbf9a4 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 */
@@ -79,14 +79,14 @@ abstract public class ValidateTask {
param.put("ticket", pc.getConsumableValue("ticket", sku));
param.put("purchaseToken", pc.getConsumableValue("token", sku));
param.put("sku", sku);
-// Log.d("XXX", "Haciendo request a " + url);
-// Log.d("XXX", "ticket: " + pc.getConsumableValue("ticket", sku));
-// Log.d("XXX", "purchaseToken: " + pc.getConsumableValue("token", sku));
-// Log.d("XXX", "sku: " + sku);
+ //Log.d("XXX", "Haciendo request a " + url);
+ //Log.d("XXX", "ticket: " + pc.getConsumableValue("ticket", sku));
+ //Log.d("XXX", "purchaseToken: " + pc.getConsumableValue("token", sku));
+ //Log.d("XXX", "sku: " + sku);
param.put("package", context.getApplicationContext().getPackageName());
HttpRequester requester = new HttpRequester();
String jsonResponse = requester.post(param);
-// Log.d("XXX", "Validation response:\n"+jsonResponse);
+ //Log.d("XXX", "Validation response:\n"+jsonResponse);
return jsonResponse;
}
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..faefbbd2c6 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 */
@@ -78,12 +78,12 @@ public class HttpRequester {
private long cttl=0;
public HttpRequester(){
-// Log.d("XXX", "Creando http request sin contexto");
+ //Log.d("XXX", "Creando http request sin contexto");
}
public HttpRequester(Context context){
this.context=context;
-// Log.d("XXX", "Creando http request con contexto");
+ //Log.d("XXX", "Creando http request con contexto");
}
public String post(RequestParams params){
@@ -99,7 +99,7 @@ public class HttpRequester {
public String get(RequestParams params){
String response = getResponseFromCache(params.getUrl());
if(response == null){
-// Log.d("XXX", "Cache miss!");
+ //Log.d("XXX", "Cache miss!");
HttpGet httpget = new HttpGet(params.getUrl());
long timeInit = new Date().getTime();
response = request(httpget);
@@ -117,7 +117,7 @@ public class HttpRequester {
}
private String request(HttpUriRequest request){
-// Log.d("XXX", "Haciendo request a: " + request.getURI() );
+ //Log.d("XXX", "Haciendo request a: " + request.getURI() );
Log.d("PPP", "Haciendo request a: " + request.getURI() );
long init = new Date().getTime();
HttpClient httpclient = getNewHttpClient();
@@ -128,10 +128,10 @@ public class HttpRequester {
try {
HttpResponse response = httpclient.execute(request);
Log.d("PPP", "Fin de request (" + (new Date().getTime() - init) + ") a: " + request.getURI() );
-// Log.d("XXX1", "Status:" + response.getStatusLine().toString());
+ //Log.d("XXX1", "Status:" + response.getStatusLine().toString());
if(response.getStatusLine().getStatusCode() == 200){
String strResponse = EntityUtils.toString(response.getEntity());
-// Log.d("XXX2", strResponse);
+ //Log.d("XXX2", strResponse);
return strResponse;
}else{
Log.d("XXX3", "Response status code:" + response.getStatusLine().getStatusCode() + "\n" + EntityUtils.toString(response.getEntity()));
@@ -192,7 +192,7 @@ public class HttpRequester {
public void saveResponseIntoCache(String request, String response){
if(context == null){
-// Log.d("XXX", "No context, cache failed!");
+ //Log.d("XXX", "No context, cache failed!");
return;
}
SharedPreferences sharedPref = context.getSharedPreferences("http_get_cache", Context.MODE_PRIVATE);
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..9acda005f1 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 */
@@ -562,7 +562,7 @@ JavaObject::~JavaObject(){
void JavaClassWrapper::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("wrap:JavaClass","name"),&JavaClassWrapper::wrap);
+ ClassDB::bind_method(_MD("wrap:JavaClass","name"),&JavaClassWrapper::wrap);
}
@@ -1240,7 +1240,7 @@ Ref<JavaClass> JavaClassWrapper::wrap(const String& p_class) {
//args[i] = _jobject_to_variant(env, obj);
-// print_line("\targ"+itos(i)+": "+Variant::get_type_name(args[i].get_type()));
+ //print_line("\targ"+itos(i)+": "+Variant::get_type_name(args[i].get_type()));
};
diff --git a/platform/android/java_class_wrapper.h b/platform/android/java_class_wrapper.h
index 012e7854fe..f0156563b2 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 */
@@ -37,7 +37,7 @@ class JavaObject;
class JavaClass : public Reference {
- OBJ_TYPE(JavaClass,Reference);
+ GDCLASS(JavaClass,Reference);
enum ArgumentType {
@@ -98,14 +98,14 @@ class JavaClass : public Reference {
case ARG_TYPE_CLASS: r_type=Variant::OBJECT; break;
case ARG_ARRAY_BIT|ARG_TYPE_VOID: r_type=Variant::NIL; break;
case ARG_ARRAY_BIT|ARG_TYPE_BOOLEAN: r_type=Variant::ARRAY; break;
- case ARG_ARRAY_BIT|ARG_TYPE_BYTE: r_type=Variant::RAW_ARRAY; likelyhood=1.0; break;
- case ARG_ARRAY_BIT|ARG_TYPE_CHAR: r_type=Variant::RAW_ARRAY; likelyhood=0.5; break;
- case ARG_ARRAY_BIT|ARG_TYPE_SHORT: r_type=Variant::INT_ARRAY; likelyhood=0.3; break;
- case ARG_ARRAY_BIT|ARG_TYPE_INT: r_type=Variant::INT_ARRAY; likelyhood=1.0; break;
- case ARG_ARRAY_BIT|ARG_TYPE_LONG: r_type=Variant::INT_ARRAY; likelyhood=0.5; break;
- case ARG_ARRAY_BIT|ARG_TYPE_FLOAT: r_type=Variant::REAL_ARRAY; likelyhood=1.0; break;
- case ARG_ARRAY_BIT|ARG_TYPE_DOUBLE: r_type=Variant::REAL_ARRAY; likelyhood=0.5; break;
- case ARG_ARRAY_BIT|ARG_TYPE_STRING: r_type=Variant::STRING_ARRAY; break;
+ case ARG_ARRAY_BIT|ARG_TYPE_BYTE: r_type=Variant::POOL_BYTE_ARRAY; likelyhood=1.0; break;
+ case ARG_ARRAY_BIT|ARG_TYPE_CHAR: r_type=Variant::POOL_BYTE_ARRAY; likelyhood=0.5; break;
+ case ARG_ARRAY_BIT|ARG_TYPE_SHORT: r_type=Variant::POOL_INT_ARRAY; likelyhood=0.3; break;
+ case ARG_ARRAY_BIT|ARG_TYPE_INT: r_type=Variant::POOL_INT_ARRAY; likelyhood=1.0; break;
+ case ARG_ARRAY_BIT|ARG_TYPE_LONG: r_type=Variant::POOL_INT_ARRAY; likelyhood=0.5; break;
+ case ARG_ARRAY_BIT|ARG_TYPE_FLOAT: r_type=Variant::POOL_REAL_ARRAY; likelyhood=1.0; break;
+ case ARG_ARRAY_BIT|ARG_TYPE_DOUBLE: r_type=Variant::POOL_REAL_ARRAY; likelyhood=0.5; break;
+ case ARG_ARRAY_BIT|ARG_TYPE_STRING: r_type=Variant::POOL_STRING_ARRAY; break;
case ARG_ARRAY_BIT|ARG_TYPE_CLASS: r_type=Variant::ARRAY; break;
}
}
@@ -131,7 +131,7 @@ public:
class JavaObject : public Reference {
- OBJ_TYPE(JavaObject,Reference);
+ GDCLASS(JavaObject,Reference);
Ref<JavaClass> base_class;
friend class JavaClass;
@@ -150,7 +150,7 @@ public:
class JavaClassWrapper : public Object {
- OBJ_TYPE(JavaClassWrapper,Object);
+ GDCLASS(JavaClassWrapper,Object);
Map<String,Ref<JavaClass> > class_cache;
diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp
index e5b655e5d5..dfbb437344 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 */
@@ -120,9 +120,9 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant* p_a
v.val.l=jStr;
v.obj=jStr;
} break;
- case Variant::STRING_ARRAY: {
+ case Variant::POOL_STRING_ARRAY: {
- DVector<String> sarray = *p_arg;
+ PoolVector<String> sarray = *p_arg;
jobjectArray arr = env->NewObjectArray(sarray.size(),env->FindClass("java/lang/String"),env->NewStringUTF(""));
for(int j=0;j<sarray.size();j++) {
@@ -179,30 +179,30 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant* p_a
v.obj=jdict;
} break;
- case Variant::INT_ARRAY: {
+ case Variant::POOL_INT_ARRAY: {
- DVector<int> array = *p_arg;
+ PoolVector<int> array = *p_arg;
jintArray arr = env->NewIntArray(array.size());
- DVector<int>::Read r = array.read();
+ PoolVector<int>::Read r = array.read();
env->SetIntArrayRegion(arr,0,array.size(),r.ptr());
v.val.l=arr;
v.obj=arr;
} break;
- case Variant::RAW_ARRAY: {
- DVector<uint8_t> array = *p_arg;
+ case Variant::POOL_BYTE_ARRAY: {
+ PoolVector<uint8_t> array = *p_arg;
jbyteArray arr = env->NewByteArray(array.size());
- DVector<uint8_t>::Read r = array.read();
+ PoolVector<uint8_t>::Read r = array.read();
env->SetByteArrayRegion(arr,0,array.size(),reinterpret_cast<const signed char*>(r.ptr()));
v.val.l=arr;
v.obj=arr;
} break;
- case Variant::REAL_ARRAY: {
+ case Variant::POOL_REAL_ARRAY: {
- DVector<float> array = *p_arg;
+ PoolVector<float> array = *p_arg;
jfloatArray arr = env->NewFloatArray(array.size());
- DVector<float>::Read r = array.read();
+ PoolVector<float>::Read r = array.read();
env->SetFloatArrayRegion(arr,0,array.size(),r.ptr());
v.val.l=arr;
v.obj=arr;
@@ -259,7 +259,7 @@ Variant _jobject_to_variant(JNIEnv * env, jobject obj) {
jobjectArray arr = (jobjectArray)obj;
int stringCount = env->GetArrayLength(arr);
//print_line("String array! " + String::num(stringCount));
- DVector<String> sarr;
+ PoolVector<String> sarr;
for (int i=0; i<stringCount; i++) {
jstring string = (jstring) env->GetObjectArrayElement(arr, i);
@@ -290,12 +290,12 @@ Variant _jobject_to_variant(JNIEnv * env, jobject obj) {
jintArray arr = (jintArray)obj;
int fCount = env->GetArrayLength(arr);
- DVector<int> sarr;
+ PoolVector<int> sarr;
sarr.resize(fCount);
- DVector<int>::Write w = sarr.write();
+ PoolVector<int>::Write w = sarr.write();
env->GetIntArrayRegion(arr,0,fCount,w.ptr());
- w = DVector<int>::Write();
+ w = PoolVector<int>::Write();
return sarr;
};
@@ -303,12 +303,12 @@ Variant _jobject_to_variant(JNIEnv * env, jobject obj) {
jbyteArray arr = (jbyteArray)obj;
int fCount = env->GetArrayLength(arr);
- DVector<uint8_t> sarr;
+ PoolVector<uint8_t> sarr;
sarr.resize(fCount);
- DVector<uint8_t>::Write w = sarr.write();
+ PoolVector<uint8_t>::Write w = sarr.write();
env->GetByteArrayRegion(arr,0,fCount,reinterpret_cast<signed char*>(w.ptr()));
- w = DVector<uint8_t>::Write();
+ w = PoolVector<uint8_t>::Write();
return sarr;
};
@@ -324,10 +324,10 @@ Variant _jobject_to_variant(JNIEnv * env, jobject obj) {
jdoubleArray arr = (jdoubleArray)obj;
int fCount = env->GetArrayLength(arr);
- RealArray sarr;
+ PoolRealArray sarr;
sarr.resize(fCount);
- RealArray::Write w = sarr.write();
+ PoolRealArray::Write w = sarr.write();
for (int i=0; i<fCount; i++) {
@@ -343,11 +343,11 @@ Variant _jobject_to_variant(JNIEnv * env, jobject obj) {
jfloatArray arr = (jfloatArray)obj;
int fCount = env->GetArrayLength(arr);
- RealArray sarr;
+ PoolRealArray sarr;
sarr.resize(fCount);
- RealArray::Write w = sarr.write();
+ PoolRealArray::Write w = sarr.write();
for (int i=0; i<fCount; i++) {
@@ -384,7 +384,7 @@ Variant _jobject_to_variant(JNIEnv * env, jobject obj) {
jmethodID get_keys = env->GetMethodID(oclass, "get_keys", "()[Ljava/lang/String;");
jobjectArray arr = (jobjectArray)env->CallObjectMethod(obj, get_keys);
- StringArray keys = _jobject_to_variant(env, arr);
+ PoolStringArray keys = _jobject_to_variant(env, arr);
env->DeleteLocalRef(arr);
jmethodID get_values = env->GetMethodID(oclass, "get_values", "()[Ljava/lang/Object;");
@@ -410,7 +410,7 @@ Variant _jobject_to_variant(JNIEnv * env, jobject obj) {
class JNISingleton : public Object {
- OBJ_TYPE( JNISingleton, Object );
+ GDCLASS( JNISingleton, Object );
struct MethodData {
@@ -527,7 +527,7 @@ public:
ret = String::utf8(env->GetStringUTFChars((jstring)o, NULL));
env->DeleteLocalRef(o);
} break;
- case Variant::STRING_ARRAY: {
+ case Variant::POOL_STRING_ARRAY: {
jobjectArray arr = (jobjectArray)env->CallObjectMethodA(instance,E->get().method,v);
@@ -535,31 +535,31 @@ public:
env->DeleteLocalRef(arr);
} break;
- case Variant::INT_ARRAY: {
+ case Variant::POOL_INT_ARRAY: {
jintArray arr = (jintArray)env->CallObjectMethodA(instance,E->get().method,v);
int fCount = env->GetArrayLength(arr);
- DVector<int> sarr;
+ PoolVector<int> sarr;
sarr.resize(fCount);
- DVector<int>::Write w = sarr.write();
+ PoolVector<int>::Write w = sarr.write();
env->GetIntArrayRegion(arr,0,fCount,w.ptr());
- w = DVector<int>::Write();
+ w = PoolVector<int>::Write();
ret=sarr;
env->DeleteLocalRef(arr);
} break;
- case Variant::REAL_ARRAY: {
+ case Variant::POOL_REAL_ARRAY: {
jfloatArray arr = (jfloatArray)env->CallObjectMethodA(instance,E->get().method,v);
int fCount = env->GetArrayLength(arr);
- DVector<float> sarr;
+ PoolVector<float> sarr;
sarr.resize(fCount);
- DVector<float>::Write w = sarr.write();
+ PoolVector<float>::Write w = sarr.write();
env->GetFloatArrayRegion(arr,0,fCount,w.ptr());
- w = DVector<float>::Write();
+ w = PoolVector<float>::Write();
ret=sarr;
env->DeleteLocalRef(arr);
} break;
@@ -642,14 +642,14 @@ struct JAndroidPointerEvent {
static List<JAndroidPointerEvent> pointer_events;
static List<InputEvent> key_events;
-static List<OS_Android::JoystickEvent> joy_events;
+static List<OS_Android::JoypadEvent> joy_events;
static bool initialized=false;
static Mutex *input_mutex=NULL;
static Mutex *suspend_mutex=NULL;
static int step=0;
static bool resized=false;
static bool resized_reload=false;
-static bool quit_request=false;
+static bool go_back_request=false;
static Size2 new_size;
static Vector3 accelerometer;
static Vector3 magnetometer;
@@ -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);
@@ -794,7 +802,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv * e
env->GetJavaVM(&jvm);
_godot_instance=env->NewGlobalRef(activity);
-// _godot_instance=activity;
+ //_godot_instance=activity;
__android_log_print(ANDROID_LOG_INFO,"godot","***************** HELLO FROM JNI!!!!!!!!");
@@ -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) {
@@ -870,7 +879,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv * e
if (!rawString) {
__android_log_print(ANDROID_LOG_INFO,"godot","cmdline arg %i is null\n",i);
} else {
- // __android_log_print(ANDROID_LOG_INFO,"godot","cmdline arg %i is: %s\n",i,rawString);
+ //__android_log_print(ANDROID_LOG_INFO,"godot","cmdline arg %i is: %s\n",i,rawString);
if (strcmp(rawString,"-main_pack")==0)
use_apk_expansion=true;
@@ -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];
@@ -912,7 +921,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv * e
__android_log_print(ANDROID_LOG_INFO,"godot","*****SETUP OK");
//video driver is determined here, because once initialized, it cant be changed
- String vd = Globals::get_singleton()->get("display/driver");
+ String vd = GlobalConfig::get_singleton()->get("display/driver");
env->CallVoidMethod(_godot_instance, _on_video_init, (jboolean)true);
@@ -956,18 +965,17 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_newcontext(JNIEnv * e
}
-JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_quit(JNIEnv * env, jobject obj) {
+JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_back(JNIEnv * env, jobject obj) {
input_mutex->lock();
- quit_request=true;
- print_line("BACK PRESSED");
+ go_back_request=true;
input_mutex->unlock();
}
static void _initialize_java_modules() {
- String modules = Globals::get_singleton()->get("android/modules");
+ String modules = GlobalConfig::get_singleton()->get("android/modules");
Vector<String> mods = modules.split(",",false);
print_line("ANDROID MODULES : " + modules);
__android_log_print(ANDROID_LOG_INFO,"godot","mod count: %i",mods.size());
@@ -1042,7 +1050,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv * env, jo
// because of the way android forces you to do everything with threads
java_class_wrapper = memnew( JavaClassWrapper(_godot_instance ));
- Globals::get_singleton()->add_singleton(Globals::Singleton("JavaClassWrapper",java_class_wrapper));
+ GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("JavaClassWrapper",java_class_wrapper));
_initialize_java_modules();
Main::setup2();
@@ -1081,16 +1089,16 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv * env, jo
while (joy_events.size()) {
- OS_Android::JoystickEvent event = joy_events.front()->get();
+ OS_Android::JoypadEvent event = joy_events.front()->get();
os_android->process_joy_event(event);
joy_events.pop_front();
}
- if (quit_request) {
+ if (go_back_request) {
- os_android->main_loop_request_quit();
- quit_request=false;
+ os_android->main_loop_request_go_back();
+ go_back_request=false;
}
@@ -1143,8 +1151,10 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_touch(JNIEnv * env, j
pointer_events.push_back(jpe);
input_mutex->unlock();
- //if (os_android)
-// os_android->process_touch(ev,pointer,points);
+ /*
+ if (os_android)
+ os_android->process_touch(ev,pointer,points);
+ */
}
@@ -1406,7 +1416,7 @@ static unsigned int android_get_keysym(unsigned int p_code) {
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joybutton(JNIEnv * env, jobject obj, jint p_device, jint p_button, jboolean p_pressed) {
- OS_Android::JoystickEvent jevent;
+ OS_Android::JoypadEvent jevent;
jevent.device = p_device;
jevent.type = OS_Android::JOY_EVENT_BUTTON;
jevent.index = p_button;
@@ -1419,7 +1429,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joybutton(JNIEnv * en
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyaxis(JNIEnv * env, jobject obj, jint p_device, jint p_axis, jfloat p_value) {
- OS_Android::JoystickEvent jevent;
+ OS_Android::JoypadEvent jevent;
jevent.device = p_device;
jevent.type = OS_Android::JOY_EVENT_AXIS;
jevent.index = p_axis;
@@ -1431,7 +1441,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyaxis(JNIEnv * env,
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyhat(JNIEnv * env, jobject obj, jint p_device, jint p_hat_x, jint p_hat_y) {
- OS_Android::JoystickEvent jevent;
+ OS_Android::JoypadEvent jevent;
jevent.device = p_device;
jevent.type = OS_Android::JOY_EVENT_HAT;
int hat = 0;
@@ -1485,7 +1495,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_key(JNIEnv * env, job
ievent.key.unicode = KEY_ENTER;
} else if (p_scancode==4) {
- quit_request=true;
+ go_back_request=true;
}
input_mutex->lock();
@@ -1561,8 +1571,8 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_singleton(JNIEnv * en
s->set_instance(env->NewGlobalRef(p_object));
jni_singletons[singname]=s;
- Globals::get_singleton()->add_singleton(Globals::Singleton(singname,s));
- Globals::get_singleton()->set(singname,s);
+ GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton(singname,s));
+ GlobalConfig::get_singleton()->set(singname,s);
}
@@ -1579,10 +1589,10 @@ static Variant::Type get_jni_type(const String& p_type) {
{"float",Variant::REAL},
{"double", Variant::REAL},
{"java.lang.String",Variant::STRING},
- {"[I",Variant::INT_ARRAY},
- {"[B",Variant::RAW_ARRAY},
- {"[F",Variant::REAL_ARRAY},
- {"[Ljava.lang.String;",Variant::STRING_ARRAY},
+ {"[I",Variant::POOL_INT_ARRAY},
+ {"[B",Variant::POOL_BYTE_ARRAY},
+ {"[F",Variant::POOL_REAL_ARRAY},
+ {"[Ljava.lang.String;",Variant::POOL_STRING_ARRAY},
{"org.godotengine.godot.Dictionary", Variant::DICTIONARY},
{NULL,Variant::NIL}
};
@@ -1640,7 +1650,7 @@ JNIEXPORT jstring JNICALL Java_org_godotengine_godot_GodotLib_getGlobal(JNIEnv *
String js = env->GetStringUTFChars( path, NULL );
- return env->NewStringUTF(Globals::get_singleton()->get(js).operator String().utf8().get_data());
+ return env->NewStringUTF(GlobalConfig::get_singleton()->get(js).operator String().utf8().get_data());
}
@@ -1745,7 +1755,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_calldeferred(JNIEnv *
args[i] = _jobject_to_variant(env, obj);
env->DeleteLocalRef(obj);
-// print_line("\targ"+itos(i)+": "+Variant::get_type_name(args[i].get_type()));
+ //print_line("\targ"+itos(i)+": "+Variant::get_type_name(args[i].get_type()));
};
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..1095689a5b 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 */
@@ -27,18 +27,15 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "os_android.h"
-#include "drivers/gles2/rasterizer_gles2.h"
+#include "drivers/gles2/rasterizer_gles2.h"
#include "core/io/file_access_buffered_fa.h"
#include "drivers/unix/file_access_unix.h"
#include "drivers/unix/dir_access_unix.h"
-
#include "servers/visual/visual_server_raster.h"
#include "servers/visual/visual_server_wrap_mt.h"
#include "main/main.h"
-
#include "file_access_android.h"
-
#include "core/globals.h"
#ifdef ANDROID_NATIVE_ACTIVITY
@@ -129,7 +126,7 @@ void OS_Android::initialize(const VideoMode& p_desired,int p_video_driver,int p_
if (gfx_init_func)
gfx_init_func(gfx_init_ud,use_gl2);
- AudioDriverManagerSW::add_driver(&audio_driver_android);
+ AudioDriverManager::add_driver(&audio_driver_android);
RasterizerGLES2 *rasterizer_gles22=memnew( RasterizerGLES2(false,use_reload_hooks,false,use_reload_hooks ) );
@@ -147,26 +144,13 @@ void OS_Android::initialize(const VideoMode& p_desired,int p_video_driver,int p_
visual_server->init();
visual_server->cursor_set_visible(false, 0);
- AudioDriverManagerSW::get_driver(p_audio_driver)->set_singleton();
+ AudioDriverManager::get_driver(p_audio_driver)->set_singleton();
- if (AudioDriverManagerSW::get_driver(p_audio_driver)->init()!=OK) {
+ if (AudioDriverManager::get_driver(p_audio_driver)->init()!=OK) {
ERR_PRINT("Initializing audio failed.");
}
- sample_manager = memnew( SampleManagerMallocSW );
- audio_server = memnew( AudioServerSW(sample_manager) );
-
- audio_server->set_mixer_params(AudioMixerSW::INTERPOLATION_LINEAR,true);
- audio_server->init();
-
- spatial_sound_server = memnew( SpatialSoundServerSW );
- spatial_sound_server->init();
-
- spatial_sound_2d_server = memnew( SpatialSound2DServerSW );
- spatial_sound_2d_server->init();
-
- //
physics_server = memnew( PhysicsServerSW );
physics_server->init();
//physics_2d_server = memnew( Physics2DServerSW );
@@ -246,9 +230,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);
}
@@ -368,7 +354,7 @@ void OS_Android::main_loop_focusin(){
}
-void OS_Android::process_joy_event(OS_Android::JoystickEvent p_event) {
+void OS_Android::process_joy_event(OS_Android::JoypadEvent p_event) {
switch (p_event.type) {
case JOY_EVENT_BUTTON:
@@ -397,7 +383,7 @@ void OS_Android::process_event(InputEvent p_event) {
void OS_Android::process_touch(int p_what,int p_pointer, const Vector<TouchPos>& p_points) {
-// print_line("ev: "+itos(p_what)+" pnt: "+itos(p_pointer)+" pointc: "+itos(p_points.size()));
+ //print_line("ev: "+itos(p_what)+" pnt: "+itos(p_pointer)+" pointc: "+itos(p_points.size()));
switch(p_what) {
case 0: { //gesture begin
@@ -480,8 +466,8 @@ void OS_Android::process_touch(int p_what,int p_pointer, const Vector<TouchPos>&
ev.mouse_motion.x=p_points[0].pos.x;
ev.mouse_motion.y=p_points[0].pos.y;
input->set_mouse_pos(Point2(ev.mouse_motion.x,ev.mouse_motion.y));
- ev.mouse_motion.speed_x=input->get_mouse_speed().x;
- ev.mouse_motion.speed_y=input->get_mouse_speed().y;
+ ev.mouse_motion.speed_x=input->get_last_mouse_speed().x;
+ ev.mouse_motion.speed_y=input->get_last_mouse_speed().y;
ev.mouse_motion.relative_x=p_points[0].pos.x-last_mouse.x;
ev.mouse_motion.relative_y=p_points[0].pos.y-last_mouse.y;
last_mouse=p_points[0].pos;
@@ -657,10 +643,10 @@ void OS_Android::init_video_mode(int p_video_width,int p_video_height) {
default_videomode.resizable=false;
}
-void OS_Android::main_loop_request_quit() {
+void OS_Android::main_loop_request_go_back() {
if (main_loop)
- main_loop->notification(MainLoop::NOTIFICATION_WM_QUIT_REQUEST);
+ main_loop->notification(MainLoop::NOTIFICATION_WM_GO_BACK_REQUEST);
}
void OS_Android::set_display_size(Size2 p_size) {
@@ -746,7 +732,7 @@ String OS_Android::get_data_dir() const {
return ".";
- //return Globals::get_singleton()->get_singleton_object("GodotOS")->call("get_data_dir");
+ //return GlobalConfig::get_singleton()->get_singleton_object("GodotOS")->call("get_data_dir");
}
@@ -812,7 +798,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 +832,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..bf1db57ba5 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 */
@@ -33,31 +33,20 @@
#include "drivers/unix/os_unix.h"
#include "os/main_loop.h"
#include "servers/physics/physics_server_sw.h"
-#include "servers/spatial_sound/spatial_sound_server_sw.h"
-#include "servers/spatial_sound_2d/spatial_sound_2d_server_sw.h"
-#include "servers/audio/audio_server_sw.h"
+#include "servers/audio_server.h"
#include "servers/physics_2d/physics_2d_server_sw.h"
#include "servers/physics_2d/physics_2d_server_wrap_mt.h"
#include "servers/visual/rasterizer.h"
#include "main/input_default.h"
-
-//#ifdef USE_JAVA_FILE_ACCESS
-
+#include "audio_driver_jandroid.h"
+#include "audio_driver_opensl.h"
#ifdef ANDROID_NATIVE_ACTIVITY
-
#include <android/sensor.h>
#include <android/log.h>
#include <android_native_app_glue.h>
-
-#else
-
-
#endif
-#include "audio_driver_jandroid.h"
-#include "audio_driver_opensl.h"
-
typedef void (*GFXInitFunc)(void *ud,bool gl2);
typedef int (*OpenURIFunc)(const String&);
typedef String (*GetDataDirFunc)();
@@ -75,6 +64,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:
@@ -90,7 +80,7 @@ public:
JOY_EVENT_HAT = 2
};
- struct JoystickEvent {
+ struct JoypadEvent {
int device;
int type;
@@ -117,10 +107,6 @@ private:
Rasterizer *rasterizer;
VisualServer *visual_server;
- AudioServerSW *audio_server;
- SampleManagerMallocSW *sample_manager;
- SpatialSoundServerSW *spatial_sound_server;
- SpatialSound2DServerSW *spatial_sound_2d_server;
PhysicsServer *physics_server;
Physics2DServer *physics_2d_server;
@@ -154,6 +140,7 @@ private:
VideoPauseFunc video_pause_func;
VideoStopFunc video_stop_func;
SetKeepScreenOnFunc set_keep_screen_on_func;
+ AlertFunc alert_func;
public:
@@ -181,7 +168,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);
@@ -211,7 +198,7 @@ public:
void main_loop_begin();
bool main_loop_iterate();
- void main_loop_request_quit();
+ void main_loop_request_go_back();
void main_loop_end();
void main_loop_focusout();
void main_loop_focusin();
@@ -247,7 +234,7 @@ public:
void process_magnetometer(const Vector3& p_magnetometer);
void process_gyroscope(const Vector3& p_gyroscope);
void process_touch(int p_what,int p_pointer, const Vector<TouchPos>& p_points);
- void process_joy_event(JoystickEvent p_event);
+ void process_joy_event(JoypadEvent p_event);
void process_event(InputEvent p_event);
void init_video_mode(int p_video_width,int p_video_height);
@@ -260,7 +247,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 */
diff --git a/platform/bb10/SCsub b/platform/bb10/SCsub
index 84fff0828b..c19f46d579 100644
--- a/platform/bb10/SCsub
+++ b/platform/bb10/SCsub
@@ -4,19 +4,19 @@ Import('env')
bb10_lib = [
- 'bbutil.c',
- 'os_bb10.cpp',
- 'audio_driver_bb10.cpp',
- 'godot_bb10.cpp',
- 'payment_service.cpp',
+ 'bbutil.c',
+ 'os_bb10.cpp',
+ 'audio_driver_bb10.cpp',
+ 'godot_bb10.cpp',
+ 'payment_service.cpp',
]
env_bps = env.Clone()
if env['bb10_payment_service'] == "yes":
- env_bps.Append(CPPFLAGS=['-DPAYMENT_SERVICE_ENABLED'])
+ env_bps.Append(CPPFLAGS=['-DPAYMENT_SERVICE_ENABLED'])
if env['bb10_lgles_override'] == "yes":
- env_bps.Append(CPPFLAGS=['-DBB10_LGLES_OVERRIDE'])
+ env_bps.Append(CPPFLAGS=['-DBB10_LGLES_OVERRIDE'])
prog = None
diff --git a/platform/bb10/audio_driver_bb10.cpp b/platform/bb10/audio_driver_bb10.cpp
index ef8adaf061..b6ea0bc267 100644
--- a/platform/bb10/audio_driver_bb10.cpp
+++ b/platform/bb10/audio_driver_bb10.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 */
@@ -44,7 +44,7 @@ Error AudioDriverBB10::init(const char* p_name) {
samples_out = NULL;
mix_rate = 44100;
- output_format = OUTPUT_STEREO;
+ speaker_mode = SPEAKER_MODE_STEREO;
char* dev_name;
if (p_name == NULL) {
@@ -70,7 +70,7 @@ Error AudioDriverBB10::init(const char* p_name) {
ERR_FAIL_COND_V(!(cinfo.formats & SND_PCM_FMT_S16_LE), FAILED);
printf("voices %i\n", cinfo.max_voices);
- output_format = cinfo.max_voices >= 2 ? OUTPUT_STEREO : OUTPUT_MONO;
+ speaker_mode = SPEAKER_MODE_STEREO;
snd_pcm_channel_params_t cp;
zeromem(&cp, sizeof(cp));
@@ -84,7 +84,7 @@ Error AudioDriverBB10::init(const char* p_name) {
cp.buf.block.frags_min = 1;
cp.format.interleave = 1;
cp.format.rate = mix_rate;
- cp.format.voices = output_format == OUTPUT_MONO ? 1 : 2;
+ cp.format.voices = speaker_mode;
cp.format.format = SND_PCM_SFMT_S16_LE;
ret = snd_pcm_plugin_params(pcm_handle, &cp);
@@ -121,7 +121,7 @@ void AudioDriverBB10::thread_func(void* p_udata) {
AudioDriverBB10* ad = (AudioDriverBB10*)p_udata;
- int channels = (ad->output_format == OUTPUT_MONO ? 1 : 2);
+ int channels = speaker_mode;
int frame_count = ad->sample_buf_count / channels;
int bytes_out = frame_count * channels * 2;
@@ -204,16 +204,18 @@ int AudioDriverBB10::get_mix_rate() const {
return mix_rate;
};
-AudioDriverSW::OutputFormat AudioDriverBB10::get_output_format() const {
+AudioDriver::SpeakerMode AudioDriverBB10::get_speaker_mode() const {
- return output_format;
+ return speaker_mode;
};
+
void AudioDriverBB10::lock() {
if (!thread)
return;
mutex->lock();
};
+
void AudioDriverBB10::unlock() {
if (!thread)
diff --git a/platform/bb10/audio_driver_bb10.h b/platform/bb10/audio_driver_bb10.h
index 0148448511..efb98b1b91 100644
--- a/platform/bb10/audio_driver_bb10.h
+++ b/platform/bb10/audio_driver_bb10.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 */
@@ -26,14 +26,14 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "servers/audio/audio_server_sw.h"
+#include "servers/audio_server.h"
#include "core/os/thread.h"
#include "core/os/mutex.h"
#include <sys/asoundlib.h>
-class AudioDriverBB10 : public AudioDriverSW {
+class AudioDriverBB10 : public AudioDriver {
Thread* thread;
Mutex* mutex;
@@ -47,7 +47,7 @@ class AudioDriverBB10 : public AudioDriverSW {
static void thread_func(void* p_udata);
int mix_rate;
- OutputFormat output_format;
+ SpeakerMode speaker_mode;
int pcm_frag_size;
int pcm_max_frags;
@@ -67,7 +67,7 @@ public:
virtual Error init(const char* p_name);
virtual void start();
virtual int get_mix_rate() const;
- virtual OutputFormat get_output_format() const;
+ virtual SpeakerMode get_speaker_mode() const;
virtual void lock();
virtual void unlock();
virtual void finish();
diff --git a/platform/bb10/bbutil.c b/platform/bb10/bbutil.c
index fce52c5b81..ab3dcf69b2 100644
--- a/platform/bb10/bbutil.c
+++ b/platform/bb10/bbutil.c
@@ -426,7 +426,7 @@ get_window_group_id()
int bbutil_rotate_screen_surface(int angle) {
- int rc, rotation, skip = 1, temp;;
+ int rc, rotation, skip = 1, temp;
EGLint interval = 1;
int size[2];
diff --git a/platform/bb10/bbutil.h b/platform/bb10/bbutil.h
index c2a4c5a7f5..77f4402fbd 100644
--- a/platform/bb10/bbutil.h
+++ b/platform/bb10/bbutil.h
@@ -13,7 +13,11 @@ extern "C" {
extern EGLDisplay egl_disp;
extern EGLSurface egl_surf;
-enum RENDERING_API {GL_ES_1 = EGL_OPENGL_ES_BIT, GL_ES_2 = EGL_OPENGL_ES2_BIT, VG = EGL_OPENVG_BIT};
+enum RENDERING_API {
+ GL_ES_1 = EGL_OPENGL_ES_BIT,
+ GL_ES_2 = EGL_OPENGL_ES2_BIT,
+ VG = EGL_OPENVG_BIT
+};
/**
* Initializes EGL, GL and loads a default font
diff --git a/platform/bb10/detect.py b/platform/bb10/detect.py
index 2b76aa3496..d3ee9f0124 100644
--- a/platform/bb10/detect.py
+++ b/platform/bb10/detect.py
@@ -5,85 +5,88 @@ import methods
def is_active():
- return True
+ return True
+
def get_name():
- return "BlackBerry 10"
+ return "BlackBerry 10"
+
def can_build():
- import os
- if (not os.environ.has_key("QNX_TARGET")):
- return False
- return True
+ import os
+ if (not os.environ.has_key("QNX_TARGET")):
+ return False
+ return True
+
def get_opts():
- return [
- ('QNX_HOST', 'path to qnx host', os.environ.get("QNX_HOST", 0)),
- ('QNX_TARGET', 'path to qnx target', os.environ.get("QNX_TARGET", 0)),
- ('QNX_CONFIGURATION', 'path to qnx configuration', os.environ.get("QNX_CONFIGURATION", 0)),
- ('qnx_target', 'Qnx target (armle or x86', 'armle'),
- ('bb10_payment_service', 'Enable Payment Service for BlackBerry10', 'yes'),
- ('bb10_lgles_override', 'Force legacy GLES (1.1) on iOS', 'no'),
- ('bb10_exceptions', 'Use exceptions when compiling on bb10', 'no'),
- ]
+ return [
+ ('QNX_HOST', 'path to qnx host', os.environ.get("QNX_HOST", 0)),
+ ('QNX_TARGET', 'path to qnx target', os.environ.get("QNX_TARGET", 0)),
+ ('QNX_CONFIGURATION', 'path to qnx configuration', os.environ.get("QNX_CONFIGURATION", 0)),
+ ('qnx_target', 'Qnx target (armle or x86', 'armle'),
+ ('bb10_payment_service', 'Enable Payment Service for BlackBerry10', 'yes'),
+ ('bb10_lgles_override', 'Force legacy GLES (1.1) on iOS', 'no'),
+ ('bb10_exceptions', 'Use exceptions when compiling on bb10', 'no'),
+ ]
+
def get_flags():
- return [
- ('tools', 'no'),
- ('builtin_zlib', 'yes'),
- ('module_theora_enabled', 'no'),
- ]
+ return [
+ ('tools', 'no'),
+ ('module_theora_enabled', 'no'),
+ ]
-def configure(env):
- if env['PLATFORM'] == 'win32':
- env.Tool('mingw')
- env['SPAWN'] = methods.win32_spawn
+def configure(env):
- env['qnx_target_ver'] = env['qnx_target']
- if env['qnx_target'] == "armle":
- env['qnx_prefix'] = 'ntoarmv7'
- env['qnx_target_ver'] = 'armle-v7'
- else:
- env['qnx_prefix'] = 'ntox86'
+ if env['PLATFORM'] == 'win32':
+ env.Tool('mingw')
+ env['SPAWN'] = methods.win32_spawn
- env['OBJSUFFIX'] = ".qnx.${qnx_target}.o"
- env['LIBSUFFIX'] = ".qnx.${qnx_target}.a"
- env['PROGSUFFIX'] = ".qnx.${qnx_target}"
- print("PROGSUFFIX: "+env['PROGSUFFIX']+" target: "+env['qnx_target'])
+ env['qnx_target_ver'] = env['qnx_target']
+ if env['qnx_target'] == "armle":
+ env['qnx_prefix'] = 'ntoarmv7'
+ env['qnx_target_ver'] = 'armle-v7'
+ else:
+ env['qnx_prefix'] = 'ntox86'
- env.PrependENVPath('PATH', env['QNX_CONFIGURATION'] + '/bin')
- env.PrependENVPath('PATH', env['QNX_CONFIGURATION'] + '/usr/bin')
- env['ENV']['QNX_HOST'] = env['QNX_HOST']
- env['ENV']['QNX_TARGET'] = env['QNX_TARGET']
- env['ENV']['QNX_CONFIGURATION'] = env['QNX_CONFIGURATION']
+ env['OBJSUFFIX'] = ".qnx.${qnx_target}.o"
+ env['LIBSUFFIX'] = ".qnx.${qnx_target}.a"
+ env['PROGSUFFIX'] = ".qnx.${qnx_target}"
+ print("PROGSUFFIX: " + env['PROGSUFFIX'] + " target: " + env['qnx_target'])
- env['CC'] = '$qnx_prefix-gcc'
- env['CXX'] = '$qnx_prefix-g++'
- env['AR'] = '$qnx_prefix-ar'
- env['RANLIB'] = '$qnx_prefix-ranlib'
+ env.PrependENVPath('PATH', env['QNX_CONFIGURATION'] + '/bin')
+ env.PrependENVPath('PATH', env['QNX_CONFIGURATION'] + '/usr/bin')
+ env['ENV']['QNX_HOST'] = env['QNX_HOST']
+ env['ENV']['QNX_TARGET'] = env['QNX_TARGET']
+ env['ENV']['QNX_CONFIGURATION'] = env['QNX_CONFIGURATION']
- env.Append(CPPPATH = ['#platform/bb10'])
- env.Append(LIBPATH = ['#platform/bb10/lib/$qnx_target', '#platform/bb10/lib/$qnx_target_ver'])
- env.Append(CCFLAGS = string.split('-DBB10_ENABLED -DUNIX_ENABLED -DGLES2_ENABLED -DGLES1_ENABLED -D_LITTLE_ENDIAN -DNO_THREADS -DNO_FCNTL'))
- if env['bb10_exceptions']=="yes":
- env.Append(CCFLAGS = ['-fexceptions'])
- else:
- env.Append(CCFLAGS = ['-fno-exceptions'])
+ env['CC'] = '$qnx_prefix-gcc'
+ env['CXX'] = '$qnx_prefix-g++'
+ env['AR'] = '$qnx_prefix-ar'
+ env['RANLIB'] = '$qnx_prefix-ranlib'
- #env.Append(LINKFLAGS = string.split()
+ env.Append(CPPPATH=['#platform/bb10'])
+ env.Append(LIBPATH=['#platform/bb10/lib/$qnx_target', '#platform/bb10/lib/$qnx_target_ver'])
+ env.Append(CCFLAGS=string.split('-DBB10_ENABLED -DUNIX_ENABLED -DGLES2_ENABLED -DGLES1_ENABLED -D_LITTLE_ENDIAN -DNO_THREADS -DNO_FCNTL'))
+ if env['bb10_exceptions'] == "yes":
+ env.Append(CCFLAGS=['-fexceptions'])
+ else:
+ env.Append(CCFLAGS=['-fno-exceptions'])
- if (env["target"]=="release"):
+ # env.Append(LINKFLAGS = string.split()
- env.Append(CCFLAGS=['-O3','-DRELEASE_BUILD'])
+ if (env["target"] == "release"):
- elif (env["target"]=="debug"):
+ env.Append(CCFLAGS=['-O3', '-DRELEASE_BUILD'])
- env.Append(CCFLAGS=['-g', '-O0','-DDEBUG_ENABLED', '-D_DEBUG'])
- env.Append(LINKFLAGS=['-g'])
+ elif (env["target"] == "debug"):
- env.Append(LIBS=['bps', 'pps', 'screen', 'socket', 'EGL', 'GLESv2', 'GLESv1_CM', 'm', 'asound'])
+ env.Append(CCFLAGS=['-g', '-O0', '-DDEBUG_ENABLED', '-D_DEBUG'])
+ env.Append(LINKFLAGS=['-g'])
+ env.Append(LIBS=['bps', 'pps', 'screen', 'socket', 'EGL', 'GLESv2', 'GLESv1_CM', 'm', 'asound'])
diff --git a/platform/bb10/export/export.cpp b/platform/bb10/export/export.cpp
index 14d87aef41..cc994c8f24 100644
--- a/platform/bb10/export/export.cpp
+++ b/platform/bb10/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 */
@@ -43,7 +43,7 @@
class EditorExportPlatformBB10 : public EditorExportPlatform {
- OBJ_TYPE( EditorExportPlatformBB10,EditorExportPlatform );
+ GDCLASS( EditorExportPlatformBB10,EditorExportPlatform );
String custom_package;
@@ -248,7 +248,7 @@ void EditorExportPlatformBB10::_fix_descriptor(Vector<uint8_t>& p_descriptor) {
if (this->name!="") {
aname=this->name;
} else {
- aname = Globals::get_singleton()->get("application/name");
+ aname = GlobalConfig::get_singleton()->get("application/name");
}
@@ -432,7 +432,7 @@ Error EditorExportPlatformBB10::export_project(const String& p_path, bool p_debu
if (!found) {
- String appicon = Globals::get_singleton()->get("application/icon");
+ String appicon = GlobalConfig::get_singleton()->get("application/icon");
if (appicon!="" && appicon.ends_with(".png")) {
FileAccess*f = FileAccess::open(appicon,FileAccess::READ);
if (f) {
@@ -469,7 +469,7 @@ Error EditorExportPlatformBB10::export_project(const String& p_path, bool p_debu
ep.step("Creating BAR Package..",104);
- String bb_packager=EditorSettings::get_singleton()->get("blackberry/host_tools");
+ String bb_packager=EditorSettings::get_singleton()->get("export/blackberry/host_tools");
bb_packager=bb_packager.plus_file("blackberry-nativepackager");
if (OS::get_singleton()->get_name()=="Windows")
bb_packager+=".bat";
@@ -485,7 +485,7 @@ Error EditorExportPlatformBB10::export_project(const String& p_path, bool p_debu
args.push_back(p_path);
if (p_debug) {
- String debug_token=EditorSettings::get_singleton()->get("blackberry/debug_token");
+ String debug_token=EditorSettings::get_singleton()->get("export/blackberry/debug_token");
if (!FileAccess::exists(debug_token)) {
EditorNode::add_io_error("Debug token not found!");
} else {
@@ -554,7 +554,7 @@ void EditorExportPlatformBB10::_device_poll_thread(void *ud) {
while(!ea->quit_request) {
- String bb_deploy=EditorSettings::get_singleton()->get("blackberry/host_tools");
+ String bb_deploy=EditorSettings::get_singleton()->get("export/blackberry/host_tools");
bb_deploy=bb_deploy.plus_file("blackberry-deploy");
bool windows = OS::get_singleton()->get_name()=="Windows";
if (windows)
@@ -567,10 +567,10 @@ void EditorExportPlatformBB10::_device_poll_thread(void *ud) {
for (int i=0;i<MAX_DEVICES;i++) {
- String host = EditorSettings::get_singleton()->get("blackberry/device_"+itos(i+1)+"/host");
+ String host = EditorSettings::get_singleton()->get("export/blackberry/device_"+itos(i+1)+"/host");
if (host==String())
continue;
- String pass = EditorSettings::get_singleton()->get("blackberry/device_"+itos(i+1)+"/password");
+ String pass = EditorSettings::get_singleton()->get("export/blackberry/device_"+itos(i+1)+"/password");
if (pass==String())
continue;
@@ -661,7 +661,7 @@ Error EditorExportPlatformBB10::run(int p_device, int p_flags) {
ERR_FAIL_INDEX_V(p_device,devices.size(),ERR_INVALID_PARAMETER);
- String bb_deploy=EditorSettings::get_singleton()->get("blackberry/host_tools");
+ String bb_deploy=EditorSettings::get_singleton()->get("export/blackberry/host_tools");
bb_deploy=bb_deploy.plus_file("blackberry-deploy");
if (OS::get_singleton()->get_name()=="Windows")
bb_deploy+=".bat";
@@ -714,8 +714,8 @@ Error EditorExportPlatformBB10::run(int p_device, int p_flags) {
args.push_back("-installApp");
args.push_back("-launchApp");
args.push_back("-device");
- String host = EditorSettings::get_singleton()->get("blackberry/device_"+itos(p_device+1)+"/host");
- String pass = EditorSettings::get_singleton()->get("blackberry/device_"+itos(p_device+1)+"/password");
+ String host = EditorSettings::get_singleton()->get("export/blackberry/device_"+itos(p_device+1)+"/host");
+ String pass = EditorSettings::get_singleton()->get("export/blackberry/device_"+itos(p_device+1)+"/password");
args.push_back(host);
args.push_back("-password");
args.push_back(pass);
@@ -761,7 +761,7 @@ EditorExportPlatformBB10::EditorExportPlatformBB10() {
bool EditorExportPlatformBB10::can_export(String *r_error) const {
bool valid=true;
- String bb_deploy=EditorSettings::get_singleton()->get("blackberry/host_tools");
+ String bb_deploy=EditorSettings::get_singleton()->get("export/blackberry/host_tools");
String err;
if (!FileAccess::exists(bb_deploy.plus_file("blackberry-deploy"))) {
@@ -775,7 +775,7 @@ bool EditorExportPlatformBB10::can_export(String *r_error) const {
err+="No export template found.\nDownload and install export templates.\n";
}
- String debug_token=EditorSettings::get_singleton()->get("blackberry/debug_token");
+ String debug_token=EditorSettings::get_singleton()->get("export/blackberry/debug_token");
if (!FileAccess::exists(debug_token)) {
valid=false;
@@ -806,20 +806,20 @@ EditorExportPlatformBB10::~EditorExportPlatformBB10() {
void register_bb10_exporter() {
- EDITOR_DEF("blackberry/host_tools","");
- EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"blackberry/host_tools",PROPERTY_HINT_GLOBAL_DIR));
- EDITOR_DEF("blackberry/debug_token","");
- EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"blackberry/debug_token",PROPERTY_HINT_GLOBAL_FILE,"bar"));
- EDITOR_DEF("blackberry/device_1/host","");
- EDITOR_DEF("blackberry/device_1/password","");
- EDITOR_DEF("blackberry/device_2/host","");
- EDITOR_DEF("blackberry/device_2/password","");
- EDITOR_DEF("blackberry/device_3/host","");
- EDITOR_DEF("blackberry/device_3/password","");
- EDITOR_DEF("blackberry/device_4/host","");
- EDITOR_DEF("blackberry/device_4/password","");
- EDITOR_DEF("blackberry/device_5/host","");
- EDITOR_DEF("blackberry/device_5/password","");
+ EDITOR_DEF("export/blackberry/host_tools","");
+ EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"export/blackberry/host_tools",PROPERTY_HINT_GLOBAL_DIR));
+ EDITOR_DEF("export/blackberry/debug_token","");
+ EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"export/blackberry/debug_token",PROPERTY_HINT_GLOBAL_FILE,"bar"));
+ EDITOR_DEF("export/blackberry/device_1/host","");
+ EDITOR_DEF("export/blackberry/device_1/password","");
+ EDITOR_DEF("export/blackberry/device_2/host","");
+ EDITOR_DEF("export/blackberry/device_2/password","");
+ EDITOR_DEF("export/blackberry/device_3/host","");
+ EDITOR_DEF("export/blackberry/device_3/password","");
+ EDITOR_DEF("export/blackberry/device_4/host","");
+ EDITOR_DEF("export/blackberry/device_4/password","");
+ EDITOR_DEF("export/blackberry/device_5/host","");
+ EDITOR_DEF("export/blackberry/device_5/password","");
Ref<EditorExportPlatformBB10> exporter = Ref<EditorExportPlatformBB10>( memnew(EditorExportPlatformBB10) );
EditorImportExport::get_singleton()->add_export_platform(exporter);
diff --git a/platform/bb10/export/export.h b/platform/bb10/export/export.h
index bd9cad5cb3..d8407c4152 100644
--- a/platform/bb10/export/export.h
+++ b/platform/bb10/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/bb10/godot_bb10.cpp b/platform/bb10/godot_bb10.cpp
index cba9d200cb..4b8270b495 100644
--- a/platform/bb10/godot_bb10.cpp
+++ b/platform/bb10/godot_bb10.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/bb10/os_bb10.cpp b/platform/bb10/os_bb10.cpp
index 58ea26b8c9..c51f1c6092 100644
--- a/platform/bb10/os_bb10.cpp
+++ b/platform/bb10/os_bb10.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 */
@@ -31,22 +31,21 @@
#include "drivers/gles2/rasterizer_gles2.h"
#include "servers/visual/visual_server_raster.h"
#include "core/os/dir_access.h"
-
#include "core/globals.h"
#include "main/main.h"
#include "bbutil.h"
+#include "core/os/keyboard.h"
+
#include <stdlib.h>
#include <stdbool.h>
#include <assert.h>
-#include "core/os/keyboard.h"
-
-#include "bps/bps.h"
-#include "bps/screen.h"
-#include "bps/navigator.h"
-#include "bps/accelerometer.h"
-#include "bps/orientation.h"
-#include "bps/virtualkeyboard.h"
-#include "bps/audiodevice.h"
+#include <bps/bps.h>
+#include <bps/screen.h>
+#include <bps/navigator.h>
+#include <bps/accelerometer.h>
+#include <bps/orientation.h>
+#include <bps/virtualkeyboard.h>
+#include <bps/audiodevice.h>
#ifdef BB10_SCORELOOP_ENABLED
#include "modules/scoreloop/scoreloop_bb10.h"
@@ -141,18 +140,6 @@ void OSBB10::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
audio_driver->set_singleton();
audio_driver->init(NULL);
- sample_manager = memnew( SampleManagerMallocSW );
- audio_server = memnew( AudioServerSW(sample_manager) );
- audio_server->set_mixer_params(AudioMixerSW::INTERPOLATION_LINEAR,false);
- audio_server->init();
-
- spatial_sound_server = memnew( SpatialSoundServerSW );
- spatial_sound_server->init();
-
- spatial_sound_2d_server = memnew( SpatialSound2DServerSW );
- spatial_sound_2d_server->init();
-
- //
physics_server = memnew( PhysicsServerSW );
physics_server->init();
physics_2d_server = memnew( Physics2DServerSW );
@@ -185,19 +172,11 @@ void OSBB10::finalize() {
memdelete(main_loop);
main_loop=NULL;
- spatial_sound_server->finish();
- memdelete(spatial_sound_server);
- spatial_sound_2d_server->finish();
- memdelete(spatial_sound_2d_server);
-
- //if (debugger_connection_console) {
-// memdelete(debugger_connection_console);
-//}
-
- memdelete(sample_manager);
-
- audio_server->finish();
- memdelete(audio_server);
+ /*
+ if (debugger_connection_console) {
+ memdelete(debugger_connection_console);
+ }
+ */
visual_server->finish();
memdelete(visual_server);
@@ -376,8 +355,8 @@ void OSBB10::handle_screen_event(bps_event_t *event) {
ievent.mouse_motion.x = ievent.mouse_motion.global_x = mpos.x;
ievent.mouse_motion.y = ievent.mouse_motion.global_y = mpos.y;
input->set_mouse_pos(Point2(ievent.mouse_motion.x,ievent.mouse_motion.y));
- ievent.mouse_motion.speed_x=input->get_mouse_speed().x;
- ievent.mouse_motion.speed_y=input->get_mouse_speed().y;
+ ievent.mouse_motion.speed_x=input->get_last_mouse_speed().x;
+ ievent.mouse_motion.speed_y=input->get_last_mouse_speed().y;
ievent.mouse_motion.relative_x = mrel.x;
ievent.mouse_motion.relative_y = mrel.y;
ievent.mouse_motion.button_mask = 1; // pressed
diff --git a/platform/bb10/os_bb10.h b/platform/bb10/os_bb10.h
index 4ee5af8323..9cf2091d49 100644
--- a/platform/bb10/os_bb10.h
+++ b/platform/bb10/os_bb10.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 */
@@ -34,9 +34,7 @@
#include "os/main_loop.h"
#include "main/input_default.h"
#include "servers/physics/physics_server_sw.h"
-#include "servers/spatial_sound/spatial_sound_server_sw.h"
-#include "servers/spatial_sound_2d/spatial_sound_2d_server_sw.h"
-#include "servers/audio/audio_server_sw.h"
+#include "servers/audio_server.h"
#include "servers/physics_2d/physics_2d_server_sw.h"
#include "servers/visual/rasterizer.h"
#include "audio_driver_bb10.h"
@@ -44,8 +42,7 @@
#include <screen/screen.h>
#include <sys/platform.h>
-#include "bps/event.h"
-
+#include <bps/event.h>
#include <stdint.h>
class OSBB10 : public OS_Unix {
@@ -58,11 +55,6 @@ class OSBB10 : public OS_Unix {
Rasterizer *rasterizer;
VisualServer *visual_server;
-// AudioDriverPSP audio_driver_psp;
- AudioServerSW *audio_server;
- SampleManagerMallocSW *sample_manager;
- SpatialSoundServerSW *spatial_sound_server;
- SpatialSound2DServerSW *spatial_sound_2d_server;
PhysicsServer *physics_server;
Physics2DServer *physics_2d_server;
AudioDriverBB10* audio_driver;
diff --git a/platform/bb10/payment_service.cpp b/platform/bb10/payment_service.cpp
index 77ec122b3b..3138dc2c1d 100644
--- a/platform/bb10/payment_service.cpp
+++ b/platform/bb10/payment_service.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 */
@@ -38,11 +38,11 @@ extern char* launch_dir_ptr;
void PaymentService::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("request_product_info"),&PaymentService::request_product_info);
- ObjectTypeDB::bind_method(_MD("purchase"),&PaymentService::purchase);
+ ClassDB::bind_method(_MD("request_product_info"),&PaymentService::request_product_info);
+ ClassDB::bind_method(_MD("purchase"),&PaymentService::purchase);
- ObjectTypeDB::bind_method(_MD("get_pending_event_count"),&PaymentService::get_pending_event_count);
- ObjectTypeDB::bind_method(_MD("pop_pending_event"),&PaymentService::pop_pending_event);
+ ClassDB::bind_method(_MD("get_pending_event_count"),&PaymentService::get_pending_event_count);
+ ClassDB::bind_method(_MD("pop_pending_event"),&PaymentService::pop_pending_event);
};
Error PaymentService::request_product_info(Variant p_params) {
diff --git a/platform/bb10/payment_service.h b/platform/bb10/payment_service.h
index 856b8df306..b31a954ef8 100644
--- a/platform/bb10/payment_service.h
+++ b/platform/bb10/payment_service.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 */
@@ -39,7 +39,7 @@
class PaymentService : public Object {
- OBJ_TYPE(PaymentService, Object);
+ GDCLASS(PaymentService, Object);
static void _bind_methods();
diff --git a/platform/bb10/platform_config.h b/platform/bb10/platform_config.h
index 143f16c1fa..cdef185ff0 100644
--- a/platform/bb10/platform_config.h
+++ b/platform/bb10/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/haiku/SCsub b/platform/haiku/SCsub
index b5a584baa4..d0c244a194 100644
--- a/platform/haiku/SCsub
+++ b/platform/haiku/SCsub
@@ -3,25 +3,26 @@
Import('env')
common_haiku = [
- 'os_haiku.cpp',
- 'context_gl_haiku.cpp',
- 'haiku_application.cpp',
- 'haiku_direct_window.cpp',
- 'haiku_gl_view.cpp',
- 'key_mapping_haiku.cpp',
- 'audio_driver_media_kit.cpp'
+ 'os_haiku.cpp',
+ 'context_gl_haiku.cpp',
+ 'haiku_application.cpp',
+ 'haiku_direct_window.cpp',
+ 'haiku_gl_view.cpp',
+ 'key_mapping_haiku.cpp',
+ 'audio_driver_media_kit.cpp'
]
target = env.Program(
- '#bin/godot',
- ['godot_haiku.cpp'] + common_haiku
+ '#bin/godot',
+ ['godot_haiku.cpp'] + common_haiku
)
command = env.Command('#bin/godot.rsrc', '#platform/haiku/godot.rdef',
- ['rc -o $TARGET $SOURCE'])
+ ['rc -o $TARGET $SOURCE'])
-def addResourcesAction(target = None, source = None, env = None):
- return env.Execute('xres -o ' + File(target)[0].path + ' bin/godot.rsrc')
+
+def addResourcesAction(target=None, source=None, env=None):
+ return env.Execute('xres -o ' + File(target)[0].path + ' bin/godot.rsrc')
env.AddPostAction(target, addResourcesAction)
env.Depends(target, command)
diff --git a/platform/haiku/audio_driver_media_kit.cpp b/platform/haiku/audio_driver_media_kit.cpp
index c7eed1c7cd..c6afe7a261 100644
--- a/platform/haiku/audio_driver_media_kit.cpp
+++ b/platform/haiku/audio_driver_media_kit.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 */
@@ -38,7 +38,7 @@ Error AudioDriverMediaKit::init() {
active = false;
mix_rate = 44100;
- output_format = OUTPUT_STEREO;
+ speaker_mode = SPEAKER_MODE_STEREO;
channels = 2;
int latency = GLOBAL_DEF("audio/output_latency", 25);
@@ -99,8 +99,8 @@ int AudioDriverMediaKit::get_mix_rate() const {
return mix_rate;
}
-AudioDriverSW::OutputFormat AudioDriverMediaKit::get_output_format() const {
- return output_format;
+AudioDriverSW::SpeakerMode AudioDriverMediaKit::get_speaker_mode() const {
+ return speaker_mode;
}
void AudioDriverMediaKit::lock() {
diff --git a/platform/haiku/audio_driver_media_kit.h b/platform/haiku/audio_driver_media_kit.h
index cdaf602831..ce760f8dd7 100644
--- a/platform/haiku/audio_driver_media_kit.h
+++ b/platform/haiku/audio_driver_media_kit.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 */
@@ -26,7 +26,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "servers/audio/audio_server_sw.h"
+#include "servers/audio_server.h"
#ifdef MEDIA_KIT_ENABLED
@@ -36,7 +36,7 @@
#include <kernel/image.h> // needed for image_id
#include <SoundPlayer.h>
-class AudioDriverMediaKit : public AudioDriverSW {
+class AudioDriverMediaKit : public AudioDriver {
Mutex* mutex;
BSoundPlayer* player;
@@ -45,7 +45,7 @@ class AudioDriverMediaKit : public AudioDriverSW {
static void PlayBuffer(void* cookie, void* buffer, size_t size, const media_raw_audio_format& format);
unsigned int mix_rate;
- OutputFormat output_format;
+ SpeakerMode speaker_mode;
unsigned int buffer_size;
int channels;
@@ -60,7 +60,7 @@ public:
virtual Error init();
virtual void start();
virtual int get_mix_rate() const;
- virtual OutputFormat get_output_format() const;
+ virtual SpeakerMode get_speaker_mode() const;
virtual void lock();
virtual void unlock();
virtual void finish();
diff --git a/platform/haiku/context_gl_haiku.cpp b/platform/haiku/context_gl_haiku.cpp
index bf890d14bf..c43e3f3928 100644
--- a/platform/haiku/context_gl_haiku.cpp
+++ b/platform/haiku/context_gl_haiku.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/haiku/context_gl_haiku.h b/platform/haiku/context_gl_haiku.h
index c7f80543aa..1fd62e89ba 100644
--- a/platform/haiku/context_gl_haiku.h
+++ b/platform/haiku/context_gl_haiku.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/haiku/detect.py b/platform/haiku/detect.py
index af997a5737..71202a9a49 100644
--- a/platform/haiku/detect.py
+++ b/platform/haiku/detect.py
@@ -1,61 +1,67 @@
import os
import sys
+
def is_active():
- return True
+ return True
+
def get_name():
- return "Haiku"
+ return "Haiku"
+
def can_build():
- if (os.name != "posix"):
- return False
+ if (os.name != "posix"):
+ return False
- if (sys.platform == "darwin"):
- return False
+ if (sys.platform == "darwin"):
+ return False
+
+ return True
- return True
def get_opts():
- return [
- ('debug_release', 'Add debug symbols to release version','no')
- ]
+ return [
+ ('debug_release', 'Add debug symbols to release version', 'no')
+ ]
+
def get_flags():
- return [
- ]
+ return [
+ ]
+
def configure(env):
- is64 = sys.maxsize > 2**32
-
- if (env["bits"]=="default"):
- if (is64):
- env["bits"]="64"
- else:
- env["bits"]="32"
-
- env.Append(CPPPATH = ['#platform/haiku'])
-
- env["CC"] = "gcc-x86"
- env["CXX"] = "g++-x86"
-
- if (env["target"]=="release"):
- if (env["debug_release"]=="yes"):
- env.Append(CCFLAGS=['-g2'])
- else:
- env.Append(CCFLAGS=['-O3','-ffast-math'])
- elif (env["target"]=="release_debug"):
- env.Append(CCFLAGS=['-O2','-ffast-math','-DDEBUG_ENABLED'])
- elif (env["target"]=="debug"):
- env.Append(CCFLAGS=['-g2', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
-
- #env.Append(CCFLAGS=['-DFREETYPE_ENABLED'])
- env.Append(CPPFLAGS = ['-DPTHREAD_NO_RENAME']) # TODO: enable when we have pthread_setname_np
- env.Append(CPPFLAGS = ['-DOPENGL_ENABLED', '-DMEDIA_KIT_ENABLED'])
- env.Append(CPPFLAGS = ['-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DGLES_OVER_GL'])
- env.Append(LIBS = ['be', 'game', 'media', 'network', 'bnetapi', 'z', 'GL'])
-
- 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')})
+ is64 = sys.maxsize > 2**32
+
+ if (env["bits"] == "default"):
+ if (is64):
+ env["bits"] = "64"
+ else:
+ env["bits"] = "32"
+
+ env.Append(CPPPATH=['#platform/haiku'])
+
+ env["CC"] = "gcc-x86"
+ env["CXX"] = "g++-x86"
+
+ if (env["target"] == "release"):
+ if (env["debug_release"] == "yes"):
+ env.Append(CCFLAGS=['-g2'])
+ else:
+ env.Append(CCFLAGS=['-O3', '-ffast-math'])
+ elif (env["target"] == "release_debug"):
+ env.Append(CCFLAGS=['-O2', '-ffast-math', '-DDEBUG_ENABLED'])
+ elif (env["target"] == "debug"):
+ env.Append(CCFLAGS=['-g2', '-Wall', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
+
+ # env.Append(CCFLAGS=['-DFREETYPE_ENABLED'])
+ env.Append(CPPFLAGS=['-DPTHREAD_NO_RENAME']) # TODO: enable when we have pthread_setname_np
+ env.Append(CPPFLAGS=['-DOPENGL_ENABLED', '-DMEDIA_KIT_ENABLED'])
+ env.Append(CPPFLAGS=['-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DGLES_OVER_GL'])
+ env.Append(LIBS=['be', 'game', 'media', 'network', 'bnetapi', 'z', 'GL'])
+
+ 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')})
diff --git a/platform/haiku/godot_haiku.cpp b/platform/haiku/godot_haiku.cpp
index 71c9d30239..fccfa4336f 100644
--- a/platform/haiku/godot_haiku.cpp
+++ b/platform/haiku/godot_haiku.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/haiku/haiku_application.cpp b/platform/haiku/haiku_application.cpp
index 2b9604f563..1f35c6f58e 100644
--- a/platform/haiku/haiku_application.cpp
+++ b/platform/haiku/haiku_application.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/haiku/haiku_application.h b/platform/haiku/haiku_application.h
index 74316b9b1f..d85e6e4829 100644
--- a/platform/haiku/haiku_application.h
+++ b/platform/haiku/haiku_application.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/haiku/haiku_direct_window.cpp b/platform/haiku/haiku_direct_window.cpp
index 583453af1e..e7ff65e3ba 100644
--- a/platform/haiku/haiku_direct_window.cpp
+++ b/platform/haiku/haiku_direct_window.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 */
@@ -145,10 +145,12 @@ void HaikuDirectWindow::HandleMouseButton(BMessage* message) {
last_buttons_state = buttons;
// TODO: implement the mouse_mode checks
- //if (mouse_mode == MOUSE_MODE_CAPTURED) {
- // event.xbutton.x=last_mouse_pos.x;
- // event.xbutton.y=last_mouse_pos.y;
- //}
+ /*
+ if (mouse_mode == MOUSE_MODE_CAPTURED) {
+ event.xbutton.x=last_mouse_pos.x;
+ event.xbutton.y=last_mouse_pos.y;
+ }
+ */
InputEvent mouse_event;
mouse_event.ID = ++event_id;
@@ -219,8 +221,8 @@ void HaikuDirectWindow::HandleMouseMoved(BMessage* message) {
input->set_mouse_pos(pos);
motion_event.mouse_motion.global_x = pos.x;
motion_event.mouse_motion.global_y = pos.y;
- motion_event.mouse_motion.speed_x = input->get_mouse_speed().x;
- motion_event.mouse_motion.speed_y = input->get_mouse_speed().y;
+ motion_event.mouse_motion.speed_x = input->get_last_mouse_speed().x;
+ motion_event.mouse_motion.speed_y = input->get_last_mouse_speed().y;
motion_event.mouse_motion.relative_x = rel.x;
motion_event.mouse_motion.relative_y = rel.y;
diff --git a/platform/haiku/haiku_direct_window.h b/platform/haiku/haiku_direct_window.h
index b4fdb6edb2..49785f79cb 100644
--- a/platform/haiku/haiku_direct_window.h
+++ b/platform/haiku/haiku_direct_window.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/haiku/haiku_gl_view.cpp b/platform/haiku/haiku_gl_view.cpp
index da0957c81d..66c143ea67 100644
--- a/platform/haiku/haiku_gl_view.cpp
+++ b/platform/haiku/haiku_gl_view.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/haiku/haiku_gl_view.h b/platform/haiku/haiku_gl_view.h
index 05c288e83b..6d64aab42e 100644
--- a/platform/haiku/haiku_gl_view.h
+++ b/platform/haiku/haiku_gl_view.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/haiku/key_mapping_haiku.cpp b/platform/haiku/key_mapping_haiku.cpp
index 43981b8855..f41a77c3fb 100644
--- a/platform/haiku/key_mapping_haiku.cpp
+++ b/platform/haiku/key_mapping_haiku.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/haiku/key_mapping_haiku.h b/platform/haiku/key_mapping_haiku.h
index 1309ee034d..81f5569fd0 100644
--- a/platform/haiku/key_mapping_haiku.h
+++ b/platform/haiku/key_mapping_haiku.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/haiku/os_haiku.cpp b/platform/haiku/os_haiku.cpp
index f5674fb0eb..9f218aeff4 100644
--- a/platform/haiku/os_haiku.cpp
+++ b/platform/haiku/os_haiku.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 */
@@ -40,7 +40,7 @@
OS_Haiku::OS_Haiku() {
#ifdef MEDIA_KIT_ENABLED
- AudioDriverManagerSW::add_driver(&driver_media_kit);
+ AudioDriverManager::add_driver(&driver_media_kit);
#endif
};
@@ -119,9 +119,11 @@ void OS_Haiku::initialize(const VideoMode& p_desired, int p_video_driver, int p_
ERR_FAIL_COND(!visual_server);
// TODO: enable multithreaded VS
- //if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
- // visual_server = memnew(VisualServerWrapMT(visual_server, get_render_thread_mode() == RENDER_SEPARATE_THREAD));
- //}
+ /*
+ if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
+ visual_server = memnew(VisualServerWrapMT(visual_server, get_render_thread_mode() == RENDER_SEPARATE_THREAD));
+ }
+ */
input = memnew(InputDefault);
window->SetInput(input);
@@ -136,20 +138,11 @@ void OS_Haiku::initialize(const VideoMode& p_desired, int p_video_driver, int p_
//physics_2d_server = Physics2DServerWrapMT::init_server<Physics2DServerSW>();
physics_2d_server->init();
- AudioDriverManagerSW::get_driver(p_audio_driver)->set_singleton();
+ AudioDriverManager::get_driver(p_audio_driver)->set_singleton();
- if (AudioDriverManagerSW::get_driver(p_audio_driver)->init() != OK) {
+ if (AudioDriverManager::get_driver(p_audio_driver)->init() != OK) {
ERR_PRINT("Initializing audio failed.");
}
-
- sample_manager = memnew(SampleManagerMallocSW);
- audio_server = memnew(AudioServerSW(sample_manager));
- audio_server->init();
-
- spatial_sound_server = memnew(SpatialSoundServerSW);
- spatial_sound_server->init();
- spatial_sound_2d_server = memnew(SpatialSound2DServerSW);
- spatial_sound_2d_server->init();
}
void OS_Haiku::finalize() {
@@ -159,17 +152,6 @@ void OS_Haiku::finalize() {
main_loop = NULL;
- spatial_sound_server->finish();
- memdelete(spatial_sound_server);
-
- spatial_sound_2d_server->finish();
- memdelete(spatial_sound_2d_server);
-
- memdelete(sample_manager);
-
- audio_server->finish();
- memdelete(audio_server);
-
visual_server->finish();
memdelete(visual_server);
memdelete(rasterizer);
diff --git a/platform/haiku/os_haiku.h b/platform/haiku/os_haiku.h
index e1d6b5b7b9..531c7a56c3 100644
--- a/platform/haiku/os_haiku.h
+++ b/platform/haiku/os_haiku.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 */
@@ -34,12 +34,8 @@
#include "servers/visual/rasterizer.h"
#include "servers/physics_server.h"
#include "servers/physics_2d/physics_2d_server_sw.h"
-#include "servers/audio/audio_server_sw.h"
-#include "servers/audio/sample_manager_sw.h"
-#include "servers/spatial_sound/spatial_sound_server_sw.h"
-#include "servers/spatial_sound_2d/spatial_sound_2d_server_sw.h"
+#include "servers/audio_server.h"
#include "main/input_default.h"
-
#include "audio_driver_media_kit.h"
#include "context_gl_haiku.h"
#include "haiku_application.h"
@@ -57,10 +53,6 @@ private:
VideoMode current_video_mode;
PhysicsServer* physics_server;
Physics2DServer* physics_2d_server;
- AudioServerSW* audio_server;
- SampleManagerMallocSW* sample_manager;
- SpatialSoundServerSW* spatial_sound_server;
- SpatialSound2DServerSW* spatial_sound_2d_server;
#ifdef MEDIA_KIT_ENABLED
AudioDriverMediaKit driver_media_kit;
diff --git a/platform/haiku/platform_config.h b/platform/haiku/platform_config.h
index 72dc0e5149..a3aa918ba8 100644
--- a/platform/haiku/platform_config.h
+++ b/platform/haiku/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 */
@@ -31,4 +31,4 @@
// for ifaddrs.h needed in drivers/unix/ip_unix.cpp
#define _BSD_SOURCE 1
-#define GLES2_INCLUDE_H <GL/glew.h>
+#define GLES3_INCLUDE_H "glad/glad.h"
diff --git a/platform/iphone/SCsub b/platform/iphone/SCsub
index 236630bef4..38f789259c 100644
--- a/platform/iphone/SCsub
+++ b/platform/iphone/SCsub
@@ -4,33 +4,33 @@ Import('env')
iphone_lib = [
- 'os_iphone.cpp',
- #'rasterizer_iphone.cpp',
- 'audio_driver_iphone.cpp',
- 'sem_iphone.cpp',
- 'gl_view.mm',
- 'main.m',
- 'app_delegate.mm',
- 'view_controller.mm',
- 'game_center.mm',
- 'in_app_store.mm',
- 'icloud.mm',
- #'Appirater.m',
- 'ios.mm',
+ 'os_iphone.cpp',
+ #'rasterizer_iphone.cpp',
+ 'audio_driver_iphone.cpp',
+ 'sem_iphone.cpp',
+ 'gl_view.mm',
+ 'main.m',
+ 'app_delegate.mm',
+ 'view_controller.mm',
+ 'game_center.mm',
+ 'in_app_store.mm',
+ 'icloud.mm',
+ #'Appirater.m',
+ 'ios.mm',
]
-#env.Depends('#core/math/vector3.h', 'vector3_psp.h')
+# env.Depends('#core/math/vector3.h', 'vector3_psp.h')
#iphone_lib = env.Library('iphone', iphone_lib)
-env_ios = env.Clone();
+env_ios = env.Clone()
if env['ios_gles22_override'] == "yes":
- env_ios.Append(CPPFLAGS=['-DGLES2_OVERRIDE'])
+ env_ios.Append(CPPFLAGS=['-DGLES2_OVERRIDE'])
-#if env['ios_appirater'] == "yes":
+# if env['ios_appirater'] == "yes":
# env_ios.Append(CPPFLAGS=['-DAPPIRATER_ENABLED'])
@@ -38,5 +38,5 @@ obj = env_ios.Object('godot_iphone.cpp')
prog = None
prog = env_ios.Program('#bin/godot', [obj] + iphone_lib)
-action = "$IPHONEPATH/usr/bin/dsymutil "+File(prog)[0].path+" -o " + File(prog)[0].path + ".dSYM"
+action = "$IPHONEPATH/usr/bin/dsymutil " + File(prog)[0].path + " -o " + File(prog)[0].path + ".dSYM"
env.AddPostAction(prog, action)
diff --git a/platform/iphone/app_delegate.h b/platform/iphone/app_delegate.h
index 54bfe78cf7..1b2ca42ab6 100644
--- a/platform/iphone/app_delegate.h
+++ b/platform/iphone/app_delegate.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 */
@@ -30,11 +30,11 @@
#import "gl_view.h"
#import "view_controller.h"
-@interface AppDelegate : NSObject <UIApplicationDelegate, UIAccelerometerDelegate, GLViewDelegate> {
+#import <CoreMotion/CoreMotion.h>
+
+@interface AppDelegate : NSObject <UIApplicationDelegate, GLViewDelegate> {
//@property (strong, nonatomic) UIWindow *window;
ViewController* view_controller;
- UIAccelerationValue accel[3];
- UIAccelerationValue last_accel[3];
};
@property (strong, nonatomic) UIWindow *window;
diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm
index dab75e08c8..740f1d7edc 100644
--- a/platform/iphone/app_delegate.mm
+++ b/platform/iphone/app_delegate.mm
@@ -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 */
@@ -84,6 +84,9 @@ extern char** gargv;
extern int iphone_main(int, int, int, char**);
extern void iphone_finish();
+CMMotionManager *motionManager;
+bool motionInitialised;
+
static ViewController* mainViewController = nil;
+ (ViewController*) getViewController
{
@@ -162,14 +165,14 @@ static int frame_count = 0;
NSString* str = (NSString*)value;
String uval = String::utf8([str UTF8String]);
- Globals::get_singleton()->set("Info.plist/"+ukey, uval);
+ GlobalConfig::get_singleton()->set("Info.plist/"+ukey, uval);
} else if ([value isKindOfClass:[NSNumber class]]) {
NSNumber* n = (NSNumber*)value;
double dval = [n doubleValue];
- Globals::get_singleton()->set("Info.plist/"+ukey, dval);
+ GlobalConfig::get_singleton()->set("Info.plist/"+ukey, dval);
};
// do stuff
}
@@ -186,16 +189,65 @@ static int frame_count = 0;
++frame_count;
#ifdef APPIRATER_ENABLED
- int aid = Globals::get_singleton()->get("ios/app_id");
+ int aid = GlobalConfig::get_singleton()->get("ios/app_id");
[Appirater appLaunched:YES app_id:aid];
#endif
}; break; // no fallthrough
default: {
-
if (OSIPhone::get_singleton()) {
- OSIPhone::get_singleton()->update_accelerometer(accel[0], accel[1], accel[2]);
+// OSIPhone::get_singleton()->update_accelerometer(accel[0], accel[1], accel[2]);
+ if (motionInitialised) {
+ // Just using polling approach for now, we can set this up so it sends data to us in intervals, might be better.
+ // See Apple reference pages for more details:
+ // https://developer.apple.com/reference/coremotion/cmmotionmanager?language=objc
+
+ // Apple splits our accelerometer date into a gravity and user movement component. We add them back together
+ CMAcceleration gravity = motionManager.deviceMotion.gravity;
+ CMAcceleration acceleration = motionManager.deviceMotion.userAcceleration;
+
+ ///@TODO We don't seem to be getting data here, is my device broken or is this code incorrect?
+ CMMagneticField magnetic = motionManager.deviceMotion.magneticField.field;
+
+ ///@TODO we can access rotationRate as a CMRotationRate variable (processed date) or CMGyroData (raw data), have to see what works best
+ CMRotationRate rotation = motionManager.deviceMotion.rotationRate;
+
+ // Adjust for screen orientation.
+ // [[UIDevice currentDevice] orientation] changes even if we've fixed our orientation which is not
+ // a good thing when you're trying to get your user to move the screen in all directions and want consistent output
+
+ ///@TODO Using [[UIApplication sharedApplication] statusBarOrientation] is a bit of a hack. Godot obviously knows the orientation so maybe we
+ // can use that instead? (note that left and right seem swapped)
+
+ switch ([[UIApplication sharedApplication] statusBarOrientation]) {
+ case UIDeviceOrientationLandscapeLeft: {
+ OSIPhone::get_singleton()->update_gravity(-gravity.y, gravity.x, gravity.z);
+ OSIPhone::get_singleton()->update_accelerometer(-(acceleration.y + gravity.y), (acceleration.x + gravity.x), acceleration.z + gravity.z);
+ OSIPhone::get_singleton()->update_magnetometer(-magnetic.y, magnetic.x, magnetic.z);
+ OSIPhone::get_singleton()->update_gyroscope(-rotation.y, rotation.x, rotation.z);
+ }; break;
+ case UIDeviceOrientationLandscapeRight: {
+ OSIPhone::get_singleton()->update_gravity(gravity.y, -gravity.x, gravity.z);
+ OSIPhone::get_singleton()->update_accelerometer((acceleration.y + gravity.y), -(acceleration.x + gravity.x), acceleration.z + gravity.z);
+ OSIPhone::get_singleton()->update_magnetometer(magnetic.y, -magnetic.x, magnetic.z);
+ OSIPhone::get_singleton()->update_gyroscope(rotation.y, -rotation.x, rotation.z);
+ }; break;
+ case UIDeviceOrientationPortraitUpsideDown: {
+ OSIPhone::get_singleton()->update_gravity(-gravity.x, gravity.y, gravity.z);
+ OSIPhone::get_singleton()->update_accelerometer(-(acceleration.x + gravity.x), (acceleration.y + gravity.y), acceleration.z + gravity.z);
+ OSIPhone::get_singleton()->update_magnetometer(-magnetic.x, magnetic.y, magnetic.z);
+ OSIPhone::get_singleton()->update_gyroscope(-rotation.x, rotation.y, rotation.z);
+ }; break;
+ default: { // assume portrait
+ OSIPhone::get_singleton()->update_gravity(gravity.x, gravity.y, gravity.z);
+ OSIPhone::get_singleton()->update_accelerometer(acceleration.x + gravity.x, acceleration.y + gravity.y, acceleration.z + gravity.z);
+ OSIPhone::get_singleton()->update_magnetometer(magnetic.x, magnetic.y, magnetic.z);
+ OSIPhone::get_singleton()->update_gyroscope(rotation.x, rotation.y, rotation.z);
+ }; break;
+ };
+ }
+
bool quit_request = OSIPhone::get_singleton()->iterate();
};
@@ -232,12 +284,12 @@ static int frame_count = 0;
//glView.autoresizesSubviews = YES;
//[glView setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleWidth];
- int backingWidth;
- int backingHeight;
- glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
- glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);
+ int backingWidth;
+ int backingHeight;
+ glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
+ glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);
- iphone_main(backingWidth, backingHeight, gargc, gargv);
+ iphone_main(backingWidth, backingHeight, gargc, gargv);
view_controller = [[ViewController alloc] init];
view_controller.view = glView;
@@ -253,11 +305,14 @@ static int frame_count = 0;
[window makeKeyAndVisible];
//Configure and start accelerometer
- last_accel[0] = 0;
- last_accel[1] = 0;
- last_accel[2] = 0;
- [[UIAccelerometer sharedAccelerometer] setUpdateInterval:(1.0 / kAccelerometerFrequency)];
- [[UIAccelerometer sharedAccelerometer] setDelegate:self];
+ if (!motionInitialised) {
+ motionManager = [[CMMotionManager alloc] init];
+ if (motionManager.deviceMotionAvailable) {
+ motionManager.deviceMotionUpdateInterval = 1.0/70.0;
+ [motionManager startDeviceMotionUpdates];
+ motionInitialised = YES;
+ };
+ };
//OSIPhone::screen_width = rect.size.width - rect.origin.x;
//OSIPhone::screen_height = rect.size.height - rect.origin.y;
@@ -266,11 +321,11 @@ static int frame_count = 0;
#ifdef MODULE_GAME_ANALYTICS_ENABLED
printf("********************* didFinishLaunchingWithOptions\n");
- if(!Globals::get_singleton()->has("mobileapptracker/advertiser_id"))
+ if(!GlobalConfig::get_singleton()->has("mobileapptracker/advertiser_id"))
{
return;
}
- if(!Globals::get_singleton()->has("mobileapptracker/conversion_key"))
+ if(!GlobalConfig::get_singleton()->has("mobileapptracker/conversion_key"))
{
return;
}
@@ -297,12 +352,23 @@ static int frame_count = 0;
- (void)applicationWillTerminate:(UIApplication*)application {
printf("********************* will terminate\n");
+
+ if (motionInitialised) {
+ ///@TODO is this the right place to clean this up?
+ [motionManager stopDeviceMotionUpdates];
+ [motionManager release];
+ motionManager = nil;
+ motionInitialised = NO;
+ };
+
iphone_finish();
};
- (void)applicationDidEnterBackground:(UIApplication *)application
{
printf("********************* did enter background\n");
+ ///@TODO maybe add pause motionManager? and where would we unpause it?
+
if (OS::get_singleton()->get_main_loop())
OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT);
[view_controller.view stopAnimation];
@@ -340,13 +406,6 @@ static int frame_count = 0;
};
}
-- (void)accelerometer:(UIAccelerometer*)accelerometer didAccelerate:(UIAcceleration*)acceleration {
- //Use a basic low-pass filter to only keep the gravity in the accelerometer values
- accel[0] = acceleration.x; // * kFilteringFactor + accel[0] * (1.0 - kFilteringFactor);
- accel[1] = acceleration.y; // * kFilteringFactor + accel[1] * (1.0 - kFilteringFactor);
- accel[2] = acceleration.z; // * kFilteringFactor + accel[2] * (1.0 - kFilteringFactor);
-}
-
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
#ifdef MODULE_FACEBOOKSCORER_IOS_ENABLED
return [[[FacebookScorer sharedInstance] facebook] handleOpenURL:url];
diff --git a/platform/iphone/audio_driver_iphone.cpp b/platform/iphone/audio_driver_iphone.cpp
index 0916c31f36..eda3897841 100644
--- a/platform/iphone/audio_driver_iphone.cpp
+++ b/platform/iphone/audio_driver_iphone.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 */
@@ -155,8 +155,8 @@ int AudioDriverIphone::get_mix_rate() const {
return 44100;
};
-AudioDriverSW::OutputFormat AudioDriverIphone::get_output_format() const {
- return OUTPUT_STEREO;
+AudioDriver::SpeakerMode AudioDriverIphone::get_speaker_mode() const {
+ return SPEAKER_MODE_STEREO;
};
void AudioDriverIphone::lock() {
diff --git a/platform/iphone/audio_driver_iphone.h b/platform/iphone/audio_driver_iphone.h
index 0b143adf94..4c0cbfcb22 100644
--- a/platform/iphone/audio_driver_iphone.h
+++ b/platform/iphone/audio_driver_iphone.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 */
@@ -26,11 +26,12 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "servers/audio/audio_server_sw.h"
+
+#include "servers/audio_server.h"
#include <AudioUnit/AudioUnit.h>
-class AudioDriverIphone : public AudioDriverSW {
+class AudioDriverIphone : public AudioDriver {
AudioComponentInstance audio_unit;
bool active;
@@ -56,7 +57,7 @@ public:
virtual Error init();
virtual void start();
virtual int get_mix_rate() const;
- virtual OutputFormat get_output_format() const;
+ virtual SpeakerMode get_speaker_mode() const;
virtual void lock();
virtual void unlock();
virtual void finish();
diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py
index 1be63891b1..20fa45d708 100644
--- a/platform/iphone/detect.py
+++ b/platform/iphone/detect.py
@@ -3,187 +3,190 @@ import sys
def is_active():
- return True
+ return True
+
def get_name():
- return "iOS"
+ return "iOS"
+
def can_build():
- import sys
- import os
- if sys.platform == 'darwin' or os.environ.has_key("OSXCROSS_IOS"):
- return True
+ import sys
+ import os
+ if sys.platform == 'darwin' or os.environ.has_key("OSXCROSS_IOS"):
+ return True
+
+ return False
- return False
def get_opts():
- return [
- ('IPHONEPLATFORM', 'name of the iphone platform', 'iPhoneOS'),
- ('IPHONEPATH', 'the path to iphone toolchain', '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain'),
- ('IPHONESDK', 'path to the iphone SDK', '/Applications/Xcode.app/Contents/Developer/Platforms/${IPHONEPLATFORM}.platform/Developer/SDKs/${IPHONEPLATFORM}.sdk/'),
- ('game_center', 'Support for game center', 'yes'),
- ('store_kit', 'Support for in-app store', 'yes'),
- ('icloud', 'Support for iCloud', 'yes'),
- ('ios_gles22_override', 'Force GLES2.0 on iOS', 'yes'),
- ('ios_appirater', 'Enable Appirater', 'no'),
- ('ios_exceptions', 'Use exceptions when compiling on playbook', 'yes'),
- ('ios_triple', 'Triple for ios toolchain', ''),
- ('ios_sim', 'Build simulator binary', 'no'),
- ]
+ return [
+ ('IPHONEPLATFORM', 'name of the iphone platform', 'iPhoneOS'),
+ ('IPHONEPATH', 'the path to iphone toolchain', '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain'),
+ ('IPHONESDK', 'path to the iphone SDK', '/Applications/Xcode.app/Contents/Developer/Platforms/${IPHONEPLATFORM}.platform/Developer/SDKs/${IPHONEPLATFORM}.sdk/'),
+ ('game_center', 'Support for game center', 'yes'),
+ ('store_kit', 'Support for in-app store', 'yes'),
+ ('icloud', 'Support for iCloud', 'yes'),
+ ('ios_gles22_override', 'Force GLES2.0 on iOS', 'yes'),
+ ('ios_appirater', 'Enable Appirater', 'no'),
+ ('ios_exceptions', 'Use exceptions when compiling on playbook', 'yes'),
+ ('ios_triple', 'Triple for ios toolchain', ''),
+ ('ios_sim', 'Build simulator binary', 'no'),
+ ]
-def get_flags():
- return [
- ('tools', 'no'),
- ('webp', 'yes'),
- ('builtin_zlib', 'yes'),
- ('openssl','builtin'), #use builtin openssl
- ]
+def get_flags():
+ return [
+ ('tools', 'no'),
+ ]
def configure(env):
- env.Append(CPPPATH=['#platform/iphone'])
-
- env['ENV']['PATH'] = env['IPHONEPATH']+"/Developer/usr/bin/:"+env['ENV']['PATH']
-
- env['CC'] = '$IPHONEPATH/usr/bin/${ios_triple}clang'
- env['CXX'] = '$IPHONEPATH/usr/bin/${ios_triple}clang++'
- env['AR'] = '$IPHONEPATH/usr/bin/${ios_triple}ar'
- env['RANLIB'] = '$IPHONEPATH/usr/bin/${ios_triple}ranlib'
-
- import string
- if (env["ios_sim"]=="yes" or env["arch"] == "x86"): # i386, simulator
- env["arch"]="x86"
- env["bits"]="32"
- env['CCFLAGS'] = string.split('-arch i386 -fobjc-abi-version=2 -fobjc-legacy-dispatch -fmessage-length=0 -fpascal-strings -fasm-blocks -Wall -D__IPHONE_OS_VERSION_MIN_REQUIRED=40100 -isysroot $IPHONESDK -mios-simulator-version-min=4.3 -DCUSTOM_MATRIX_TRANSFORM_H=\\\"build/iphone/matrix4_iphone.h\\\" -DCUSTOM_VECTOR3_TRANSFORM_H=\\\"build/iphone/vector3_iphone.h\\\"')
- elif (env["arch"]=="arm64"): # arm64
- env["bits"] = "64"
- env['CCFLAGS'] = string.split('-fno-objc-arc -arch arm64 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -fvisibility=hidden -Wno-sign-conversion -MMD -MT dependencies -miphoneos-version-min=5.1.1 -isysroot $IPHONESDK')
- env.Append(CPPFLAGS=['-DNEED_LONG_INT'])
- env.Append(CPPFLAGS=['-DLIBYUV_DISABLE_NEON'])
- else: # armv7
- env["arch"] = "arm"
- env["bits"] = "32"
- env['CCFLAGS'] = string.split('-fno-objc-arc -arch armv7 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -fvisibility=hidden -Wno-sign-conversion -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=5.1.1 -MMD -MT dependencies -isysroot $IPHONESDK')
-
- if (env["arch"]=="x86"):
- env['IPHONEPLATFORM'] = 'iPhoneSimulator'
- env.Append(LINKFLAGS=['-arch', 'i386', '-mios-simulator-version-min=4.3',
- '-isysroot', '$IPHONESDK',
- #'-mmacosx-version-min=10.6',
- '-Xlinker',
- '-objc_abi_version',
- '-Xlinker', '2',
- '-framework', 'AudioToolbox',
- '-framework', 'AVFoundation',
- '-framework', 'CoreAudio',
- '-framework', 'CoreGraphics',
- '-framework', 'CoreMedia',
- '-framework', 'Foundation',
- '-framework', 'Security',
- '-framework', 'UIKit',
- '-framework', 'MediaPlayer',
- '-framework', 'OpenGLES',
- '-framework', 'QuartzCore',
- '-framework', 'SystemConfiguration',
- '-F$IPHONESDK',
- ])
- elif (env["arch"]=="arm64"):
- env.Append(LINKFLAGS=['-arch', 'arm64', '-Wl,-dead_strip', '-miphoneos-version-min=5.1.1',
- '-isysroot', '$IPHONESDK',
- #'-stdlib=libc++',
- '-framework', 'Foundation',
- '-framework', 'UIKit',
- '-framework', 'CoreGraphics',
- '-framework', 'OpenGLES',
- '-framework', 'QuartzCore',
- '-framework', 'CoreAudio',
- '-framework', 'AudioToolbox',
- '-framework', 'SystemConfiguration',
- '-framework', 'Security',
- #'-framework', 'AdSupport',
- '-framework', 'MediaPlayer',
- '-framework', 'AVFoundation',
- '-framework', 'CoreMedia',
- ])
- else:
- env.Append(LINKFLAGS=['-arch', 'armv7', '-Wl,-dead_strip', '-miphoneos-version-min=5.1.1',
- '-isysroot', '$IPHONESDK',
- '-framework', 'Foundation',
- '-framework', 'UIKit',
- '-framework', 'CoreGraphics',
- '-framework', 'OpenGLES',
- '-framework', 'QuartzCore',
- '-framework', 'CoreAudio',
- '-framework', 'AudioToolbox',
- '-framework', 'SystemConfiguration',
- '-framework', 'Security',
- #'-framework', 'AdSupport',
- '-framework', 'MediaPlayer',
- '-framework', 'AVFoundation',
- '-framework', 'CoreMedia',
- ])
-
- if env['game_center'] == 'yes':
- env.Append(CPPFLAGS=['-fblocks', '-DGAME_CENTER_ENABLED'])
- env.Append(LINKFLAGS=['-framework', 'GameKit'])
-
- if env['store_kit'] == 'yes':
- env.Append(CPPFLAGS=['-DSTOREKIT_ENABLED'])
- env.Append(LINKFLAGS=['-framework', 'StoreKit'])
-
- if env['icloud'] == 'yes':
- env.Append(CPPFLAGS=['-DICLOUD_ENABLED'])
-
- env.Append(CPPPATH = ['$IPHONESDK/usr/include', '$IPHONESDK/System/Library/Frameworks/OpenGLES.framework/Headers', '$IPHONESDK/System/Library/Frameworks/AudioUnit.framework/Headers'])
-
- if (env["target"]=="release"):
-
- env.Append(CCFLAGS=['-O3', '-DNS_BLOCK_ASSERTIONS=1','-Wall', '-gdwarf-2']) # removed -ffast-math
- env.Append(LINKFLAGS=['-O3']) #
-
- elif env["target"] == "release_debug":
- env.Append(CCFLAGS=['-Os', '-DNS_BLOCK_ASSERTIONS=1','-Wall','-DDEBUG_ENABLED'])
- env.Append(LINKFLAGS=['-Os'])
- env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ENABLED'])
-
- elif (env["target"]=="debug"):
-
- env.Append(CCFLAGS=['-D_DEBUG', '-DDEBUG=1', '-gdwarf-2', '-Wall', '-O0', '-DDEBUG_ENABLED'])
- env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ENABLED'])
-
- elif (env["target"]=="profile"):
-
- env.Append(CCFLAGS=['-g','-pg', '-Os'])
- env.Append(LINKFLAGS=['-pg'])
-
- if (env["ios_sim"]=="yes"): #TODO: Check if needed?
- env['ENV']['MACOSX_DEPLOYMENT_TARGET'] = '10.6'
- env['ENV']['CODESIGN_ALLOCATE'] = '/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate'
- env.Append(CPPFLAGS=['-DIPHONE_ENABLED', '-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DMPC_FIXED_POINT'])
-
- # TODO: Move that to opus module's config
- if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"):
- env.opus_fixed_point="yes"
- if env["arch"]=="x86":
- pass
- elif(env["arch"]=="arm64"):
- env.Append(CFLAGS=["-DOPUS_ARM64_OPT"])
- else:
- env.Append(CFLAGS=["-DOPUS_ARM_OPT"])
-
- if env['ios_exceptions'] == 'yes':
- env.Append(CPPFLAGS=['-fexceptions'])
- else:
- env.Append(CPPFLAGS=['-fno-exceptions'])
- #env['neon_enabled']=True
- env['S_compiler'] = '$IPHONEPATH/Developer/usr/bin/gcc'
-
- 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.Append(CPPPATH=['#platform/iphone'])
+
+ env['ENV']['PATH'] = env['IPHONEPATH'] + "/Developer/usr/bin/:" + env['ENV']['PATH']
+
+ env['CC'] = '$IPHONEPATH/usr/bin/${ios_triple}clang'
+ env['CXX'] = '$IPHONEPATH/usr/bin/${ios_triple}clang++'
+ env['AR'] = '$IPHONEPATH/usr/bin/${ios_triple}ar'
+ env['RANLIB'] = '$IPHONEPATH/usr/bin/${ios_triple}ranlib'
+
+ import string
+ if (env["ios_sim"] == "yes" or env["arch"] == "x86"): # i386, simulator
+ env["arch"] = "x86"
+ env["bits"] = "32"
+ env['CCFLAGS'] = string.split('-arch i386 -fobjc-abi-version=2 -fobjc-legacy-dispatch -fmessage-length=0 -fpascal-strings -fasm-blocks -Wall -D__IPHONE_OS_VERSION_MIN_REQUIRED=40100 -isysroot $IPHONESDK -mios-simulator-version-min=4.3 -DCUSTOM_MATRIX_TRANSFORM_H=\\\"build/iphone/matrix4_iphone.h\\\" -DCUSTOM_VECTOR3_TRANSFORM_H=\\\"build/iphone/vector3_iphone.h\\\"')
+ elif (env["arch"] == "arm64"): # arm64
+ env["bits"] = "64"
+ env['CCFLAGS'] = string.split('-fno-objc-arc -arch arm64 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -fvisibility=hidden -Wno-sign-conversion -MMD -MT dependencies -miphoneos-version-min=7.0 -isysroot $IPHONESDK')
+ env.Append(CPPFLAGS=['-DNEED_LONG_INT'])
+ env.Append(CPPFLAGS=['-DLIBYUV_DISABLE_NEON'])
+ else: # armv7
+ env["arch"] = "arm"
+ env["bits"] = "32"
+ env['CCFLAGS'] = string.split('-fno-objc-arc -arch armv7 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -Wmissing-prototypes -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -isysroot $IPHONESDK -fvisibility=hidden -Wno-sign-conversion -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=7.0 -MMD -MT dependencies -isysroot $IPHONESDK')
+
+ if (env["arch"] == "x86"):
+ env['IPHONEPLATFORM'] = 'iPhoneSimulator'
+ env.Append(LINKFLAGS=['-arch', 'i386', '-mios-simulator-version-min=4.3',
+ '-isysroot', '$IPHONESDK',
+ #'-mmacosx-version-min=10.6',
+ '-Xlinker',
+ '-objc_abi_version',
+ '-Xlinker', '2',
+ '-framework', 'AudioToolbox',
+ '-framework', 'AVFoundation',
+ '-framework', 'CoreAudio',
+ '-framework', 'CoreGraphics',
+ '-framework', 'CoreMedia',
+ '-framework', 'CoreMotion',
+ '-framework', 'Foundation',
+ '-framework', 'Security',
+ '-framework', 'UIKit',
+ '-framework', 'MediaPlayer',
+ '-framework', 'OpenGLES',
+ '-framework', 'QuartzCore',
+ '-framework', 'SystemConfiguration',
+ '-F$IPHONESDK',
+ ])
+ elif (env["arch"] == "arm64"):
+ env.Append(LINKFLAGS=['-arch', 'arm64', '-Wl,-dead_strip', '-miphoneos-version-min=7.0',
+ '-isysroot', '$IPHONESDK',
+ #'-stdlib=libc++',
+ '-framework', 'Foundation',
+ '-framework', 'UIKit',
+ '-framework', 'CoreGraphics',
+ '-framework', 'OpenGLES',
+ '-framework', 'QuartzCore',
+ '-framework', 'CoreAudio',
+ '-framework', 'AudioToolbox',
+ '-framework', 'SystemConfiguration',
+ '-framework', 'Security',
+ #'-framework', 'AdSupport',
+ '-framework', 'MediaPlayer',
+ '-framework', 'AVFoundation',
+ '-framework', 'CoreMedia',
+ '-framework', 'CoreMotion',
+ ])
+ else:
+ env.Append(LINKFLAGS=['-arch', 'armv7', '-Wl,-dead_strip', '-miphoneos-version-min=7.0',
+ '-isysroot', '$IPHONESDK',
+ '-framework', 'Foundation',
+ '-framework', 'UIKit',
+ '-framework', 'CoreGraphics',
+ '-framework', 'OpenGLES',
+ '-framework', 'QuartzCore',
+ '-framework', 'CoreAudio',
+ '-framework', 'AudioToolbox',
+ '-framework', 'SystemConfiguration',
+ '-framework', 'Security',
+ #'-framework', 'AdSupport',
+ '-framework', 'MediaPlayer',
+ '-framework', 'AVFoundation',
+ '-framework', 'CoreMedia',
+ '-framework', 'CoreMotion',
+ ])
+
+ if env['game_center'] == 'yes':
+ env.Append(CPPFLAGS=['-fblocks', '-DGAME_CENTER_ENABLED'])
+ env.Append(LINKFLAGS=['-framework', 'GameKit'])
+
+ if env['store_kit'] == 'yes':
+ env.Append(CPPFLAGS=['-DSTOREKIT_ENABLED'])
+ env.Append(LINKFLAGS=['-framework', 'StoreKit'])
+
+ if env['icloud'] == 'yes':
+ env.Append(CPPFLAGS=['-DICLOUD_ENABLED'])
+
+ env.Append(CPPPATH=['$IPHONESDK/usr/include', '$IPHONESDK/System/Library/Frameworks/OpenGLES.framework/Headers', '$IPHONESDK/System/Library/Frameworks/AudioUnit.framework/Headers'])
+
+ if (env["target"] == "release"):
+
+ env.Append(CCFLAGS=['-O3', '-DNS_BLOCK_ASSERTIONS=1', '-Wall', '-gdwarf-2']) # removed -ffast-math
+ env.Append(LINKFLAGS=['-O3'])
+
+ elif env["target"] == "release_debug":
+ env.Append(CCFLAGS=['-Os', '-DNS_BLOCK_ASSERTIONS=1', '-Wall', '-DDEBUG_ENABLED'])
+ env.Append(LINKFLAGS=['-Os'])
+ env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ENABLED'])
+
+ elif (env["target"] == "debug"):
+
+ env.Append(CCFLAGS=['-D_DEBUG', '-DDEBUG=1', '-gdwarf-2', '-Wall', '-O0', '-DDEBUG_ENABLED'])
+ env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ENABLED'])
+
+ elif (env["target"] == "profile"):
+
+ env.Append(CCFLAGS=['-g', '-pg', '-Os'])
+ env.Append(LINKFLAGS=['-pg'])
+
+ if (env["ios_sim"] == "yes"): # TODO: Check if needed?
+ env['ENV']['MACOSX_DEPLOYMENT_TARGET'] = '10.6'
+ env['ENV']['CODESIGN_ALLOCATE'] = '/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate'
+ env.Append(CPPFLAGS=['-DIPHONE_ENABLED', '-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DMPC_FIXED_POINT'])
+
+ # TODO: Move that to opus module's config
+ if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"):
+ env.opus_fixed_point = "yes"
+ if env["arch"] == "x86":
+ pass
+ elif(env["arch"] == "arm64"):
+ env.Append(CFLAGS=["-DOPUS_ARM64_OPT"])
+ else:
+ env.Append(CFLAGS=["-DOPUS_ARM_OPT"])
+
+ if env['ios_exceptions'] == 'yes':
+ env.Append(CPPFLAGS=['-fexceptions'])
+ else:
+ env.Append(CPPFLAGS=['-fno-exceptions'])
+ # env['neon_enabled']=True
+ env['S_compiler'] = '$IPHONEPATH/Developer/usr/bin/gcc'
+
+ 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')})
diff --git a/platform/iphone/game_center.h b/platform/iphone/game_center.h
index 62477a0da2..abbeaaf86f 100644
--- a/platform/iphone/game_center.h
+++ b/platform/iphone/game_center.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 */
@@ -35,7 +35,7 @@
class GameCenter : public Object {
- OBJ_TYPE(GameCenter, Object);
+ GDCLASS(GameCenter, Object);
static GameCenter* instance;
static void _bind_methods();
diff --git a/platform/iphone/game_center.mm b/platform/iphone/game_center.mm
index a5b90514da..de6ea73c20 100644
--- a/platform/iphone/game_center.mm
+++ b/platform/iphone/game_center.mm
@@ -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 */
@@ -48,18 +48,18 @@ extern "C" {
GameCenter* GameCenter::instance = NULL;
void GameCenter::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("connect"),&GameCenter::connect);
- ObjectTypeDB::bind_method(_MD("is_connected"),&GameCenter::is_connected);
-
- ObjectTypeDB::bind_method(_MD("post_score"),&GameCenter::post_score);
- ObjectTypeDB::bind_method(_MD("award_achievement"),&GameCenter::award_achievement);
- ObjectTypeDB::bind_method(_MD("reset_achievements"),&GameCenter::reset_achievements);
- ObjectTypeDB::bind_method(_MD("request_achievements"),&GameCenter::request_achievements);
- ObjectTypeDB::bind_method(_MD("request_achievement_descriptions"),&GameCenter::request_achievement_descriptions);
- ObjectTypeDB::bind_method(_MD("show_game_center"),&GameCenter::show_game_center);
-
- ObjectTypeDB::bind_method(_MD("get_pending_event_count"),&GameCenter::get_pending_event_count);
- ObjectTypeDB::bind_method(_MD("pop_pending_event"),&GameCenter::pop_pending_event);
+ ClassDB::bind_method(_MD("connect"),&GameCenter::connect);
+ ClassDB::bind_method(_MD("is_connected"),&GameCenter::is_connected);
+
+ ClassDB::bind_method(_MD("post_score"),&GameCenter::post_score);
+ ClassDB::bind_method(_MD("award_achievement"),&GameCenter::award_achievement);
+ ClassDB::bind_method(_MD("reset_achievements"),&GameCenter::reset_achievements);
+ ClassDB::bind_method(_MD("request_achievements"),&GameCenter::request_achievements);
+ ClassDB::bind_method(_MD("request_achievement_descriptions"),&GameCenter::request_achievement_descriptions);
+ ClassDB::bind_method(_MD("show_game_center"),&GameCenter::show_game_center);
+
+ ClassDB::bind_method(_MD("get_pending_event_count"),&GameCenter::get_pending_event_count);
+ ClassDB::bind_method(_MD("pop_pending_event"),&GameCenter::pop_pending_event);
};
@@ -182,11 +182,11 @@ void GameCenter::request_achievement_descriptions() {
ret["type"] = "achievement_descriptions";
if (error == nil) {
ret["result"] = "ok";
- StringArray names;
- StringArray titles;
- StringArray unachieved_descriptions;
- StringArray achieved_descriptions;
- IntArray maximum_points;
+ PoolStringArray names;
+ PoolStringArray titles;
+ PoolStringArray unachieved_descriptions;
+ PoolStringArray achieved_descriptions;
+ PoolIntArray maximum_points;
Array hidden;
Array replayable;
@@ -239,8 +239,8 @@ void GameCenter::request_achievements() {
ret["type"] = "achievements";
if (error == nil) {
ret["result"] = "ok";
- StringArray names;
- RealArray percentages;
+ PoolStringArray names;
+ PoolRealArray percentages;
for (int i=0; i<[achievements count]; i++) {
diff --git a/platform/iphone/gl_view.h b/platform/iphone/gl_view.h
index 9c27c6a025..49e7810f08 100755
--- a/platform/iphone/gl_view.h
+++ b/platform/iphone/gl_view.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/iphone/gl_view.mm b/platform/iphone/gl_view.mm
index 607352ab0b..a3af8f4aa8 100755
--- a/platform/iphone/gl_view.mm
+++ b/platform/iphone/gl_view.mm
@@ -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 */
@@ -76,7 +76,7 @@ void _hide_keyboard() {
};
bool _play_video(String p_path, float p_volume, String p_audio_track, String p_subtitle_track) {
- p_path = Globals::get_singleton()->globalize_path(p_path);
+ p_path = GlobalConfig::get_singleton()->globalize_path(p_path);
NSString* file_path = [[[NSString alloc] initWithUTF8String:p_path.utf8().get_data()] autorelease];
@@ -274,7 +274,7 @@ static void clear_touches() {
nil];
// Create our EAGLContext, and if successful make it current and create our framebuffer.
- context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
+ context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3];
if(!context || ![EAGLContext setCurrentContext:context] || ![self createFramebuffer])
{
diff --git a/platform/iphone/globals/global_defaults.cpp b/platform/iphone/globals/global_defaults.cpp
index 23261ceb02..76b5c9aa01 100755
--- a/platform/iphone/globals/global_defaults.cpp
+++ b/platform/iphone/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 */
@@ -32,9 +32,10 @@
void register_iphone_global_defaults() {
- GLOBAL_DEF("rasterizer.iOS/use_fragment_lighting",false);
+ /*GLOBAL_DEF("rasterizer.iOS/use_fragment_lighting",false);
GLOBAL_DEF("rasterizer.iOS/fp16_framebuffer",false);
GLOBAL_DEF("display.iOS/driver","GLES2");
- Globals::get_singleton()->set_custom_property_info("display.iOS/driver",PropertyInfo(Variant::STRING,"display.iOS/driver",PROPERTY_HINT_ENUM,"GLES1,GLES2"));
+ GlobalConfig::get_singleton()->set_custom_property_info("display.iOS/driver",PropertyInfo(Variant::STRING,"display.iOS/driver",PROPERTY_HINT_ENUM,"GLES1,GLES2"));
GLOBAL_DEF("display.iOS/use_cadisplaylink",true);
+ */
}
diff --git a/platform/iphone/globals/global_defaults.h b/platform/iphone/globals/global_defaults.h
index 0f4bf64c9b..1432b74425 100644
--- a/platform/iphone/globals/global_defaults.h
+++ b/platform/iphone/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/iphone/godot_iphone.cpp b/platform/iphone/godot_iphone.cpp
index 2ecfe1545e..27804e5c03 100644
--- a/platform/iphone/godot_iphone.cpp
+++ b/platform/iphone/godot_iphone.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/iphone/icloud.h b/platform/iphone/icloud.h
index dcf3677c85..ba50c4be15 100644
--- a/platform/iphone/icloud.h
+++ b/platform/iphone/icloud.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 */
@@ -36,7 +36,7 @@
class ICloud : public Object {
- OBJ_TYPE(ICloud, Object);
+ GDCLASS(ICloud, Object);
static ICloud* instance;
static void _bind_methods();
diff --git a/platform/iphone/icloud.mm b/platform/iphone/icloud.mm
index 0b3efe41fc..0d1825dd6b 100644
--- a/platform/iphone/icloud.mm
+++ b/platform/iphone/icloud.mm
@@ -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 */
@@ -44,14 +44,14 @@ extern "C" {
ICloud* ICloud::instance = NULL;
void ICloud::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("remove_key"),&ICloud::remove_key);
- ObjectTypeDB::bind_method(_MD("set_key_values"),&ICloud::set_key_values);
- ObjectTypeDB::bind_method(_MD("get_key_value"),&ICloud::get_key_value);
- ObjectTypeDB::bind_method(_MD("synchronize_key_values"),&ICloud::synchronize_key_values);
- ObjectTypeDB::bind_method(_MD("get_all_key_values"),&ICloud::get_all_key_values);
-
- ObjectTypeDB::bind_method(_MD("get_pending_event_count"),&ICloud::get_pending_event_count);
- ObjectTypeDB::bind_method(_MD("pop_pending_event"),&ICloud::pop_pending_event);
+ ClassDB::bind_method(_MD("remove_key"),&ICloud::remove_key);
+ ClassDB::bind_method(_MD("set_key_values"),&ICloud::set_key_values);
+ ClassDB::bind_method(_MD("get_key_value"),&ICloud::get_key_value);
+ ClassDB::bind_method(_MD("synchronize_key_values"),&ICloud::synchronize_key_values);
+ ClassDB::bind_method(_MD("get_all_key_values"),&ICloud::get_all_key_values);
+
+ ClassDB::bind_method(_MD("get_pending_event_count"),&ICloud::get_pending_event_count);
+ ClassDB::bind_method(_MD("pop_pending_event"),&ICloud::pop_pending_event);
};
int ICloud::get_pending_event_count() {
@@ -78,12 +78,12 @@ Variant nsobject_to_variant(NSObject* object) {
return String::utf8(str != NULL ? str : "");
}
else if ([object isKindOfClass:[NSData class]]) {
- ByteArray ret;
+ PoolByteArray ret;
NSData* data = (NSData*)object;
if ([data length] > 0) {
ret.resize([data length]);
{
- ByteArray::Write w = ret.write();
+ PoolByteArray::Write w = ret.write();
copymem(w.ptr(), [data bytes], [data length]);
}
}
@@ -199,9 +199,9 @@ NSObject* variant_to_nsobject(Variant v) {
}
return result;
}
- else if (v.get_type() == Variant::RAW_ARRAY) {
- ByteArray arr = v;
- ByteArray::Read r = arr.read();
+ else if (v.get_type() == Variant::POOL_BYTE_ARRAY) {
+ PoolByteArray arr = v;
+ PoolByteArray::Read r = arr.read();
NSData* result = [NSData dataWithBytes:r.ptr() length:arr.size()];
return result;
}
@@ -333,7 +333,7 @@ ICloud::ICloud() {
Dictionary ret;
ret["type"] = "key_value_changed";
- //StringArray result_keys;
+ //PoolStringArray result_keys;
//Array result_values;
Dictionary keyValues;
String reason = "";
diff --git a/platform/iphone/in_app_store.h b/platform/iphone/in_app_store.h
index bd4215231e..59a745c0f7 100644
--- a/platform/iphone/in_app_store.h
+++ b/platform/iphone/in_app_store.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 */
@@ -35,7 +35,7 @@
class InAppStore : public Object {
- OBJ_TYPE(InAppStore, Object);
+ GDCLASS(InAppStore, Object);
static InAppStore* instance;
static void _bind_methods();
diff --git a/platform/iphone/in_app_store.mm b/platform/iphone/in_app_store.mm
index a2efe2711b..050498c125 100644
--- a/platform/iphone/in_app_store.mm
+++ b/platform/iphone/in_app_store.mm
@@ -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 */
@@ -66,13 +66,13 @@ NSMutableDictionary* pending_transactions = [NSMutableDictionary dictionary];
InAppStore* InAppStore::instance = NULL;
void InAppStore::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("request_product_info"),&InAppStore::request_product_info);
- ObjectTypeDB::bind_method(_MD("purchase"),&InAppStore::purchase);
+ ClassDB::bind_method(_MD("request_product_info"),&InAppStore::request_product_info);
+ ClassDB::bind_method(_MD("purchase"),&InAppStore::purchase);
- ObjectTypeDB::bind_method(_MD("get_pending_event_count"),&InAppStore::get_pending_event_count);
- ObjectTypeDB::bind_method(_MD("pop_pending_event"),&InAppStore::pop_pending_event);
- ObjectTypeDB::bind_method(_MD("finish_transaction"),&InAppStore::finish_transaction);
- ObjectTypeDB::bind_method(_MD("set_auto_finish_transaction"),&InAppStore::set_auto_finish_transaction);
+ ClassDB::bind_method(_MD("get_pending_event_count"),&InAppStore::get_pending_event_count);
+ ClassDB::bind_method(_MD("pop_pending_event"),&InAppStore::pop_pending_event);
+ ClassDB::bind_method(_MD("finish_transaction"),&InAppStore::finish_transaction);
+ ClassDB::bind_method(_MD("set_auto_finish_transaction"),&InAppStore::set_auto_finish_transaction);
};
@interface ProductsDelegate : NSObject<SKProductsRequestDelegate> {
@@ -89,11 +89,11 @@ void InAppStore::_bind_methods() {
Dictionary ret;
ret["type"] = "product_info";
ret["result"] = "ok";
- StringArray titles;
- StringArray descriptions;
- RealArray prices;
- StringArray ids;
- StringArray localized_prices;
+ PoolStringArray titles;
+ PoolStringArray descriptions;
+ PoolRealArray prices;
+ PoolStringArray ids;
+ PoolStringArray localized_prices;
for (int i=0; i<[products count]; i++) {
@@ -114,7 +114,7 @@ void InAppStore::_bind_methods() {
ret["ids"] = ids;
ret["localized_prices"] = localized_prices;
- StringArray invalid_ids;
+ PoolStringArray invalid_ids;
for (NSString* ipid in response.invalidProductIdentifiers) {
@@ -134,7 +134,7 @@ Error InAppStore::request_product_info(Variant p_params) {
Dictionary params = p_params;
ERR_FAIL_COND_V(!params.has("product_ids"), ERR_INVALID_PARAMETER);
- StringArray pids = params["product_ids"];
+ PoolStringArray pids = params["product_ids"];
printf("************ request product info! %i\n", pids.size());
NSMutableArray* array = [[[NSMutableArray alloc] initWithCapacity:pids.size()] autorelease];
diff --git a/platform/iphone/ios.h b/platform/iphone/ios.h
index 8861417284..345bf127f2 100644
--- a/platform/iphone/ios.h
+++ b/platform/iphone/ios.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 */
@@ -33,7 +33,7 @@
class iOS : public Object {
- OBJ_TYPE(iOS, Object);
+ GDCLASS(iOS, Object);
static void _bind_methods();
diff --git a/platform/iphone/ios.mm b/platform/iphone/ios.mm
index 949d3bcb27..a068d4aa31 100644
--- a/platform/iphone/ios.mm
+++ b/platform/iphone/ios.mm
@@ -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 */
@@ -32,7 +32,7 @@
void iOS::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("get_rate_url","app_id"),&iOS::get_rate_url);
+ ClassDB::bind_method(_MD("get_rate_url","app_id"),&iOS::get_rate_url);
};
String iOS::get_rate_url(int p_app_id) const {
diff --git a/platform/iphone/main.m b/platform/iphone/main.m
index ea46a69672..02a45737c5 100644
--- a/platform/iphone/main.m
+++ b/platform/iphone/main.m
@@ -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/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp
index 93496e8225..e34dbae017 100644
--- a/platform/iphone/os_iphone.cpp
+++ b/platform/iphone/os_iphone.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 */
@@ -30,11 +30,9 @@
#include "os_iphone.h"
-#include "drivers/gles2/rasterizer_gles2.h"
-
-
+#include "drivers/gles3/rasterizer_gles3.h"
#include "servers/visual/visual_server_raster.h"
-#include "servers/visual/visual_server_wrap_mt.h"
+//#include "servers/visual/visual_server_wrap_mt.h"
#include "main/main.h"
#include "audio_driver_iphone.h"
@@ -109,16 +107,17 @@ void OSIPhone::initialize(const VideoMode& p_desired,int p_video_driver,int p_au
supported_orientations |= ((GLOBAL_DEF("video_mode/allow_vertical", false)?1:0) << PortraitDown);
supported_orientations |= ((GLOBAL_DEF("video_mode/allow_vertical_flipped", false)?1:0) << PortraitUp);
- rasterizer_gles22 = memnew( RasterizerGLES2(false, false, false) );
- rasterizer = rasterizer_gles22;
- rasterizer_gles22->set_base_framebuffer(gl_view_base_fb);
+ RasterizerGLES3::register_config();
+ RasterizerGLES3::make_current();
+ RasterizerStorageGLES3::system_fbo = gl_view_base_fb;
- visual_server = memnew( VisualServerRaster(rasterizer) );
+ visual_server = memnew( VisualServerRaster() );
+ /*
+ FIXME: Reimplement threaded rendering? Or remove?
if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
-
visual_server = memnew(VisualServerWrapMT(visual_server, false));
};
- visual_server->init();
+ */
visual_server->init();
visual_server->cursor_set_visible(false, 0);
@@ -127,16 +126,7 @@ void OSIPhone::initialize(const VideoMode& p_desired,int p_video_driver,int p_au
audio_driver->set_singleton();
audio_driver->init();
- sample_manager = memnew( SampleManagerMallocSW );
- audio_server = memnew( AudioServerSW(sample_manager) );
- audio_server->init();
- spatial_sound_server = memnew( SpatialSoundServerSW );
- spatial_sound_server->init();
-
- spatial_sound_2d_server = memnew( SpatialSound2DServerSW );
- spatial_sound_2d_server->init();
-
- //
+ // init physics servers
physics_server = memnew( PhysicsServerSW );
physics_server->init();
//physics_2d_server = memnew( Physics2DServerSW );
@@ -148,28 +138,28 @@ void OSIPhone::initialize(const VideoMode& p_desired,int p_video_driver,int p_au
/*
#ifdef IOS_SCORELOOP_ENABLED
scoreloop = memnew(ScoreloopIOS);
- Globals::get_singleton()->add_singleton(Globals::Singleton("Scoreloop", scoreloop));
+ GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("Scoreloop", scoreloop));
scoreloop->connect();
#endif
*/
#ifdef GAME_CENTER_ENABLED
game_center = memnew(GameCenter);
- Globals::get_singleton()->add_singleton(Globals::Singleton("GameCenter", game_center));
+ GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("GameCenter", game_center));
game_center->connect();
#endif
#ifdef STOREKIT_ENABLED
store_kit = memnew(InAppStore);
- Globals::get_singleton()->add_singleton(Globals::Singleton("InAppStore", store_kit));
+ GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("InAppStore", store_kit));
#endif
#ifdef ICLOUD_ENABLED
icloud = memnew(ICloud);
- Globals::get_singleton()->add_singleton(Globals::Singleton("ICloud", icloud));
+ GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("ICloud", icloud));
//icloud->connect();
#endif
- Globals::get_singleton()->add_singleton(Globals::Singleton("iOS", memnew(iOS)));
+ GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("iOS", memnew(iOS)));
};
MainLoop *OSIPhone::get_main_loop() const {
@@ -294,8 +284,8 @@ void OSIPhone::mouse_move(int p_idx, int p_prev_x, int p_prev_y, int p_x, int p_
};
input->set_mouse_pos(Point2(ev.mouse_motion.x,ev.mouse_motion.y));
- ev.mouse_motion.speed_x=input->get_mouse_speed().x;
- ev.mouse_motion.speed_y=input->get_mouse_speed().y;
+ ev.mouse_motion.speed_x=input->get_last_mouse_speed().x;
+ ev.mouse_motion.speed_y=input->get_last_mouse_speed().y;
ev.mouse_motion.button_mask = 1; // pressed
queue_event(ev);
@@ -323,15 +313,20 @@ void OSIPhone::touches_cancelled() {
static const float ACCEL_RANGE = 1;
+void OSIPhone::update_gravity(float p_x, float p_y, float p_z) {
+ input->set_gravity(Vector3(p_x, p_y, p_z));
+};
+
void OSIPhone::update_accelerometer(float p_x, float p_y, float p_z) {
- input->set_accelerometer(Vector3(p_x / (float)ACCEL_RANGE, p_y / (float)ACCEL_RANGE, -p_z / (float)ACCEL_RANGE));
+ // Found out the Z should not be negated! Pass as is!
+ input->set_accelerometer(Vector3(p_x / (float)ACCEL_RANGE, p_y / (float)ACCEL_RANGE, p_z / (float)ACCEL_RANGE));
/*
if (p_x != last_accel.x) {
//printf("updating accel x %f\n", p_x);
InputEvent ev;
- ev.type = InputEvent::JOYSTICK_MOTION;
+ ev.type = InputEvent::JOYPAD_MOTION;
ev.device = 0;
ev.joy_motion.axis = JOY_ANALOG_0_X;
ev.joy_motion.axis_value = (p_x / (float)ACCEL_RANGE);
@@ -342,7 +337,7 @@ void OSIPhone::update_accelerometer(float p_x, float p_y, float p_z) {
if (p_y != last_accel.y) {
//printf("updating accel y %f\n", p_y);
InputEvent ev;
- ev.type = InputEvent::JOYSTICK_MOTION;
+ ev.type = InputEvent::JOYPAD_MOTION;
ev.device = 0;
ev.joy_motion.axis = JOY_ANALOG_0_Y;
ev.joy_motion.axis_value = (p_y / (float)ACCEL_RANGE);
@@ -353,7 +348,7 @@ void OSIPhone::update_accelerometer(float p_x, float p_y, float p_z) {
if (p_z != last_accel.z) {
//printf("updating accel z %f\n", p_z);
InputEvent ev;
- ev.type = InputEvent::JOYSTICK_MOTION;
+ ev.type = InputEvent::JOYPAD_MOTION;
ev.device = 0;
ev.joy_motion.axis = JOY_ANALOG_1_X;
ev.joy_motion.axis_value = ( (1.0 - p_z) / (float)ACCEL_RANGE);
@@ -364,7 +359,13 @@ void OSIPhone::update_accelerometer(float p_x, float p_y, float p_z) {
*/
};
+void OSIPhone::update_magnetometer(float p_x, float p_y, float p_z) {
+ input->set_magnetometer(Vector3(p_x, p_y, p_z));
+};
+void OSIPhone::update_gyroscope(float p_x, float p_y, float p_z) {
+ input->set_gyroscope(Vector3(p_x, p_y, p_z));
+};
void OSIPhone::delete_main_loop() {
@@ -383,7 +384,7 @@ void OSIPhone::finalize() {
visual_server->finish();
memdelete(visual_server);
- memdelete(rasterizer);
+// memdelete(rasterizer);
physics_server->finish();
memdelete(physics_server);
@@ -391,14 +392,8 @@ void OSIPhone::finalize() {
physics_2d_server->finish();
memdelete(physics_2d_server);
- spatial_sound_server->finish();
- memdelete(spatial_sound_server);
-
memdelete(input);
- spatial_sound_2d_server->finish();
- memdelete(spatial_sound_2d_server);
-
};
void OSIPhone::set_mouse_show(bool p_show) { };
@@ -445,9 +440,8 @@ bool OSIPhone::can_draw() const {
int OSIPhone::set_base_framebuffer(int p_fb) {
- if (rasterizer_gles22) {
- rasterizer_gles22->set_base_framebuffer(p_fb);
- };
+ RasterizerStorageGLES3::system_fbo = gl_view_base_fb;
+
return 0;
};
@@ -531,7 +525,7 @@ Error OSIPhone::native_video_play(String p_path, float p_volume, String p_audio_
print("Unable to play %S using the native player as it resides in a .pck file\n", p_path.c_str());
return ERR_INVALID_PARAMETER;
} else {
- p_path = p_path.replace("res:/", Globals::get_singleton()->get_resource_path());
+ p_path = p_path.replace("res:/", GlobalConfig::get_singleton()->get_resource_path());
}
} else if (p_path.begins_with("user://"))
p_path = p_path.replace("user:/", get_data_dir());
@@ -568,10 +562,8 @@ void OSIPhone::native_video_stop() {
OSIPhone::OSIPhone(int width, int height) {
- rasterizer_gles22 = NULL;
main_loop = NULL;
visual_server = NULL;
- rasterizer = NULL;
VideoMode vm;
vm.fullscreen = true;
diff --git a/platform/iphone/os_iphone.h b/platform/iphone/os_iphone.h
index 9f919940c0..65dcc884bb 100644
--- a/platform/iphone/os_iphone.h
+++ b/platform/iphone/os_iphone.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 */
@@ -39,10 +39,7 @@
#include "servers/physics/physics_server_sw.h"
#include "servers/physics_2d/physics_2d_server_sw.h"
#include "servers/physics_2d/physics_2d_server_wrap_mt.h"
-#include "servers/audio/audio_server_sw.h"
-#include "servers/audio/sample_manager_sw.h"
-#include "servers/spatial_sound/spatial_sound_server_sw.h"
-#include "servers/spatial_sound_2d/spatial_sound_2d_server_sw.h"
+#include "servers/audio_server.h"
#include "main/input_default.h"
#include "game_center.h"
#include "in_app_store.h"
@@ -50,7 +47,7 @@
class AudioDriverIphone;
-class RasterizerGLES2;
+// class RasterizerGLES2;
class OSIPhone : public OS_Unix {
@@ -71,18 +68,13 @@ private:
uint8_t supported_orientations;
- Rasterizer *rasterizer;
-
- RasterizerGLES2* rasterizer_gles22;
+// Rasterizer *rasterizer;
+// RasterizerGLES2* rasterizer_gles22;
VisualServer *visual_server;
PhysicsServer* physics_server;
Physics2DServer *physics_2d_server;
- AudioServerSW *audio_server;
- SampleManagerMallocSW *sample_manager;
- SpatialSoundServerSW *spatial_sound_server;
- SpatialSound2DServerSW *spatial_sound_2d_server;
AudioDriverIphone* audio_driver;
#ifdef GAME_CENTER_ENABLED
@@ -152,7 +144,10 @@ public:
int set_base_framebuffer(int p_fb);
+ void update_gravity(float p_x, float p_y, float p_z);
void update_accelerometer(float p_x, float p_y, float p_z);
+ void update_magnetometer(float p_x, float p_y, float p_z);
+ void update_gyroscope(float p_x, float p_y, float p_z);
static OSIPhone* get_singleton();
diff --git a/platform/iphone/platform_config.h b/platform/iphone/platform_config.h
index e40f670185..64e9388910 100644
--- a/platform/iphone/platform_config.h
+++ b/platform/iphone/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 */
@@ -27,8 +27,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include <alloca.h>
-#define GLES2_INCLUDE_H <ES2/gl.h>
-
+// #define GLES2_INCLUDE_H <ES2/gl.h>
+#define GLES3_INCLUDE_H <ES3/gl.h>
#define PLATFORM_REFCOUNT
diff --git a/platform/iphone/platform_refcount.h b/platform/iphone/platform_refcount.h
index 3bf8652b4a..d32fb4514c 100644
--- a/platform/iphone/platform_refcount.h
+++ b/platform/iphone/platform_refcount.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/iphone/rasterizer_iphone.cpp b/platform/iphone/rasterizer_iphone.cpp
index 99e83343d0..ee0457cfb1 100644
--- a/platform/iphone/rasterizer_iphone.cpp
+++ b/platform/iphone/rasterizer_iphone.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 */
@@ -134,21 +134,21 @@ static Image _get_gl_image_and_format(const Image& p_image, Image::Format p_form
switch(p_format) {
- case Image::FORMAT_GRAYSCALE: {
+ case Image::FORMAT_L8: {
r_gl_components=1;
r_gl_format=GL_LUMINANCE;
} break;
case Image::FORMAT_INTENSITY: {
- image.convert(Image::FORMAT_RGBA);
+ image.convert(Image::FORMAT_RGBA8);
r_gl_components=4;
r_gl_format=GL_RGBA;
r_has_alpha_cache=true;
} break;
- case Image::FORMAT_GRAYSCALE_ALPHA: {
+ case Image::FORMAT_LA8: {
- image.convert(Image::FORMAT_RGBA);
+ image.convert(Image::FORMAT_RGBA8);
r_gl_components=4;
r_gl_format=GL_RGBA;
r_has_alpha_cache=true;
@@ -156,7 +156,7 @@ static Image _get_gl_image_and_format(const Image& p_image, Image::Format p_form
case Image::FORMAT_INDEXED: {
- image.convert(Image::FORMAT_RGB);
+ image.convert(Image::FORMAT_RGB8);
r_gl_components=3;
r_gl_format=GL_RGB;
@@ -164,17 +164,17 @@ static Image _get_gl_image_and_format(const Image& p_image, Image::Format p_form
case Image::FORMAT_INDEXED_ALPHA: {
- image.convert(Image::FORMAT_RGBA);
+ image.convert(Image::FORMAT_RGBA8);
r_gl_components=4;
r_gl_format=GL_RGB;
r_has_alpha_cache=true;
} break;
- case Image::FORMAT_RGB: {
+ case Image::FORMAT_RGB8: {
r_gl_components=3; r_gl_format=GL_RGB;
} break;
- case Image::FORMAT_RGBA: {
+ case Image::FORMAT_RGBA8: {
r_gl_components=4;
r_gl_format=GL_RGBA;
@@ -286,7 +286,7 @@ void RasterizerIPhone::texture_blit_rect(RID p_texture,int p_x,int p_y, const Im
GLenum blit_target = GL_TEXTURE_2D; //(texture->target == GL_TEXTURE_CUBE_MAP)?_cube_side_enum[p_cube_side]:GL_TEXTURE_2D;
- DVector<uint8_t>::Read read = img.get_data().read();
+ PoolVector<uint8_t>::Read read = img.get_data().read();
glBindTexture(texture->target, texture->tex_id);
glTexSubImage2D( blit_target, 0, p_x,p_y,img.get_width(),img.get_height(),format,GL_UNSIGNED_BYTE,read.ptr() );
@@ -344,7 +344,7 @@ Image::Format RasterizerIPhone::texture_get_format(RID p_texture) const {
Texture * texture = texture_owner.get(p_texture);
- ERR_FAIL_COND_V(!texture,Image::FORMAT_GRAYSCALE);
+ ERR_FAIL_COND_V(!texture,Image::FORMAT_L8);
return texture->format;
}
@@ -486,7 +486,7 @@ RID RasterizerIPhone::material_create() {
return material_owner.make_rid( memnew( Material ) );
}
-void RasterizerIPhone::fixed_material_set_parameter(RID p_material, VS::FixedMaterialParam p_parameter, const Variant& p_value) {
+void RasterizerIPhone::fixed_material_set_parameter(RID p_material, VS::FixedSpatialMaterialParam p_parameter, const Variant& p_value) {
Material *m=material_owner.get( p_material );
ERR_FAIL_COND(!m);
@@ -494,7 +494,7 @@ void RasterizerIPhone::fixed_material_set_parameter(RID p_material, VS::FixedMat
m->parameters[p_parameter] = p_value;
}
-Variant RasterizerIPhone::fixed_material_get_parameter(RID p_material,VS::FixedMaterialParam p_parameter) const {
+Variant RasterizerIPhone::fixed_material_get_parameter(RID p_material,VS::FixedSpatialMaterialParam p_parameter) const {
Material *m=material_owner.get( p_material );
ERR_FAIL_COND_V(!m, Variant());
@@ -503,7 +503,7 @@ Variant RasterizerIPhone::fixed_material_get_parameter(RID p_material,VS::FixedM
return m->parameters[p_parameter];
}
-void RasterizerIPhone::fixed_material_set_texture(RID p_material,VS::FixedMaterialParam p_parameter, RID p_texture) {
+void RasterizerIPhone::fixed_material_set_texture(RID p_material,VS::FixedSpatialMaterialParam p_parameter, RID p_texture) {
Material *m=material_owner.get( p_material );
ERR_FAIL_COND(!m);
@@ -511,7 +511,7 @@ void RasterizerIPhone::fixed_material_set_texture(RID p_material,VS::FixedMateri
m->textures[p_parameter] = p_texture;
}
-RID RasterizerIPhone::fixed_material_get_texture(RID p_material,VS::FixedMaterialParam p_parameter) const {
+RID RasterizerIPhone::fixed_material_get_texture(RID p_material,VS::FixedSpatialMaterialParam p_parameter) const {
Material *m=material_owner.get( p_material );
ERR_FAIL_COND_V(!m, RID());
@@ -535,7 +535,7 @@ VS::MaterialBlendMode RasterizerIPhone::fixed_material_get_detail_blend_mode(RID
return m->detail_blend_mode;
}
-void RasterizerIPhone::fixed_material_set_texcoord_mode(RID p_material,VS::FixedMaterialParam p_parameter, VS::FixedMaterialTexCoordMode p_mode) {
+void RasterizerIPhone::fixed_material_set_texcoord_mode(RID p_material,VS::FixedSpatialMaterialParam p_parameter, VS::FixedSpatialMaterialTexCoordMode p_mode) {
Material *m=material_owner.get( p_material );
ERR_FAIL_COND(!m);
@@ -543,7 +543,7 @@ void RasterizerIPhone::fixed_material_set_texcoord_mode(RID p_material,VS::Fixed
m->texcoord_mode[p_parameter] = p_mode;
}
-VS::FixedMaterialTexCoordMode RasterizerIPhone::fixed_material_get_texcoord_mode(RID p_material,VS::FixedMaterialParam p_parameter) const {
+VS::FixedSpatialMaterialTexCoordMode RasterizerIPhone::fixed_material_get_texcoord_mode(RID p_material,VS::FixedSpatialMaterialParam p_parameter) const {
Material *m=material_owner.get( p_material );
ERR_FAIL_COND_V(!m, VS::FIXED_MATERIAL_TEXCOORD_TEXGEN);
@@ -552,7 +552,7 @@ VS::FixedMaterialTexCoordMode RasterizerIPhone::fixed_material_get_texcoord_mode
return m->texcoord_mode[p_parameter]; // for now
}
-void RasterizerIPhone::fixed_material_set_texgen_mode(RID p_material,VS::FixedMaterialTexGenMode p_mode) {
+void RasterizerIPhone::fixed_material_set_texgen_mode(RID p_material,VS::FixedSpatialMaterialTexGenMode p_mode) {
Material *m=material_owner.get( p_material );
ERR_FAIL_COND(!m);
@@ -560,7 +560,7 @@ void RasterizerIPhone::fixed_material_set_texgen_mode(RID p_material,VS::FixedMa
m->texgen_mode = p_mode;
};
-VS::FixedMaterialTexGenMode RasterizerIPhone::fixed_material_get_texgen_mode(RID p_material) const {
+VS::FixedSpatialMaterialTexGenMode RasterizerIPhone::fixed_material_get_texgen_mode(RID p_material) const {
Material *m=material_owner.get( p_material );
ERR_FAIL_COND_V(!m, VS::FIXED_MATERIAL_TEXGEN_SPHERE);
@@ -770,7 +770,7 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr
ERR_FAIL_COND_V( surface->index_array_len<=0, ERR_INVALID_DATA );
ERR_FAIL_COND_V( p_array.get_type() != Variant::INT_ARRAY, ERR_INVALID_PARAMETER );
- DVector<int> indices = p_array;
+ PoolVector<int> indices = p_array;
ERR_FAIL_COND_V( indices.size() == 0, ERR_INVALID_PARAMETER );
ERR_FAIL_COND_V( indices.size() != surface->index_array_len, ERR_INVALID_PARAMETER );
@@ -780,7 +780,7 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,surface->index_id);
};
- DVector<int>::Read read = indices.read();
+ PoolVector<int>::Read read = indices.read();
const int *src=read.ptr();
for (int i=0;i<surface->index_array_len;i++) {
@@ -822,14 +822,14 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr
ERR_FAIL_COND_V( p_array.get_type() != Variant::VECTOR3_ARRAY, ERR_INVALID_PARAMETER );
- DVector<Vector3> array = p_array;
+ PoolVector<Vector3> array = p_array;
ERR_FAIL_COND_V( array.size() != surface->array_len, ERR_INVALID_PARAMETER );
if (surface->array_local == 0) {
glBindBuffer(GL_ARRAY_BUFFER,surface->vertex_id);
};
- DVector<Vector3>::Read read = array.read();
+ PoolVector<Vector3>::Read read = array.read();
const Vector3* src=read.ptr();
// setting vertices means regenerating the AABB
@@ -868,7 +868,7 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr
ERR_FAIL_COND_V( p_array.get_type() != Variant::REAL_ARRAY, ERR_INVALID_PARAMETER );
- DVector<real_t> array = p_array;
+ PoolVector<real_t> array = p_array;
ERR_FAIL_COND_V( array.size() != surface->array_len*4, ERR_INVALID_PARAMETER );
@@ -877,7 +877,7 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr
};
- DVector<real_t>::Read read = array.read();
+ PoolVector<real_t>::Read read = array.read();
const real_t* src = read.ptr();
for (int i=0;i<surface->array_len;i++) {
@@ -908,7 +908,7 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr
ERR_FAIL_COND_V( p_array.get_type() != Variant::COLOR_ARRAY, ERR_INVALID_PARAMETER );
- DVector<Color> array = p_array;
+ PoolVector<Color> array = p_array;
ERR_FAIL_COND_V( array.size() != surface->array_len, ERR_INVALID_PARAMETER );
@@ -916,7 +916,7 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr
glBindBuffer(GL_ARRAY_BUFFER,surface->vertex_id);
- DVector<Color>::Read read = array.read();
+ PoolVector<Color>::Read read = array.read();
const Color* src = read.ptr();
surface->has_alpha_cache=false;
@@ -943,14 +943,14 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr
ERR_FAIL_COND_V( p_array.get_type() != Variant::VECTOR3_ARRAY, ERR_INVALID_PARAMETER );
- DVector<Vector3> array = p_array;
+ PoolVector<Vector3> array = p_array;
ERR_FAIL_COND_V( array.size() != surface->array_len , ERR_INVALID_PARAMETER);
if (surface->array_local == 0)
glBindBuffer(GL_ARRAY_BUFFER,surface->vertex_id);
- DVector<Vector3>::Read read = array.read();
+ PoolVector<Vector3>::Read read = array.read();
const Vector3 * src=read.ptr();
@@ -975,14 +975,14 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr
ERR_FAIL_COND_V( p_array.get_type() != Variant::REAL_ARRAY, ERR_INVALID_PARAMETER );
- DVector<real_t> array = p_array;
+ PoolVector<real_t> array = p_array;
ERR_FAIL_COND_V( array.size() != surface->array_len*VS::ARRAY_WEIGHTS_SIZE, ERR_INVALID_PARAMETER );
if (surface->array_local == 0)
glBindBuffer(GL_ARRAY_BUFFER,surface->vertex_id);
- DVector<real_t>::Read read = array.read();
+ PoolVector<real_t>::Read read = array.read();
const real_t * src = read.ptr();
diff --git a/platform/iphone/rasterizer_iphone.h b/platform/iphone/rasterizer_iphone.h
index add656b190..299a11e895 100644
--- a/platform/iphone/rasterizer_iphone.h
+++ b/platform/iphone/rasterizer_iphone.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 */
@@ -74,7 +74,7 @@ class RasterizerIPhone : public Rasterizer {
flags=width=height=0;
tex_id=0;
- format=Image::FORMAT_GRAYSCALE;
+ format=Image::FORMAT_L8;
gl_components_cache=0;
format_has_alpha=false;
has_alpha=false;
@@ -100,11 +100,11 @@ class RasterizerIPhone : public Rasterizer {
RID textures[VisualServer::FIXED_MATERIAL_PARAM_MAX];
Transform uv_transform;
- VS::FixedMaterialTexCoordMode texcoord_mode[VisualServer::FIXED_MATERIAL_PARAM_MAX];
+ VS::FixedSpatialMaterialTexCoordMode texcoord_mode[VisualServer::FIXED_MATERIAL_PARAM_MAX];
VS::MaterialBlendMode detail_blend_mode;
- VS::FixedMaterialTexGenMode texgen_mode;
+ VS::FixedSpatialMaterialTexGenMode texgen_mode;
Material() {
@@ -624,20 +624,20 @@ public:
virtual RID material_create();
- virtual void fixed_material_set_parameter(RID p_material, VS::FixedMaterialParam p_parameter, const Variant& p_value);
- virtual Variant fixed_material_get_parameter(RID p_material,VS::FixedMaterialParam p_parameter) const;
+ virtual void fixed_material_set_parameter(RID p_material, VS::FixedSpatialMaterialParam p_parameter, const Variant& p_value);
+ virtual Variant fixed_material_get_parameter(RID p_material,VS::FixedSpatialMaterialParam p_parameter) const;
- virtual void fixed_material_set_texture(RID p_material,VS::FixedMaterialParam p_parameter, RID p_texture);
- virtual RID fixed_material_get_texture(RID p_material,VS::FixedMaterialParam p_parameter) const;
+ virtual void fixed_material_set_texture(RID p_material,VS::FixedSpatialMaterialParam p_parameter, RID p_texture);
+ virtual RID fixed_material_get_texture(RID p_material,VS::FixedSpatialMaterialParam p_parameter) const;
virtual void fixed_material_set_detail_blend_mode(RID p_material,VS::MaterialBlendMode p_mode);
virtual VS::MaterialBlendMode fixed_material_get_detail_blend_mode(RID p_material) const;
- virtual void fixed_material_set_texgen_mode(RID p_material,VS::FixedMaterialTexGenMode p_mode);
- virtual VS::FixedMaterialTexGenMode fixed_material_get_texgen_mode(RID p_material) const;
+ virtual void fixed_material_set_texgen_mode(RID p_material,VS::FixedSpatialMaterialTexGenMode p_mode);
+ virtual VS::FixedSpatialMaterialTexGenMode fixed_material_get_texgen_mode(RID p_material) const;
- virtual void fixed_material_set_texcoord_mode(RID p_material,VS::FixedMaterialParam p_parameter, VS::FixedMaterialTexCoordMode p_mode);
- virtual VS::FixedMaterialTexCoordMode fixed_material_get_texcoord_mode(RID p_material,VS::FixedMaterialParam p_parameter) const;
+ virtual void fixed_material_set_texcoord_mode(RID p_material,VS::FixedSpatialMaterialParam p_parameter, VS::FixedSpatialMaterialTexCoordMode p_mode);
+ virtual VS::FixedSpatialMaterialTexCoordMode fixed_material_get_texcoord_mode(RID p_material,VS::FixedSpatialMaterialParam p_parameter) const;
virtual void fixed_material_set_uv_transform(RID p_material,const Transform& p_transform);
virtual Transform fixed_material_get_uv_transform(RID p_material) const;
@@ -688,7 +688,7 @@ public:
virtual void multimesh_instance_set_color(RID p_multimesh,int p_index,const Color& p_color);
virtual RID multimesh_get_mesh(RID p_multimesh) const;
- virtual AABB multimesh_get_aabb(RID p_multimesh) const;;
+ virtual AABB multimesh_get_aabb(RID p_multimesh) const;
virtual Transform multimesh_instance_get_transform(RID p_multimesh,int p_index) const;
virtual Color multimesh_instance_get_color(RID p_multimesh,int p_index) const;
@@ -846,7 +846,7 @@ public:
virtual void canvas_begin();
virtual void canvas_set_transparency(float p_transparency);
- virtual void canvas_set_rect(const Rect2& p_rect, bool p_clip);;
+ virtual void canvas_set_rect(const Rect2& p_rect, bool p_clip);
virtual void canvas_draw_line(const Point2& p_from, const Point2& p_to,const Color& p_color,float p_width);
virtual void canvas_draw_rect(const Rect2& p_rect, bool p_region, const Rect2& p_source,bool p_tile,RID p_texture,const Color& p_modulate);
virtual void canvas_draw_style_box(const Rect2& p_rect, RID p_texture,const float *p_margins, bool p_draw_center=true);
diff --git a/platform/iphone/sem_iphone.cpp b/platform/iphone/sem_iphone.cpp
index e9c54a002e..d8913feb5f 100644
--- a/platform/iphone/sem_iphone.cpp
+++ b/platform/iphone/sem_iphone.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/iphone/sem_iphone.h b/platform/iphone/sem_iphone.h
index bfeaf244e5..e00dd8f3dd 100644
--- a/platform/iphone/sem_iphone.h
+++ b/platform/iphone/sem_iphone.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/iphone/view_controller.h b/platform/iphone/view_controller.h
index 52c8ac9953..f919c06af2 100644
--- a/platform/iphone/view_controller.h
+++ b/platform/iphone/view_controller.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/iphone/view_controller.mm b/platform/iphone/view_controller.mm
index 647ded30a7..8b3dc7c984 100644
--- a/platform/iphone/view_controller.mm
+++ b/platform/iphone/view_controller.mm
@@ -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/javascript/SCsub b/platform/javascript/SCsub
index 59e5aa175d..a20c0f7a70 100644
--- a/platform/javascript/SCsub
+++ b/platform/javascript/SCsub
@@ -3,35 +3,36 @@
Import('env')
javascript_files = [
- "os_javascript.cpp",
- "audio_driver_javascript.cpp",
- "javascript_main.cpp",
- "audio_server_javascript.cpp",
- "javascript_eval.cpp"
+ "os_javascript.cpp",
+ "audio_driver_javascript.cpp",
+ "javascript_main.cpp",
+ "audio_server_javascript.cpp",
+ "javascript_eval.cpp"
]
env_javascript = env.Clone()
if env['target'] == "profile":
- env_javascript.Append(CPPFLAGS=['-DPROFILER_ENABLED'])
+ env_javascript.Append(CPPFLAGS=['-DPROFILER_ENABLED'])
-javascript_objects=[]
+javascript_objects = []
for x in javascript_files:
- javascript_objects.append( env_javascript.Object( x ) )
+ javascript_objects.append(env_javascript.Object(x))
-env.Append(LINKFLAGS=["-s","EXPORTED_FUNCTIONS=\"['_main','_audio_server_mix_function','_main_after_fs_sync']\""])
-env.Append(LINKFLAGS=["--shell-file",'"platform/javascript/godot_shell.html"'])
+env.Append(LINKFLAGS=["-s", "EXPORTED_FUNCTIONS=\"['_main','_audio_server_mix_function','_main_after_fs_sync']\""])
+env.Append(LINKFLAGS=["--shell-file", '"platform/javascript/godot_shell.html"'])
-build = env.Program('#bin/godot',javascript_objects,PROGSUFFIX=env["PROGSUFFIX"]+".html")
+build = env.Program('#bin/godot', javascript_objects, PROGSUFFIX=env["PROGSUFFIX"] + ".html")
+Depends(build, "godot_shell.html")
def make_html_shell(target, source, env):
- html_path = target[0].rstr()
- assert html_path[:4] == 'bin/'
- assert html_path[-5:] == '.html'
- basename = html_path[4:-5]
- with open(html_path, 'r+') as html_file:
- fixed_html = html_file.read().replace('.html.mem', '.mem').replace(basename, '$GODOT_BASE')
- html_file.seek(0)
- html_file.truncate()
- html_file.write(fixed_html)
+ html_path = target[0].rstr()
+ assert html_path[:4] == 'bin/'
+ assert html_path[-5:] == '.html'
+ basename = html_path[4:-5]
+ with open(html_path, 'r+') as html_file:
+ fixed_html = html_file.read().replace('.html.mem', '.mem').replace(basename, '$GODOT_BASE')
+ html_file.seek(0)
+ html_file.truncate()
+ html_file.write(fixed_html)
env.AddPostAction(build, Action(make_html_shell, "Creating HTML shell file"))
diff --git a/platform/javascript/audio_driver_javascript.cpp b/platform/javascript/audio_driver_javascript.cpp
index 1b949e64f9..bff01d7c37 100644
--- a/platform/javascript/audio_driver_javascript.cpp
+++ b/platform/javascript/audio_driver_javascript.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 */
@@ -27,20 +27,14 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "audio_driver_javascript.h"
-#include <string.h>
-
-
-
-
+#include <string.h>
#define MAX_NUMBER_INTERFACES 3
#define MAX_NUMBER_OUTPUT_DEVICES 6
/* Structure for passing information to callback function */
-
-
//AudioDriverJavaScript* AudioDriverJavaScript::s_ad=NULL;
const char* AudioDriverJavaScript::get_name() const {
@@ -53,36 +47,45 @@ Error AudioDriverJavaScript::init(){
return OK;
}
+
void AudioDriverJavaScript::start(){
}
+
int AudioDriverJavaScript::get_mix_rate() const {
return 44100;
}
-AudioDriverSW::OutputFormat AudioDriverJavaScript::get_output_format() const{
- return OUTPUT_STEREO;
+AudioDriver::SpeakerMode AudioDriverJavaScript::get_speaker_mode() const{
+
+ return SPEAKER_MODE_STEREO;
}
+
void AudioDriverJavaScript::lock(){
- //if (active && mutex)
- // mutex->lock();
+ /*
+ if (active && mutex)
+ mutex->lock();
+ */
}
+
void AudioDriverJavaScript::unlock() {
- //if (active && mutex)
- // mutex->unlock();
+ /*
+ if (active && mutex)
+ mutex->unlock();
+ */
}
+
void AudioDriverJavaScript::finish(){
}
-
AudioDriverJavaScript::AudioDriverJavaScript()
{
}
diff --git a/platform/javascript/audio_driver_javascript.h b/platform/javascript/audio_driver_javascript.h
index c674a8566e..da146fcdd0 100644
--- a/platform/javascript/audio_driver_javascript.h
+++ b/platform/javascript/audio_driver_javascript.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 */
@@ -29,11 +29,11 @@
#ifndef AUDIO_DRIVER_JAVASCRIPT_H
#define AUDIO_DRIVER_JAVASCRIPT_H
+#include "servers/audio_server.h"
-#include "servers/audio/audio_server_sw.h"
#include "os/mutex.h"
-class AudioDriverJavaScript : public AudioDriverSW {
+class AudioDriverJavaScript : public AudioDriver {
public:
void set_singleton();
@@ -43,7 +43,7 @@ public:
virtual Error init();
virtual void start();
virtual int get_mix_rate() const ;
- virtual OutputFormat get_output_format() const;
+ virtual SpeakerMode get_speaker_mode() const;
virtual void lock();
virtual void unlock();
virtual void finish();
diff --git a/platform/javascript/audio_server_javascript.cpp b/platform/javascript/audio_server_javascript.cpp
index 71a7e77266..d5940fb102 100644
--- a/platform/javascript/audio_server_javascript.cpp
+++ b/platform/javascript/audio_server_javascript.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 */
@@ -87,7 +87,7 @@ const void* AudioServerJavascript::sample_get_data_ptr(RID p_sample) const{
return NULL;
}
-void AudioServerJavascript::sample_set_data(RID p_sample, const DVector<uint8_t>& p_buffer){
+void AudioServerJavascript::sample_set_data(RID p_sample, const PoolVector<uint8_t>& p_buffer){
Sample *sample = sample_owner.get(p_sample);
ERR_FAIL_COND(!sample);
@@ -95,7 +95,7 @@ void AudioServerJavascript::sample_set_data(RID p_sample, const DVector<uint8_t>
Vector<float> buffer;
buffer.resize(sample->length*chans);
- DVector<uint8_t>::Read r=p_buffer.read();
+ PoolVector<uint8_t>::Read r=p_buffer.read();
if (sample->format==SAMPLE_FORMAT_PCM8) {
const int8_t*ptr = (const int8_t*)r.ptr();
for(int i=0;i<sample->length*chans;i++) {
@@ -116,10 +116,10 @@ void AudioServerJavascript::sample_set_data(RID p_sample, const DVector<uint8_t>
}
-DVector<uint8_t> AudioServerJavascript::sample_get_data(RID p_sample) const{
+PoolVector<uint8_t> AudioServerJavascript::sample_get_data(RID p_sample) const{
- return DVector<uint8_t>();
+ return PoolVector<uint8_t>();
}
void AudioServerJavascript::sample_set_mix_rate(RID p_sample,int p_rate){
@@ -198,14 +198,15 @@ RID AudioServerJavascript::voice_create(){
voice->positional=false;
voice->active=false;
+ /* clang-format off */
EM_ASM_( {
- _as_voices[$0]=null;
- _as_voice_gain[$0]=_as_audioctx.createGain();
- _as_voice_pan[$0]=_as_audioctx.createStereoPanner();
- _as_voice_gain[$0].connect(_as_voice_pan[$0]);
- _as_voice_pan[$0].connect(_as_audioctx.destination);
-
- },voice_base);
+ _as_voices[$0] = null;
+ _as_voice_gain[$0] = _as_audioctx.createGain();
+ _as_voice_pan[$0] = _as_audioctx.createStereoPanner();
+ _as_voice_gain[$0].connect(_as_voice_pan[$0]);
+ _as_voice_pan[$0].connect(_as_audioctx.destination);
+ }, voice_base);
+ /* clang-format on */
voice_base++;
@@ -227,27 +228,29 @@ void AudioServerJavascript::voice_play(RID p_voice, RID p_sample){
//create sample if not created
ERR_FAIL_COND(sample->tmp_data.size()==0);
sample->index=sample_base;
- EM_ASM_( {
- _as_samples[$0]=_as_audioctx.createBuffer($1,$2,$3);
- },sample_base,sample->stereo?2:1,sample->length,sample->mix_rate);
+ /* clang-format off */
+ EM_ASM_({
+ _as_samples[$0] = _as_audioctx.createBuffer($1, $2, $3);
+ }, sample_base, sample->stereo ? 2 : 1, sample->length, sample->mix_rate);
+ /* clang-format on */
sample_base++;
int chans = sample->stereo?2:1;
for(int i=0;i<chans;i++) {
-
-
+ /* clang-format off */
EM_ASM_({
- _as_edited_buffer=_as_samples[$0].getChannelData($1);
- },sample->index,i);
-
+ _as_edited_buffer = _as_samples[$0].getChannelData($1);
+ }, sample->index, i);
+ /* clang-format on */
for(int j=0;j<sample->length;j++) {
-
+ /* clang-format off */
EM_ASM_({
- _as_edited_buffer[$0]=$1;
- },j,sample->tmp_data[j*chans+i]);
+ _as_edited_buffer[$0] = $1;
+ }, j, sample->tmp_data[j * chans + i]);
+ /* clang-format on */
}
}
@@ -263,26 +266,27 @@ void AudioServerJavascript::voice_play(RID p_voice, RID p_sample){
float freq_diff = Math::log(float(voice->mix_rate)/float(voice->sample_mix_rate))/Math::log(2.0);
int detune = int(freq_diff*1200.0);
- EM_ASM_( {
- if (_as_voices[$0]!==null) {
- _as_voices[$0].stop(); //stop and byebye
- }
- _as_voices[$0]=_as_audioctx.createBufferSource();
- _as_voices[$0].connect(_as_voice_gain[$0]);
- _as_voices[$0].buffer=_as_samples[$1];
- _as_voices[$0].loopStart.value=$1;
- _as_voices[$0].loopEnd.value=$2;
- _as_voices[$0].loop.value=$3;
- _as_voices[$0].detune.value=$6;
- _as_voice_pan[$0].pan.value=$4;
- _as_voice_gain[$0].gain.value=$5;
- _as_voices[$0].start();
- _as_voices[$0].onended=function() {
- _as_voices[$0].disconnect(_as_voice_gain[$0]);
- _as_voices[$0]=null;
- }
-
- },voice->index,sample->index,sample->mix_rate*sample->loop_begin,sample->mix_rate*sample->loop_end,sample->loop_format!=SAMPLE_LOOP_NONE,voice->pan,voice->volume*fx_volume_scale,detune);
+ /* clang-format off */
+ EM_ASM_({
+ if (_as_voices[$0] !== null) {
+ _as_voices[$0].stop(); //stop and byebye
+ }
+ _as_voices[$0] = _as_audioctx.createBufferSource();
+ _as_voices[$0].connect(_as_voice_gain[$0]);
+ _as_voices[$0].buffer = _as_samples[$1];
+ _as_voices[$0].loopStart.value = $1;
+ _as_voices[$0].loopEnd.value = $2;
+ _as_voices[$0].loop.value = $3;
+ _as_voices[$0].detune.value = $6;
+ _as_voice_pan[$0].pan.value = $4;
+ _as_voice_gain[$0].gain.value = $5;
+ _as_voices[$0].start();
+ _as_voices[$0].onended = function() {
+ _as_voices[$0].disconnect(_as_voice_gain[$0]);
+ _as_voices[$0] = null;
+ }
+ }, voice->index, sample->index, sample->mix_rate * sample->loop_begin, sample->mix_rate * sample->loop_end, sample->loop_format != SAMPLE_LOOP_NONE, voice->pan, voice->volume * fx_volume_scale, detune);
+ /* clang-format on */
voice->active=true;
}
@@ -295,11 +299,11 @@ void AudioServerJavascript::voice_set_volume(RID p_voice, float p_volume){
voice->volume=p_volume;
if (voice->active) {
- EM_ASM_( {
-
- _as_voice_gain[$0].gain.value=$1;
-
- },voice->index,voice->volume*fx_volume_scale);
+ /* clang-format off */
+ EM_ASM_({
+ _as_voice_gain[$0].gain.value = $1;
+ }, voice->index, voice->volume * fx_volume_scale);
+ /* clang-format on */
}
}
@@ -313,11 +317,11 @@ void AudioServerJavascript::voice_set_pan(RID p_voice, float p_pan, float p_dept
voice->pan_height=height;
if (voice->active) {
- EM_ASM_( {
-
- _as_voice_pan[$0].pan.value=$1;
-
- },voice->index,voice->pan);
+ /* clang-format off */
+ EM_ASM_({
+ _as_voice_pan[$0].pan.value = $1;
+ }, voice->index, voice->pan);
+ /* clang-format on */
}
}
void AudioServerJavascript::voice_set_filter(RID p_voice, FilterType p_type, float p_cutoff, float p_resonance, float p_gain){
@@ -340,11 +344,11 @@ void AudioServerJavascript::voice_set_mix_rate(RID p_voice, int p_mix_rate){
float freq_diff = Math::log(float(voice->mix_rate)/float(voice->sample_mix_rate))/Math::log(2.0);
int detune = int(freq_diff*1200.0);
- EM_ASM_( {
-
- _as_voices[$0].detune.value=$1;
-
- },voice->index,detune);
+ /* clang-format off */
+ EM_ASM_({
+ _as_voices[$0].detune.value = $1;
+ }, voice->index, detune);
+ /* clang-format on */
}
}
void AudioServerJavascript::voice_set_positional(RID p_voice, bool p_positional){
@@ -419,14 +423,15 @@ void AudioServerJavascript::voice_stop(RID p_voice){
ERR_FAIL_COND(!voice);
if (voice->active) {
-
- EM_ASM_( {
- if (_as_voices[$0]!==null) {
- _as_voices[$0].stop();
- _as_voices[$0].disconnect(_as_voice_gain[$0]);
- _as_voices[$0]=null;
- }
- },voice->index);
+ /* clang-format off */
+ EM_ASM_({
+ if (_as_voices[$0] !== null) {
+ _as_voices[$0].stop();
+ _as_voices[$0].disconnect(_as_voice_gain[$0]);
+ _as_voices[$0] = null;
+ }
+ }, voice->index);
+ /* clang-format on */
voice->active=false;
}
@@ -524,22 +529,25 @@ void AudioServerJavascript::free(RID p_id){
ERR_FAIL_COND(!voice);
if (voice->active) {
- EM_ASM_( {
- if (_as_voices[$0]!==null) {
+ /* clang-format off */
+ EM_ASM_({
+ if (_as_voices[$0] !== null) {
_as_voices[$0].stop();
- _as_voices[$0].disconnect(_as_voice_gain[$0]);
+ _as_voices[$0].disconnect(_as_voice_gain[$0]);
}
- },voice->index);
+ }, voice->index);
+ /* clang-format on */
}
- EM_ASM_( {
+ /* clang-format off */
+ EM_ASM_({
delete _as_voices[$0];
_as_voice_gain[$0].disconnect(_as_voice_pan[$0]);
delete _as_voice_gain[$0];
_as_voice_pan[$0].disconnect(_as_audioctx.destination);
delete _as_voice_pan[$0];
-
- },voice->index);
+ }, voice->index);
+ /* clang-format on */
voice_owner.free(p_id);
memdelete(voice);
@@ -549,10 +557,11 @@ void AudioServerJavascript::free(RID p_id){
Sample *sample = sample_owner.get(p_id);
ERR_FAIL_COND(!sample);
- EM_ASM_( {
+ /* clang-format off */
+ EM_ASM_({
delete _as_samples[$0];
-
- },sample->index);
+ }, sample->index);
+ /* clang-format on */
sample_owner.free(p_id);
memdelete(sample);
@@ -594,21 +603,20 @@ void AudioServerJavascript::mix_to_js(int p_frames) {
int tomix=MIN(todo,INTERNAL_BUFFER_SIZE);
driver_process_chunk(tomix);
-
+ /* clang-format off */
EM_ASM_({
-
- var data = HEAPF32.subarray($0/4, $0/4 + $2*2);
+ var data = HEAPF32.subarray($0 / 4, $0 / 4 + $2 * 2);
for (var channel = 0; channel < _as_output_buffer.numberOfChannels; channel++) {
var outputData = _as_output_buffer.getChannelData(channel);
// Loop through samples
for (var sample = 0; sample < $2; sample++) {
// make output equal to the same as the input
- outputData[sample+$1] = data[sample*2+channel];
+ outputData[sample + $1] = data[sample * 2 + channel];
}
}
-
- },internal_buffer,offset,tomix);
+ }, internal_buffer, offset, tomix);
+ /* clang-format on */
todo-=tomix;
offset+=tomix;
@@ -617,9 +625,13 @@ void AudioServerJavascript::mix_to_js(int p_frames) {
void AudioServerJavascript::init(){
- //EM_ASM(
-// console.log('server is '+audio_server);
-// );
+ /*
+ // clang-format off
+ EM_ASM(
+ console.log('server is ' + audio_server);
+ );
+ // clang-format on
+ */
//int latency = GLOBAL_DEF("javascript/audio_latency",16384);
@@ -632,19 +644,19 @@ void AudioServerJavascript::init(){
int buffer_latency=16384;
+ /* clang-format off */
EM_ASM_( {
-
_as_script_node = _as_audioctx.createScriptProcessor($0, 0, 2);
_as_script_node.connect(_as_audioctx.destination);
console.log(_as_script_node.bufferSize);
-
_as_script_node.onaudioprocess = function(audioProcessingEvent) {
// The output buffer contains the samples that will be modified and played
_as_output_buffer = audioProcessingEvent.outputBuffer;
audio_server_mix_function(_as_output_buffer.getChannelData(0).length);
}
- },buffer_latency);
+ }, buffer_latency);
+ /* clang-format on */
}
@@ -811,20 +823,24 @@ AudioServerJavascript::AudioServerJavascript() {
singleton=this;
sample_base=1;
voice_base=1;
+ /* clang-format off */
EM_ASM(
- _as_samples={};
- _as_voices={};
- _as_voice_pan={};
- _as_voice_gain={};
+ _as_samples = {};
+ _as_voices = {};
+ _as_voice_pan = {};
+ _as_voice_gain = {};
_as_audioctx = new (window.AudioContext || window.webkitAudioContext)();
audio_server_mix_function = Module.cwrap('audio_server_mix_function', 'void', ['number']);
);
+ /* clang-format on */
+ /* clang-format off */
webaudio_mix_rate = EM_ASM_INT_V(
- return _as_audioctx.sampleRate;
- );
+ return _as_audioctx.sampleRate;
+ );
+ /* clang-format on */
print_line("WEBAUDIO MIX RATE: "+itos(webaudio_mix_rate));
event_voice_scale=1.0;
fx_volume_scale=1.0;
diff --git a/platform/javascript/audio_server_javascript.h b/platform/javascript/audio_server_javascript.h
index e27192cd93..f8c8774e4c 100644
--- a/platform/javascript/audio_server_javascript.h
+++ b/platform/javascript/audio_server_javascript.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 */
@@ -29,12 +29,11 @@
#ifndef AUDIO_SERVER_JAVASCRIPT_H
#define AUDIO_SERVER_JAVASCRIPT_H
-
#include "servers/audio_server.h"
class AudioServerJavascript : public AudioServer {
- OBJ_TYPE(AudioServerJavascript,AudioServer);
+ GDCLASS(AudioServerJavascript,AudioServer);
enum {
INTERNAL_BUFFER_SIZE=4096,
@@ -131,8 +130,8 @@ public:
virtual const void* sample_get_data_ptr(RID p_sample) const;
- virtual void sample_set_data(RID p_sample, const DVector<uint8_t>& p_buffer);
- virtual DVector<uint8_t> sample_get_data(RID p_sample) const;
+ virtual void sample_set_data(RID p_sample, const PoolVector<uint8_t>& p_buffer);
+ virtual PoolVector<uint8_t> sample_get_data(RID p_sample) const;
virtual void sample_set_mix_rate(RID p_sample,int p_rate);
virtual int sample_get_mix_rate(RID p_sample) const;
diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py
index b6a6a453b3..55b05a9123 100644
--- a/platform/javascript/detect.py
+++ b/platform/javascript/detect.py
@@ -2,104 +2,113 @@ import os
import sys
import string
+
def is_active():
- return True
+ return True
+
def get_name():
- return "JavaScript"
+ return "JavaScript"
+
def can_build():
- import os
- if (not os.environ.has_key("EMSCRIPTEN_ROOT")):
- return False
- return True
+ import os
+ if (not os.environ.has_key("EMSCRIPTEN_ROOT")):
+ return False
+ return True
+
def get_opts():
- return [
- ['wasm','Compile to WebAssembly','no'],
- ['javascript_eval','Enable JavaScript eval interface','yes'],
- ]
+ return [
+ ['wasm', 'Compile to WebAssembly', 'no'],
+ ['javascript_eval', 'Enable JavaScript eval interface', 'yes'],
+ ]
-def get_flags():
- return [
- ('tools', 'no'),
- ('builtin_zlib', 'yes'),
- ('module_etc1_enabled', 'no'),
- ('module_mpc_enabled', 'no'),
- ('module_theora_enabled', 'no'),
- ]
+def get_flags():
+ return [
+ ('tools', 'no'),
+ ('module_etc1_enabled', 'no'),
+ ('module_mpc_enabled', 'no'),
+ ('module_theora_enabled', 'no'),
+ ]
def configure(env):
- env['ENV'] = os.environ;
- env.use_windows_spawn_fix('javascript')
+ env['ENV'] = os.environ
+ env.use_windows_spawn_fix('javascript')
- env.Append(CPPPATH=['#platform/javascript'])
+ env.Append(CPPPATH=['#platform/javascript'])
- em_path=os.environ["EMSCRIPTEN_ROOT"]
+ em_path = os.environ["EMSCRIPTEN_ROOT"]
- env['ENV']['PATH'] = em_path+":"+env['ENV']['PATH']
- env['CC'] = em_path+'/emcc'
- env['CXX'] = em_path+'/emcc'
- #env['AR'] = em_path+"/emar"
- env['AR'] = em_path+"/emcc"
- env['ARFLAGS'] = "-o"
+ env['ENV']['PATH'] = em_path + ":" + env['ENV']['PATH']
+ env['CC'] = em_path + '/emcc'
+ env['CXX'] = em_path + '/emcc'
+ #env['AR'] = em_path+"/emar"
+ env['AR'] = em_path + "/emcc"
+ env['ARFLAGS'] = "-o"
# env['RANLIB'] = em_path+"/emranlib"
- env['RANLIB'] = em_path + "/emcc"
- env['OBJSUFFIX'] = '.bc'
- env['LIBSUFFIX'] = '.bc'
- env['CCCOM'] = "$CC -o $TARGET $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES"
- env['CXXCOM'] = "$CC -o $TARGET $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES"
+ env['RANLIB'] = em_path + "/emcc"
+ env['OBJSUFFIX'] = '.bc'
+ env['LIBSUFFIX'] = '.bc'
+ env['CCCOM'] = "$CC -o $TARGET $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES"
+ env['CXXCOM'] = "$CC -o $TARGET $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES"
# env.Append(LIBS=['c','m','stdc++','log','GLESv1_CM','GLESv2'])
# env["LINKFLAGS"]= string.split(" -g --sysroot="+ld_sysroot+" -Wl,--no-undefined -Wl,-z,noexecstack ")
- if (env["target"]=="release"):
- env.Append(CCFLAGS=['-O2'])
- elif (env["target"]=="release_debug"):
- env.Append(CCFLAGS=['-O2','-DDEBUG_ENABLED'])
- elif (env["target"]=="debug"):
- env.Append(CCFLAGS=['-D_DEBUG', '-Wall', '-O2', '-DDEBUG_ENABLED'])
- #env.Append(CCFLAGS=['-D_DEBUG', '-Wall', '-g4', '-DDEBUG_ENABLED'])
- env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC'])
-
- # TODO: Move that to opus module's config
- if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"):
- env.opus_fixed_point = "yes"
-
- env.Append(CPPFLAGS=["-fno-exceptions",'-DNO_SAFE_CAST','-fno-rtti'])
- env.Append(CPPFLAGS=['-DJAVASCRIPT_ENABLED', '-DUNIX_ENABLED', '-DPTHREAD_NO_RENAME', '-DNO_FCNTL','-DMPC_FIXED_POINT','-DTYPED_METHOD_BIND','-DNO_THREADS'])
- env.Append(CPPFLAGS=['-DGLES2_ENABLED'])
- env.Append(CPPFLAGS=['-DGLES_NO_CLIENT_ARRAYS'])
- env.Append(CPPFLAGS=['-s','FULL_ES2=1'])
+ if (env["target"] == "release"):
+ env.Append(CCFLAGS=['-O2'])
+ elif (env["target"] == "release_debug"):
+ env.Append(CCFLAGS=['-O2', '-DDEBUG_ENABLED'])
+ elif (env["target"] == "debug"):
+ env.Append(CCFLAGS=['-D_DEBUG', '-Wall', '-O2', '-DDEBUG_ENABLED'])
+ #env.Append(CCFLAGS=['-D_DEBUG', '-Wall', '-g4', '-DDEBUG_ENABLED'])
+ env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC'])
+
+ # TODO: Move that to opus module's config
+ if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"):
+ env.opus_fixed_point = "yes"
+
+ # These flags help keep the file size down
+ env.Append(CPPFLAGS=["-fno-exceptions", '-DNO_SAFE_CAST', '-fno-rtti'])
+ env.Append(CPPFLAGS=['-DJAVASCRIPT_ENABLED', '-DUNIX_ENABLED', '-DPTHREAD_NO_RENAME', '-DNO_FCNTL', '-DMPC_FIXED_POINT', '-DTYPED_METHOD_BIND', '-DNO_THREADS'])
+ env.Append(CPPFLAGS=['-DGLES2_ENABLED'])
+ env.Append(CPPFLAGS=['-DGLES_NO_CLIENT_ARRAYS'])
# env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED','-DMPC_FIXED_POINT'])
- if env['wasm'] == 'yes':
- env.Append(LINKFLAGS=['-s','BINARYEN=1'])
- env.Append(LINKFLAGS=['-s','\'BINARYEN_METHOD="native-wasm"\''])
- env["PROGSUFFIX"]+=".webassembly"
- else:
- env.Append(CPPFLAGS=['-s','ASM_JS=1'])
- env.Append(LINKFLAGS=['-s','ASM_JS=1'])
-
- if env['javascript_eval'] == 'yes':
- env.Append(CPPFLAGS=['-DJAVASCRIPT_EVAL_ENABLED'])
-
- env.Append(LINKFLAGS=['-O2'])
- #env.Append(LINKFLAGS=['-g4'])
-
- #print "CCCOM is:", env.subst('$CCCOM')
- #print "P: ", env['p'], " Platofrm: ", env['platform']
-
- 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.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } )
+ if env['wasm'] == 'yes':
+ env.Append(LINKFLAGS=['-s', 'BINARYEN=1'])
+ # Maximum memory size is baked into the WebAssembly binary during
+ # compilation, so we need to enable memory growth to allow setting
+ # TOTAL_MEMORY at runtime. The value set at runtime must be higher than
+ # what is set during compilation, check TOTAL_MEMORY in Emscripten's
+ # src/settings.js for the default.
+ env.Append(LINKFLAGS=['-s', 'ALLOW_MEMORY_GROWTH=1'])
+ env["PROGSUFFIX"] += ".webassembly"
+ else:
+ env.Append(CPPFLAGS=['-s', 'ASM_JS=1'])
+ env.Append(LINKFLAGS=['-s', 'ASM_JS=1'])
+ env.Append(LINKFLAGS=['--separate-asm'])
+
+ if env['javascript_eval'] == 'yes':
+ env.Append(CPPFLAGS=['-DJAVASCRIPT_EVAL_ENABLED'])
+
+ env.Append(LINKFLAGS=['-O2'])
+ # env.Append(LINKFLAGS=['-g4'])
+
+ # print "CCCOM is:", env.subst('$CCCOM')
+ # print "P: ", env['p'], " Platofrm: ", env['platform']
+
+ 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.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } )
diff --git a/platform/javascript/dom_keys.h b/platform/javascript/dom_keys.h
index 282b632e93..5ef212ce4a 100644
--- a/platform/javascript/dom_keys.h
+++ b/platform/javascript/dom_keys.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/javascript/export/export.cpp b/platform/javascript/export/export.cpp
index 721aef3e50..e0ff9932cc 100644
--- a/platform/javascript/export/export.cpp
+++ b/platform/javascript/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 */
@@ -40,7 +40,7 @@
#include "string.h"
class EditorExportPlatformJavaScript : public EditorExportPlatform {
- OBJ_TYPE( EditorExportPlatformJavaScript,EditorExportPlatform );
+ GDCLASS( EditorExportPlatformJavaScript,EditorExportPlatform );
String custom_release_package;
String custom_debug_package;
@@ -181,9 +181,9 @@ void EditorExportPlatformJavaScript::_fix_html(Vector<uint8_t>& p_html, const St
String current_line = lines[i];
current_line = current_line.replace("$GODOT_TMEM",itos((1<<(max_memory+5))*1024*1024));
current_line = current_line.replace("$GODOT_BASE",p_name);
- current_line = current_line.replace("$GODOT_CANVAS_WIDTH",Globals::get_singleton()->get("display/width"));
- current_line = current_line.replace("$GODOT_CANVAS_HEIGHT",Globals::get_singleton()->get("display/height"));
- current_line = current_line.replace("$GODOT_HEAD_TITLE",!html_title.empty()?html_title:(String) Globals::get_singleton()->get("application/name"));
+ current_line = current_line.replace("$GODOT_CANVAS_WIDTH",GlobalConfig::get_singleton()->get("display/width"));
+ current_line = current_line.replace("$GODOT_CANVAS_HEIGHT",GlobalConfig::get_singleton()->get("display/height"));
+ current_line = current_line.replace("$GODOT_HEAD_TITLE",!html_title.empty()?html_title:(String) GlobalConfig::get_singleton()->get("application/name"));
current_line = current_line.replace("$GODOT_HEAD_INCLUDE",html_head_include);
current_line = current_line.replace("$GODOT_STYLE_FONT_FAMILY",html_font_family);
current_line = current_line.replace("$GODOT_STYLE_INCLUDE",html_style_include);
@@ -265,7 +265,7 @@ Error EditorExportPlatformJavaScript::export_project(const String& p_path, bool
FileAccess *f=FileAccess::open(p_path.get_base_dir()+"/data.pck",FileAccess::WRITE);
if (!f) {
- EditorNode::add_io_error("Could not create file for writing:\n"+p_path.basename()+"_files.js");
+ EditorNode::add_io_error("Could not create file for writing:\n"+p_path.get_basename()+"_files.js");
return ERR_FILE_CANT_WRITE;
}
Error err = save_pack(f);
@@ -307,27 +307,32 @@ Error EditorExportPlatformJavaScript::export_project(const String& p_path, bool
if (file=="godot.html") {
- _fix_html(data,p_path.get_file().basename(), p_debug);
+ _fix_html(data,p_path.get_file().get_basename(), p_debug);
file=p_path.get_file();
}
if (file=="godotfs.js") {
_fix_files(data,len);
- file=p_path.get_file().basename()+"fs.js";
+ file=p_path.get_file().get_basename()+"fs.js";
}
if (file=="godot.js") {
- file=p_path.get_file().basename()+".js";
+ file=p_path.get_file().get_basename()+".js";
+ }
+
+ if (file=="godot.asm.js") {
+
+ file=p_path.get_file().get_basename()+".asm.js";
}
if (file=="godot.mem") {
- file=p_path.get_file().basename()+".mem";
+ file=p_path.get_file().get_basename()+".mem";
}
if (file=="godot.wasm") {
- file=p_path.get_file().basename()+".wasm";
+ file=p_path.get_file().get_basename()+".wasm";
}
String dst = p_path.get_base_dir().plus_file(file);
@@ -372,7 +377,7 @@ EditorExportPlatformJavaScript::EditorExportPlatformJavaScript() {
logo->create_from_image(img);
max_memory=3;
html_title="";
- html_font_family="arial,sans-serif";
+ html_font_family="'Droid Sans',arial,sans-serif";
html_controls_enabled=true;
pack_mode=PACK_SINGLE_FILE;
}
diff --git a/platform/javascript/export/export.h b/platform/javascript/export/export.h
index 2105141e58..59c0a67e6d 100644
--- a/platform/javascript/export/export.h
+++ b/platform/javascript/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/javascript/godot_shell.html b/platform/javascript/godot_shell.html
index 3170d2bb9e..a8b9594935 100644
--- a/platform/javascript/godot_shell.html
+++ b/platform/javascript/godot_shell.html
@@ -3,14 +3,14 @@
<head>
<meta charset="utf-8" />
<title>$GODOT_HEAD_TITLE</title>
- $GODOT_HEAD_INCLUDE
+$GODOT_HEAD_INCLUDE
<style type="text/css">
body {
margin: 0;
border: 0 none;
padding: 0;
text-align: center;
- background-color: black;
+ background-color: #222226;
font-family: $GODOT_STYLE_FONT_FAMILY;
}
@@ -71,7 +71,7 @@
margin: 0;
border: 0 none;
padding: 0;
- background-color: #111;
+ background-color: #0c0c0c;
}
#canvas {
@@ -81,6 +81,7 @@
* calculate cursor coordinates correctly */
border: 0 none;
padding: 0;
+ color: white;
}
@@ -101,6 +102,8 @@
}
#status {
+ line-height: 1.3;
+ cursor: pointer;
visibility: visible;
padding: 4px 6px;
}
@@ -123,7 +126,7 @@
-ms-user-select: none;
}
- #container:hover > #controls {
+ :hover > #controls {
opacity: 1.0;
transition: opacity 60ms ease-in-out;
}
@@ -135,223 +138,289 @@
margin-right: 2px;
}
+ #controls > label > input {
+ vertical-align: middle;
+ }
+
#controls > label > input[type="checkbox"] {
/* override user agent style */
margin-left: 0;
}
- label > input {
- vertical-align: middle;
- }
-
- #display-output { display: none; }
+ #output-toggle { display: none; }
/* Debug output
* ============ */
- #output {
+ #output-panel {
display: none;
- margin: 6px auto;
- border: 2px groove grey;
- padding: 4px;
- outline: none;
+ max-width: $GODOT_CANVAS_WIDTHpx;
+ font-size: small;
+ margin: 6px auto 0;
+ padding: 0 4px 4px;
text-align: left;
+ line-height: 2.2;
+ }
+
+ #output-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ }
+
+ #output-container {
+ padding: 6px;
+ background-color: #2c2a32;
+ box-shadow: inset 0 0 1px 1px #232127;
+ color: #bbb;
+ }
+
+ #output-scroll {
+ line-height: 1;
+ height: 12em;
+ overflow-y: scroll;
white-space: pre-wrap;
font-size: small;
- color: #eee;
- background-color: black;
font-family: "Lucida Console", Monaco, monospace;
}
- /* Export style include
- * ==================== */
+/* Export style include
+ * ==================== */
+
+$GODOT_STYLE_INCLUDE
- $GODOT_STYLE_INCLUDE
</style>
</head>
<body>
<div id="container">
<canvas id="canvas" width="$GODOT_CANVAS_WIDTH" height="$GODOT_CANVAS_HEIGHT" onclick="canvas.ownerDocument.defaultView.focus();" oncontextmenu="event.preventDefault();">
- HTML5 canvas appears to be unsupported in the current browser.<br />Please try updating or use a different browser.
+ HTML5 canvas appears to be unsupported in the current browser.<br />
+ Please try updating or use a different browser.
</canvas>
<div id="status-container">
- <span id="status" class="godot" onclick="this.style.visibility='hidden';">Loading page...</span>
+ <span id="status" class="godot" onclick="this.style.visibility='hidden';">Downloading page...</span>
</div>
<div id="controls" class="godot">
- <label id="display-output"><input id="output-toggle" type="checkbox" autocomplete="off" onchange="Presentation.setOutputVisible(this.checked);" />display output</label>
+ <label id="output-toggle"><input type="checkbox" checked="checked" autocomplete="off" onchange="Presentation.setOutputVisible(this.checked);" />Display Output</label>
<!-- hidden until implemented
- <label><input id="lock-cursor" type="checkbox" autocomplete="off" />lock cursor</label>
- <label><input id="resize-canvas" type="checkbox" autocomplete="off" />resize canvas</label>
+ <label><input class="postRun-enable" type="checkbox" disabled="disabled" autocomplete="off" />lock cursor</label>
+ <label><input class="postRun-enable" type="checkbox" disabled="disabled" autocomplete="off" onchange="Presentation.setCanvasMaximized(this.checked);" />maximize</label>
-->
- <button id="fullscreen" class="godot" type="button" disabled="disabled" autocomplete="off" onclick="Presentation.goFullscreen();">fullscreen</button>
+ <button id="fullscreen" class="godot postRun-enable" type="button" disabled="disabled" autocomplete="off" onclick="Presentation.requestFullscreen();">Fullscreen</button>
</div>
</div>
- <!-- Firefox adds extra space to textarea, but shouldn't matter too much https://bugzilla.mozilla.org/show_bug.cgi?id=33654 -->
- <textarea id="output" rows="10" cols="100" readonly="readonly" style="resize:none"></textarea>
+ <div id="output-panel" class="godot">
+ <div id="output-header">
+ Output:
+ <button class="godot" type="button" autocomplete="off" onclick="Presentation.clearOutput();">Clear</button>
+ </div>
+ <div id="output-container"><div id="output-scroll"></div></div>
+ </div>
+ <!-- Scripts -->
<script type="text/javascript">//<![CDATA[
var Presentation = (function() {
var statusElement = document.getElementById("status");
- var outputElement = document.getElementById("output");
- var doneLoading = false;
-
- function onLoaded() {
- doneLoading = true;
- var fullscreenButtonElement = document.getElementById("fullscreen");
- fullscreenButtonElement.disabled = false;
- }
+ var canvasElement = document.getElementById("canvas");
var presentation = {
- statusElement: statusElement,
- outputElement: outputElement,
- setOutputVisible: function setOutputVisible(visible) {
- outputElement.style.display = (visible?"block":"none");
+ postRun: [
+ function() {
+ var elements = document.getElementsByClassName("postRun-enable");
+ Array.prototype.slice.call(elements).forEach(function(element) {
+ element.disabled = false;
+ });
+ }
+ ],
+ requestFullscreen: function requestFullscreen() {
+ if (typeof Module !== "undefined" && Module.requestFullscreen) {
+ Module.requestFullscreen(false, false);
+ }
+ },
+ /*
+ requestPointerlock: function requestPointerlock() {
+ if (typeof Module !== "undefined" && Module.requestPointerlock) {
+ Module.requestPointerlock(false, false);
+ }
},
+ setCanvasMaximized: function setCanvasMaximized(enabled) {
+ if (typeof Module !== "undefined" && Module.setCanvasMaximized) {
+ Module.setCanvasMaximized(enabled);
+ }
+ },
+ */
setStatusVisible: function setStatusVisible(visible) {
statusElement.style.visibility = (visible?"visible":"hidden");
},
setStatus: function setStatus(text) {
- if (!text || text.length === 0) {
- Presentation.setStatusVisible(false);
- onLoaded();
- } else {
- Presentation.setStatusVisible(true);
- statusElement.innerHTML = text;
+ if (text.length === 0) {
+ // emscripten sets empty string as status after "Running..."
+ // per timeout, but another status may have been set by then
+ if (Presentation.setStatus.lastText === "Running...")
+ Presentation.setStatusVisible(false);
+ return;
}
+ Presentation.setStatus.lastText = text;
+ while (statusElement.lastChild) {
+ statusElement.removeChild(statusElement.lastChild);
+ }
+ var lines = text.split("\n");
+ lines.forEach(function(line, index) {
+ statusElement.appendChild(document.createTextNode(line));
+ statusElement.appendChild(document.createElement("br"));
+ });
+ var closeNote = document.createElement("span");
+ closeNote.style.fontSize = "small";
+ closeNote.textContent = "click to close";
+ statusElement.appendChild(closeNote);
+ Presentation.setStatusVisible(true);
+ },
+ isWebGLAvailable: function isWebGLAvailable() {
+ var context;
+ try {
+ context = canvasElement.getContext("webgl") || canvasElement.getContext("experimental-webgl");
+ } catch (e) {}
+ return !!context;
},
- goFullscreen: function goFullscreen() {
- if (doneLoading) Module.requestFullScreen(false, false);
- }
};
+ window.onerror = function(event) { presentation.setStatus("Failure during start-up\nSee JavaScript console") };
+
if ($GODOT_CONTROLS_ENABLED) { // controls enabled
- (function() {
- var controlsElement = document.getElementById("controls");
- controlsElement.style.visibility="visible";
- })();
+ document.getElementById("controls").style.visibility="visible";
}
if ($GODOT_DEBUG_ENABLED) { // debugging enabled
- (function() {
- var outputToggleLabel = document.getElementById("display-output");
- var outputToggle = document.getElementById("output-toggle");
-
- outputElement.value = ""; // clear browser cache
- outputElement.style.display = "block";
- outputToggle.checked = true;
- outputToggleLabel.style.display = "inline";
-
- presentation.print = function print(text) {
- if (outputElement.value.length !== 0)
- outputElement.value += "\n";
- outputElement.value += text;
- outputElement.scrollTop = outputElement.scrollHeight; // focus on bottom
- };
- })();
+ var outputRoot = document.getElementById("output-panel");
+ var outputElement = document.getElementById("output-scroll");
+ var outputToggle = document.getElementById("output-toggle");
+ const maxOutputMessages = 400;
+
+ presentation.setOutputVisible = function setOutputVisible(visible) {
+ outputRoot.style.display = (visible?"block":"none");
+ };
+ presentation.clearOutput = function clearOutput() {
+ while (outputElement.firstChild) {
+ outputElement.firstChild.remove();
+ }
+ };
+
+ presentation.setOutputVisible(true);
+ outputToggle.style.display = "inline";
+
+ presentation.print = function print(text) {
+ if (arguments.length > 1) {
+ text = Array.prototype.slice.call(arguments).join(" ");
+ }
+ if (text.length <= 0) return;
+ while (outputElement.childElementCount >= maxOutputMessages) {
+ outputElement.firstChild.remove();
+ }
+ var msg = document.createElement("div");
+ if (text.trim().startsWith("**ERROR**")
+ || text.startsWith("**EXCEPTION**")) {
+ msg.style.color = "#d44";
+ } else if (text.trim().startsWith("**WARNING**")) {
+ msg.style.color = "#ccc000";
+ } else if (text.trim().startsWith("**SCRIPT ERROR**")) {
+ msg.style.color = "#c6d";
+ }
+ msg.textContent = text;
+ var scrollToBottom = outputElement.scrollHeight - (outputElement.clientHeight + outputElement.scrollTop) < 10;
+ outputElement.appendChild(msg);
+ if (scrollToBottom) {
+ outputElement.scrollTop = outputElement.scrollHeight;
+ }
+ };
+
+ presentation.postRun.push(function() {
+ window.onerror = function(event) { presentation.print("**EXCEPTION**:", event) };
+ });
+
+ } else {
+ presentation.postRun.push(function() { window.onerror = null; });
}
return presentation;
})();
// Emscripten interface
- var Module = (function() {
- var print = (function() {
- if (typeof Presentation.print === "function") {
- return function print(text) {
- if (arguments.length > 1)
- text = Array.prototype.slice.call(arguments).join(" ");
- console.log(text);
- Presentation.print(text);
- };
- } else {
- return function print(text) {
- if (arguments.length > 1)
- text = Array.prototype.slice.call(arguments).join(" ");
- console.log(text);
- };
+ var Module = {
+ TOTAL_MEMORY: $GODOT_TMEM,
+ postRun: (function() {
+ if (typeof Presentation !== "undefined" && Presentation.postRun instanceof Array) {
+ return Presentation.postRun;
}
- })();
-
- var canvas = (function() {
- var canvasElement = document.getElementById("canvas");
-
+ })(),
+ print: function print(text) {
+ if (arguments.length > 1) {
+ text = Array.prototype.slice.call(arguments).join(" ");
+ }
+ console.log(text);
+ if (typeof Presentation !== "undefined" && typeof Presentation.print === "function") {
+ Presentation.print(text);
+ }
+ },
+ printErr: function printErr(text) {
+ if (arguments.length > 1) {
+ text = Array.prototype.slice.call(arguments).join(" ");
+ }
+ console.error(text);
+ if (typeof Presentation !== "undefined" && typeof Presentation.print === "function") {
+ Presentation.print("**ERROR**:", text)
+ }
+ },
+ canvas: (function() {
+ var canvas = document.getElementById("canvas");
// As a default initial behavior, pop up an alert when WebGL context is lost. To make your
// application robust, you may want to override this behavior before shipping!
// See http://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15.2
- canvasElement.addEventListener("webglcontextlost", function(e) { alert("WebGL context lost. Plase reload the page."); e.preventDefault(); }, false);
-
- return canvasElement;
- })();
-
- var setStatus = (function() {
- if (typeof Presentation.setStatus === "function")
- return function setStatus(text) {
- if (!Module.setStatus.last)
- Module.setStatus.last = { time: Date.now(), text: "" };
- if (text === Module.setStatus.text)
- return;
- var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
- var now = Date.now();
- if (m) {
- if (now - Date.now() < 30) // if this is a progress update, skip it if too soon
- return;
- text = m[1];
- }
- Presentation.setStatus(text);
- };
- else
- return function setStatus(text) {
- if (!Module.setStatus.last)
- Module.setStatus.last = { time: Date.now(), text: "" };
- if (text === Module.setStatus.text)
- return;
- var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
- var now = Date.now();
- if (m) {
- if (now - Date.now() < 30) // if this is a progress update, skip it if too soon
- return;
- text = m[1];
- }
- };
- })();
-
- return {
- TOTAL_MEMORY: 268435456,
- preRun: [],
- postRun: [],
- print: print,
- printErr: function printErr(text) {
- if (arguments.length > 1)
- text = Array.prototype.slice.call(arguments).join(" ");
- if (0) { // XXX disabled for safety `if (typeof dump == "function")`
- dump(text + "\n"); // fast, straight to the real console
- } else {
- console.error(text);
- }
- },
- canvas: canvas,
- setStatus: setStatus,
- totalDependencies: 0,
- monitorRunDependencies: function monitorRunDependencies(left) {
- this.totalDependencies = Math.max(this.totalDependencies, left);
- Module.setStatus(left ? "Preparing... (" + (this.totalDependencies-left) + "/" + this.totalDependencies + ")" : "All downloads complete.");
+ canvas.addEventListener("webglcontextlost", function(e) { alert("WebGL context lost. Plase reload the page."); e.preventDefault(); }, false);
+ return canvas;
+
+ })(),
+ setStatus: function setStatus(text) {
+ var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
+ var now = Date.now();
+ if (m) {
+ if (now - Date.now() < 30) // if this is a progress update, skip it if too soon
+ return;
+ text = m[1];
}
- };
- })();
+ if (typeof Presentation !== "undefined" && typeof Presentation.setStatus == "function") {
+ Presentation.setStatus(text);
+ }
+ }
+ };
- Presentation.setStatus("Downloading...");
+ if (!Presentation.isWebGLAvailable()) {
+ Presentation.setStatus("WebGL appears to be unsupported in the current browser.\nPlease try updating or use a different browser.");
+ Presentation.preventLoading = true;
+ } else {
+ Presentation.setStatus("Downloading...");
+ }
- window.onerror = function(event) {
- // TODO: do not warn on ok events like simulating an infinite loop or exitStatus
- Module.setStatus("Exception thrown, see JavaScript console");
- Module.setStatus = function(text) {
- if (text) Module.printErr("[post-exception status] " + text);
- };
- };
+ if (Presentation.preventLoading) {
+ // prevent *fs.js and Emscripten's SCRIPT placeholder from loading any files
+ Presentation._XHR_send = XMLHttpRequest.prototype.send;
+ XMLHttpRequest.prototype.send = function() {};
+ Presentation._Node_appendChild = Node.prototype.appendChild;
+ Node.prototype.appendChild = function(node) {
+ if (!(node instanceof HTMLScriptElement)) {
+ return Presentation._Node_appendChild.call(this, node);
+ }
+ }
+ }
//]]></script>
<script type="text/javascript" src="$GODOT_BASEfs.js"></script>
- {{{ SCRIPT }}}
+{{{ SCRIPT }}}
+ <script type="text/javascript">
+ if (Presentation.preventLoading) {
+ XMLHttpRequest.prototype.send = Presentation._XHR_send;
+ Node.prototype.appendChild = Presentation._Node_appendChild;
+ }
+ </script>
</body>
</html>
diff --git a/platform/javascript/javascript_eval.cpp b/platform/javascript/javascript_eval.cpp
index e642300bda..a79e5473c2 100644
--- a/platform/javascript/javascript_eval.cpp
+++ b/platform/javascript/javascript_eval.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 */
@@ -41,6 +41,7 @@ JavaScript *JavaScript::get_singleton() {
Variant JavaScript::eval(const String& p_code, bool p_use_global_exec_context) {
union { int i; double d; char* s; } js_data[4];
+ /* clang-format off */
Variant::Type return_type = static_cast<Variant::Type>(EM_ASM_INT({
var eval_ret;
@@ -49,8 +50,7 @@ Variant JavaScript::eval(const String& p_code, bool p_use_global_exec_context) {
// indirect eval call grants global execution context
var global_eval = eval;
eval_ret = global_eval(UTF8ToString($2));
- }
- else {
+ } else {
eval_ret = eval(UTF8ToString($2));
}
} catch (e) {
@@ -125,6 +125,7 @@ Variant JavaScript::eval(const String& p_code, bool p_use_global_exec_context) {
return 0; // NIL
}, js_data, sizeof *js_data, p_code.utf8().get_data(), p_use_global_exec_context));
+ /* clang-format on */
switch(return_type) {
case Variant::BOOL:
@@ -136,7 +137,9 @@ Variant JavaScript::eval(const String& p_code, bool p_use_global_exec_context) {
case Variant::STRING:
{
String str = String::utf8(js_data->s);
+ /* clang-format off */
EM_ASM_({ _free($0); }, js_data->s);
+ /* clang-format on */
return str;
}
case Variant::VECTOR2:
diff --git a/platform/javascript/javascript_eval.h b/platform/javascript/javascript_eval.h
index e5f6268076..679224d519 100644
--- a/platform/javascript/javascript_eval.h
+++ b/platform/javascript/javascript_eval.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 */
@@ -35,7 +35,7 @@
class JavaScript : public Object {
private:
- OBJ_TYPE( JavaScript, Object );
+ GDCLASS( JavaScript, Object );
static JavaScript *singleton;
diff --git a/platform/javascript/javascript_main.cpp b/platform/javascript/javascript_main.cpp
index d9342cfe10..94320d53c1 100644
--- a/platform/javascript/javascript_main.cpp
+++ b/platform/javascript/javascript_main.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 */
@@ -66,11 +66,12 @@ static void _glut_mouse_button(int button, int state, int x, int y) {
if (ev.mouse_button.button_index<4) {
if (ev.mouse_button.pressed) {
- _mouse_button_mask|=1<<ev.mouse_button.button_index;
+ _mouse_button_mask |= 1 << (ev.mouse_button.button_index-1);
} else {
- _mouse_button_mask&=~(1<<ev.mouse_button.button_index);
+ _mouse_button_mask &= ~(1 << (ev.mouse_button.button_index-1));
}
}
+ ev.mouse_button.button_mask=_mouse_button_mask;
uint32_t m = glutGetModifiers();
ev.mouse_button.mod.alt=(m&GLUT_ACTIVE_ALT)!=0;
@@ -79,6 +80,11 @@ static void _glut_mouse_button(int button, int state, int x, int y) {
os->push_input(ev);
+ if (ev.mouse_button.button_index==BUTTON_WHEEL_UP || ev.mouse_button.button_index==BUTTON_WHEEL_DOWN) {
+ // GLUT doesn't send release events for mouse wheel, so send manually
+ ev.mouse_button.pressed=false;
+ os->push_input(ev);
+ }
}
@@ -134,10 +140,9 @@ static void _godot_draw(void) {
extern "C" {
-void main_after_fs_sync(int value) {
+void main_after_fs_sync() {
start_step=1;
- printf("FS SYNCHED!\n");
}
}
@@ -148,13 +153,13 @@ int main(int argc, char *argv[]) {
/* Initialize the window */
printf("let it go!\n");
glutInit(&argc, argv);
- os = new OS_JavaScript(_gfx_init,NULL,NULL,NULL,NULL);
+ os = new OS_JavaScript(_gfx_init,NULL,NULL);
#if 0
char *args[]={"-test","gui","-v",NULL};
Error err = Main::setup("apk",3,args);
#else
-// char *args[]={"-v",NULL};//
-// Error err = Main::setup("",1,args);
+ //char *args[]={"-v",NULL};//
+ //Error err = Main::setup("",1,args);
Error err = Main::setup("",0,NULL);
#endif
@@ -162,7 +167,6 @@ int main(int argc, char *argv[]) {
glutMouseFunc(_glut_mouse_button);
glutMotionFunc(_glut_mouse_motion);
- glutMotionFunc(_glut_mouse_motion);
glutPassiveMotionFunc(_glut_mouse_motion);
@@ -173,26 +177,27 @@ int main(int argc, char *argv[]) {
glutDisplayFunc(_godot_draw);
//glutSpecialFunc(gears_special);
-
-
- //mount persistent filesystem
- EM_ASM(
- FS.mkdir('/userfs');
- FS.mount(IDBFS, {}, '/userfs');
-
-
-
- // sync from persisted state into memory and then
- // run the 'test' function
- FS.syncfs(true, function (err) {
- assert(!err);
- console.log("done syncinc!");
- _after_sync_cb = Module.cwrap('main_after_fs_sync', 'void',['number']);
- _after_sync_cb(0);
-
- });
-
- );
+ //mount persistent file system
+ /* clang-format off */
+ EM_ASM(
+ FS.mkdir('/userfs');
+ FS.mount(IDBFS, {}, '/userfs');
+
+ // sync from persistent state into memory and then
+ // run the 'main_after_fs_sync' function
+ FS.syncfs(true, function(err) {
+
+ if (err) {
+ Module.setStatus('Failed to load persistent data\nPlease allow (third-party) cookies');
+ Module.printErr('Failed to populate IDB file system: ' + err.message);
+ Module.exit();
+ } else {
+ Module.print('Successfully populated IDB file system');
+ ccall('main_after_fs_sync', 'void', []);
+ }
+ });
+ );
+ /* clang-format on */
glutMainLoop();
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index e802a7e9cb..317a6676a4 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.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 */
@@ -27,23 +27,24 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "os_javascript.h"
+
#include "drivers/gles2/rasterizer_gles2.h"
#include "core/io/file_access_buffered_fa.h"
#include "drivers/unix/file_access_unix.h"
#include "drivers/unix/dir_access_unix.h"
-
#include "servers/visual/visual_server_raster.h"
-
#include "main/main.h"
-
#include "core/globals.h"
-#include "emscripten.h"
#include "dom_keys.h"
+#include <stdlib.h>
+#include <emscripten.h>
+
int OS_JavaScript::get_video_driver_count() const {
return 1;
}
+
const char * OS_JavaScript::get_video_driver_name(int p_driver) const {
return "GLES2";
@@ -77,6 +78,59 @@ void OS_JavaScript::set_opengl_extensions(const char* p_gl_extensions) {
gl_extensions=p_gl_extensions;
}
+static EM_BOOL _browser_resize_callback(int event_type, const EmscriptenUiEvent *ui_event, void *user_data) {
+
+ ERR_FAIL_COND_V(event_type!=EMSCRIPTEN_EVENT_RESIZE, false);
+
+ OS_JavaScript* os = static_cast<OS_JavaScript*>(user_data);
+
+ // the order in which _browser_resize_callback and
+ // _fullscreen_change_callback are called is browser-dependent,
+ // so try adjusting for fullscreen in both
+ if (os->is_window_fullscreen() || os->is_window_maximized()) {
+
+ OS::VideoMode vm = os->get_video_mode();
+ vm.width = ui_event->windowInnerWidth;
+ vm.height = ui_event->windowInnerHeight;
+ os->set_video_mode(vm);
+ emscripten_set_canvas_size(ui_event->windowInnerWidth, ui_event->windowInnerHeight);
+ }
+ return false;
+}
+
+static Size2 _windowed_size;
+
+static EM_BOOL _fullscreen_change_callback(int event_type, const EmscriptenFullscreenChangeEvent *event, void *user_data) {
+
+ ERR_FAIL_COND_V(event_type!=EMSCRIPTEN_EVENT_FULLSCREENCHANGE, false);
+
+ OS_JavaScript* os = static_cast<OS_JavaScript*>(user_data);
+ String id = String::utf8(event->id);
+
+ // empty id is canvas
+ if (id.empty() || id=="canvas") {
+
+ OS::VideoMode vm = os->get_video_mode();
+ // this event property is the only reliable information on
+ // browser fullscreen state
+ vm.fullscreen = event->isFullscreen;
+
+ if (event->isFullscreen) {
+ vm.width = event->screenWidth;
+ vm.height = event->screenHeight;
+ os->set_video_mode(vm);
+ emscripten_set_canvas_size(vm.width, vm.height);
+ }
+ else {
+ os->set_video_mode(vm);
+ if (!os->is_window_maximized()) {
+ os->set_window_size(_windowed_size);
+ }
+ }
+ }
+ return false;
+}
+
static InputEvent _setup_key_event(const EmscriptenKeyboardEvent *emscripten_event) {
InputEvent ev;
@@ -89,7 +143,9 @@ static InputEvent _setup_key_event(const EmscriptenKeyboardEvent *emscripten_eve
ev.key.scancode = dom2godot_scancode(emscripten_event->keyCode);
String unicode = String::utf8(emscripten_event->key);
+ // check if empty or multi-character (e.g. `CapsLock`)
if (unicode.length()!=1) {
+ // might be empty as well, but better than nonsense
unicode = String::utf8(emscripten_event->charValue);
}
if (unicode.length()==1) {
@@ -151,20 +207,45 @@ void OS_JavaScript::initialize(const VideoMode& p_desired,int p_video_driver,int
if (gfx_init_func)
gfx_init_func(gfx_init_ud,use_gl2,p_desired.width,p_desired.height,p_desired.fullscreen);
- default_videomode=p_desired;
+ // nothing to do here, can't fulfil fullscreen request due to
+ // browser security, window size is already set from HTML
+ video_mode=p_desired;
+ video_mode.fullscreen=false;
+ _windowed_size=get_window_size();
+
+ // find locale, emscripten only sets "C"
+ char locale_ptr[16];
+ /* clang-format off */
+ EM_ASM_({
+ var locale = "";
+ if (Module.locale) {
+ // best case: server-side script reads Accept-Language early and
+ // defines the locale to be read here
+ locale = Module.locale;
+ } else {
+ // no luck, use what the JS engine can tell us
+ // if this turns out not compatible enough, add tests for
+ // browserLanguage, systemLanguage and userLanguage
+ locale = navigator.languages ? navigator.languages[0] : navigator.language;
+ }
+ locale = locale.split('.')[0];
+ stringToUTF8(locale, $0, 16);
+ }, locale_ptr);
+ /* clang-format on */
+ setenv("LANG", locale_ptr, true);
print_line("Init Audio");
- AudioDriverManagerSW::add_driver(&audio_driver_javascript);
+ AudioDriverManager::add_driver(&audio_driver_javascript);
if (true) {
- RasterizerGLES2 *rasterizer_gles22=memnew( RasterizerGLES2(false,false,false,false) );;
+ RasterizerGLES2 *rasterizer_gles22=memnew( RasterizerGLES2(false,false,false,false) );
rasterizer_gles22->set_use_framebuffers(false); //not supported by emscripten
if (gl_extensions)
rasterizer_gles22->set_extensions(gl_extensions);
rasterizer = rasterizer_gles22;
} else {
-// rasterizer = memnew( RasterizerGLES1(true, false) );
+ //rasterizer = memnew( RasterizerGLES1(true, false) );
}
print_line("Init VS");
@@ -180,27 +261,6 @@ void OS_JavaScript::initialize(const VideoMode& p_desired,int p_video_driver,int
ERR_PRINT("Initializing audio failed.");
}*/
- print_line("Init SM");
-
- //sample_manager = memnew( SampleManagerMallocSW );
- audio_server = memnew( AudioServerJavascript );
-
- print_line("Init Mixer");
-
- //audio_server->set_mixer_params(AudioMixerSW::INTERPOLATION_LINEAR,false);
- audio_server->init();
-
- print_line("Init SoundServer");
-
- spatial_sound_server = memnew( SpatialSoundServerSW );
- spatial_sound_server->init();
-
- print_line("Init SpatialSoundServer");
-
- spatial_sound_2d_server = memnew( SpatialSound2DServerSW );
- spatial_sound_2d_server->init();
-
- //
print_line("Init Physicsserver");
physics_server = memnew( PhysicsServerSW );
@@ -210,30 +270,27 @@ void OS_JavaScript::initialize(const VideoMode& p_desired,int p_video_driver,int
input = memnew( InputDefault );
- EMSCRIPTEN_RESULT result = emscripten_set_keydown_callback(NULL, this , true, &_keydown_callback);
- if (result!=EMSCRIPTEN_RESULT_SUCCESS) {
- ERR_PRINTS( "Error while setting Emscripten keydown callback: Code " + itos(result) );
- }
- result = emscripten_set_keypress_callback(NULL, this, true, &_keypress_callback);
- if (result!=EMSCRIPTEN_RESULT_SUCCESS) {
- ERR_PRINTS( "Error while setting Emscripten keypress callback: Code " + itos(result) );
- }
- result = emscripten_set_keyup_callback(NULL, this, true, &_keyup_callback);
- if (result!=EMSCRIPTEN_RESULT_SUCCESS) {
- ERR_PRINTS( "Error while setting Emscripten keyup callback: Code " + itos(result) );
- }
- result = emscripten_set_gamepadconnected_callback(NULL, true, &joy_callback_func);
- if (result!=EMSCRIPTEN_RESULT_SUCCESS) {
- ERR_PRINTS( "Error while setting Emscripten gamepadconnected callback: Code " + itos(result) );
- }
- result = emscripten_set_gamepaddisconnected_callback(NULL, true, &joy_callback_func);
- if (result!=EMSCRIPTEN_RESULT_SUCCESS) {
- ERR_PRINTS( "Error while setting Emscripten gamepaddisconnected callback: Code " + itos(result) );
- }
+#define EM_CHECK(ev) if (result!=EMSCRIPTEN_RESULT_SUCCESS)\
+ ERR_PRINTS("Error while setting " #ev " callback: Code " + itos(result))
+#define SET_EM_CALLBACK(ev, cb) result = emscripten_set_##ev##_callback(NULL, this, true, &cb); EM_CHECK(ev)
+#define SET_EM_CALLBACK_NODATA(ev, cb) result = emscripten_set_##ev##_callback(NULL, true, &cb); EM_CHECK(ev)
+
+ EMSCRIPTEN_RESULT result;
+ SET_EM_CALLBACK(keydown, _keydown_callback)
+ SET_EM_CALLBACK(keypress, _keypress_callback)
+ SET_EM_CALLBACK(keyup, _keyup_callback)
+ SET_EM_CALLBACK(resize, _browser_resize_callback)
+ SET_EM_CALLBACK(fullscreenchange, _fullscreen_change_callback)
+ SET_EM_CALLBACK_NODATA(gamepadconnected, joy_callback_func)
+ SET_EM_CALLBACK_NODATA(gamepaddisconnected, joy_callback_func)
+
+#undef SET_EM_CALLBACK_NODATA
+#undef SET_EM_CALLBACK
+#undef EM_CHECK
#ifdef JAVASCRIPT_EVAL_ENABLED
javascript_eval = memnew(JavaScript);
- Globals::get_singleton()->add_singleton(Globals::Singleton("JavaScript", javascript_eval));
+ GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("JavaScript", javascript_eval));
#endif
}
@@ -254,32 +311,13 @@ void OS_JavaScript::finalize() {
memdelete(input);
}
+void OS_JavaScript::alert(const String& p_alert,const String& p_title) {
-void OS_JavaScript::vprint(const char* p_format, va_list p_list, bool p_stderr) {
-
- if (p_stderr) {
-
- vfprintf(stderr,p_format,p_list);
- fflush(stderr);
- } else {
-
- vprintf(p_format,p_list);
- fflush(stdout);
- }
-}
-
-void OS_JavaScript::print(const char *p_format, ... ) {
-
- va_list argp;
- va_start(argp, p_format);
- vprintf(p_format, argp );
- va_end(argp);
-
-}
-
-void OS_JavaScript::alert(const String& p_alert) {
-
- print("ALERT: %s\n",p_alert.utf8().get_data());
+ /* clang-format off */
+ EM_ASM_({
+ window.alert(UTF8ToString($0));
+ }, p_alert.utf8().get_data());
+ /* clang-format on */
}
@@ -298,17 +336,24 @@ bool OS_JavaScript::is_mouse_grab_enabled() const {
//*sigh* technology has evolved so much since i was a kid..
return false;
}
+
Point2 OS_JavaScript::get_mouse_pos() const {
- return Point2();
+ return input->get_mouse_pos();
}
+
int OS_JavaScript::get_mouse_button_state() const {
- return 0;
+ return last_button_mask;
}
-void OS_JavaScript::set_window_title(const String& p_title) {
+void OS_JavaScript::set_window_title(const String& p_title) {
+ /* clang-format off */
+ EM_ASM_({
+ document.title = UTF8ToString($0);
+ }, p_title.utf8().get_data());
+ /* clang-format on */
}
//interesting byt not yet
@@ -317,22 +362,96 @@ void OS_JavaScript::set_window_title(const String& p_title) {
void OS_JavaScript::set_video_mode(const VideoMode& p_video_mode,int p_screen) {
-
+ video_mode = p_video_mode;
}
OS::VideoMode OS_JavaScript::get_video_mode(int p_screen) const {
- return default_videomode;
+ return video_mode;
+}
+
+Size2 OS_JavaScript::get_screen_size(int p_screen) const {
+
+ ERR_FAIL_COND_V(p_screen!=0, Size2());
+
+ EmscriptenFullscreenChangeEvent ev;
+ EMSCRIPTEN_RESULT result = emscripten_get_fullscreen_status(&ev);
+ ERR_FAIL_COND_V(result!=EMSCRIPTEN_RESULT_SUCCESS, Size2());
+ return Size2(ev.screenWidth, ev.screenHeight);
+}
+
+void OS_JavaScript::set_window_size(const Size2 p_size) {
+
+ window_maximized = false;
+ if (is_window_fullscreen()) {
+ set_window_fullscreen(false);
+ }
+ _windowed_size = p_size;
+ video_mode.width = p_size.x;
+ video_mode.height = p_size.y;
+ emscripten_set_canvas_size(p_size.x, p_size.y);
}
Size2 OS_JavaScript::get_window_size() const {
- return Vector2(default_videomode.width,default_videomode.height);
+ int canvas[3];
+ emscripten_get_canvas_size(canvas, canvas+1, canvas+2);
+ return Size2(canvas[0], canvas[1]);
+}
+
+void OS_JavaScript::set_window_maximized(bool p_enabled) {
+
+ window_maximized = p_enabled;
+ if (p_enabled) {
+
+ if (is_window_fullscreen()) {
+ // _browser_resize callback will set canvas size
+ set_window_fullscreen(false);
+ }
+ else {
+ /* clang-format off */
+ video_mode.width = EM_ASM_INT_V(return window.innerWidth);
+ video_mode.height = EM_ASM_INT_V(return window.innerHeight);
+ /* clang-format on */
+ emscripten_set_canvas_size(video_mode.width, video_mode.height);
+ }
+ }
+ else {
+ set_window_size(_windowed_size);
+ }
+}
+
+void OS_JavaScript::set_window_fullscreen(bool p_enable) {
+
+ if (p_enable==is_window_fullscreen()) {
+ return;
+ }
+
+ // only requesting changes here, if successful, canvas is resized in
+ // _browser_resize_callback or _fullscreen_change_callback
+ EMSCRIPTEN_RESULT result;
+ if (p_enable) {
+ /* clang-format off */
+ EM_ASM(Module.requestFullscreen(false, false););
+ /* clang-format on */
+ }
+ else {
+ result = emscripten_exit_fullscreen();
+ if (result!=EMSCRIPTEN_RESULT_SUCCESS) {
+ ERR_PRINTS("Failed to exit fullscreen: Code " + itos(result));
+ }
+ }
+}
+
+bool OS_JavaScript::is_window_fullscreen() const {
+
+ return video_mode.fullscreen;
}
void OS_JavaScript::get_fullscreen_mode_list(List<VideoMode> *p_list,int p_screen) const {
- p_list->push_back(default_videomode);
+ Size2 screen = get_screen_size();
+ p_list->push_back(OS::VideoMode(screen.width, screen.height, true));
}
String OS_JavaScript::get_name() {
@@ -372,24 +491,20 @@ bool OS_JavaScript::main_loop_iterate() {
time_to_save_sync-=elapsed;
- print_line("elapsed "+itos(elapsed)+" tts "+itos(time_to_save_sync));
-
if (time_to_save_sync<0) {
//time to sync, for real
- // run 'success'
- print_line("DOING SYNCH!");
+ /* clang-format off */
EM_ASM(
- FS.syncfs(function (err) {
- assert(!err);
- console.log("Synched!");
- //ccall('success', 'v');
- });
+ FS.syncfs(function(err) {
+ if (err) { Module.printErr('Failed to save IDB file system: ' + err.message); }
+ });
);
+ /* clang-format on */
}
}
- process_joysticks();
+ process_joypads();
return Main::iteration();
}
@@ -423,12 +538,15 @@ void OS_JavaScript::push_input(const InputEvent& p_ev) {
if (ev.type==InputEvent::MOUSE_MOTION) {
input->set_mouse_pos(Point2(ev.mouse_motion.x, ev.mouse_motion.y));
}
+ else if (ev.type==InputEvent::MOUSE_BUTTON) {
+ last_button_mask = ev.mouse_button.button_mask;
+ }
input->parse_input_event(p_ev);
}
void OS_JavaScript::process_touch(int p_what,int p_pointer, const Vector<TouchPos>& p_points) {
-// print_line("ev: "+itos(p_what)+" pnt: "+itos(p_pointer)+" pointc: "+itos(p_points.size()));
+ //print_line("ev: "+itos(p_what)+" pnt: "+itos(p_pointer)+" pointc: "+itos(p_points.size()));
switch(p_what) {
case 0: { //gesture begin
@@ -511,8 +629,8 @@ void OS_JavaScript::process_touch(int p_what,int p_pointer, const Vector<TouchPo
ev.mouse_motion.x=p_points[0].pos.x;
ev.mouse_motion.y=p_points[0].pos.y;
input->set_mouse_pos(Point2(ev.mouse_motion.x,ev.mouse_motion.y));
- ev.mouse_motion.speed_x=input->get_mouse_speed().x;
- ev.mouse_motion.speed_y=input->get_mouse_speed().y;
+ ev.mouse_motion.speed_x=input->get_last_mouse_speed().x;
+ ev.mouse_motion.speed_y=input->get_last_mouse_speed().y;
ev.mouse_motion.relative_x=p_points[0].pos.x-last_mouse.x;
ev.mouse_motion.relative_y=p_points[0].pos.y-last_mouse.y;
last_mouse=p_points[0].pos;
@@ -649,48 +767,42 @@ void OS_JavaScript::main_loop_request_quit() {
main_loop->notification(MainLoop::NOTIFICATION_WM_QUIT_REQUEST);
}
-void OS_JavaScript::set_display_size(Size2 p_size) {
-
- default_videomode.width=p_size.x;
- default_videomode.height=p_size.y;
-}
-
void OS_JavaScript::reload_gfx() {
if (gfx_init_func)
- gfx_init_func(gfx_init_ud,use_gl2,default_videomode.width,default_videomode.height,default_videomode.fullscreen);
+ gfx_init_func(gfx_init_ud,use_gl2,video_mode.width,video_mode.height,video_mode.fullscreen);
if (rasterizer)
rasterizer->reload_vram();
}
Error OS_JavaScript::shell_open(String p_uri) {
-
- if (open_uri_func)
- return open_uri_func(p_uri)?ERR_CANT_OPEN:OK;
- return ERR_UNAVAILABLE;
-};
+ /* clang-format off */
+ EM_ASM_({
+ window.open(UTF8ToString($0), '_blank');
+ }, p_uri.utf8().get_data());
+ /* clang-format on */
+ return OK;
+}
String OS_JavaScript::get_resource_dir() const {
return "/"; //javascript has it's own filesystem for resources inside the APK
}
-String OS_JavaScript::get_locale() const {
-
- if (get_locale_func)
- return get_locale_func();
- return OS_Unix::get_locale();
-}
-
-
String OS_JavaScript::get_data_dir() const {
- //if (get_data_dir_func)
- // return get_data_dir_func();
+ /*
+ if (get_data_dir_func)
+ return get_data_dir_func();
+ */
return "/userfs";
- //return Globals::get_singleton()->get_singleton_object("GodotOS")->call("get_data_dir");
+ //return GlobalConfig::get_singleton()->get_singleton_object("GodotOS")->call("get_data_dir");
};
+String OS_JavaScript::get_executable_path() const {
+
+ return String();
+}
void OS_JavaScript::_close_notification_funcs(const String& p_file,int p_flags) {
@@ -701,7 +813,7 @@ void OS_JavaScript::_close_notification_funcs(const String& p_file,int p_flags)
}
}
-void OS_JavaScript::process_joysticks() {
+void OS_JavaScript::process_joypads() {
int joy_count = emscripten_get_num_gamepads();
for (int i = 0; i < joy_count; i++) {
@@ -757,24 +869,18 @@ String OS_JavaScript::get_joy_guid(int p_device) const {
return input->get_joy_guid_remapped(p_device);
}
-OS_JavaScript::OS_JavaScript(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) {
-
-
- default_videomode.width=800;
- default_videomode.height=600;
- default_videomode.fullscreen=true;
- default_videomode.resizable=false;
+OS_JavaScript::OS_JavaScript(GFXInitFunc p_gfx_init_func,void*p_gfx_init_ud, GetDataDirFunc p_get_data_dir_func) {
gfx_init_func=p_gfx_init_func;
gfx_init_ud=p_gfx_init_ud;
+ last_button_mask=0;
main_loop=NULL;
last_id=1;
gl_extensions=NULL;
rasterizer=NULL;
+ window_maximized=false;
- open_uri_func=p_open_uri_func;
get_data_dir_func=p_get_data_dir_func;
- get_locale_func=p_get_locale_func;
FileAccessUnix::close_notification_func=_close_notification_funcs;
time_to_save_sync=-1;
diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h
index 5b7904805b..d11494a8aa 100644
--- a/platform/javascript/os_javascript.h
+++ b/platform/javascript/os_javascript.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 */
@@ -35,19 +35,18 @@
#include "servers/physics/physics_server_sw.h"
#include "servers/spatial_sound/spatial_sound_server_sw.h"
#include "servers/spatial_sound_2d/spatial_sound_2d_server_sw.h"
-#include "servers/audio/audio_server_sw.h"
+#include "servers/audio_server.h"
#include "servers/physics_2d/physics_2d_server_sw.h"
#include "servers/visual/rasterizer.h"
#include "audio_server_javascript.h"
#include "audio_driver_javascript.h"
#include "main/input_default.h"
-#include "emscripten/html5.h"
#include "javascript_eval.h"
+#include <emscripten/html5.h>
+
typedef void (*GFXInitFunc)(void *ud,bool gl2,int w, int h, bool fs);
-typedef int (*OpenURIFunc)(const String&);
typedef String (*GetDataDirFunc)();
-typedef String (*GetLocaleFunc)();
class OS_JavaScript : public OS_Unix {
public:
@@ -61,6 +60,7 @@ private:
Vector<TouchPos> touch;
Point2 last_mouse;
+ int last_button_mask;
unsigned int last_id;
GFXInitFunc gfx_init_func;
void*gfx_init_ud;
@@ -72,22 +72,17 @@ private:
Rasterizer *rasterizer;
VisualServer *visual_server;
- AudioServerJavascript *audio_server;
- //SampleManagerMallocSW *sample_manager;
- SpatialSoundServerSW *spatial_sound_server;
- SpatialSound2DServerSW *spatial_sound_2d_server;
PhysicsServer *physics_server;
Physics2DServer *physics_2d_server;
AudioDriverJavaScript audio_driver_javascript;
const char* gl_extensions;
InputDefault *input;
- VideoMode default_videomode;
+ bool window_maximized;
+ VideoMode video_mode;
MainLoop * main_loop;
- OpenURIFunc open_uri_func;
GetDataDirFunc get_data_dir_func;
- GetLocaleFunc get_locale_func;
#ifdef JAVASCRIPT_EVAL_ENABLED
JavaScript* javascript_eval;
@@ -95,7 +90,7 @@ private:
static void _close_notification_funcs(const String& p_file,int p_flags);
- void process_joysticks();
+ void process_joypads();
public:
@@ -121,9 +116,12 @@ public:
//static OS* get_singleton();
- 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 print_error(const char* p_function, const char* p_file, int p_line, const char *p_code, const char* p_rationale, ErrorType p_type) {
+
+ OS::print_error(p_function, p_file, p_line, p_code, p_rationale, p_type);
+ }
+
+ virtual void alert(const String& p_alert,const String& p_title="ALERT!");
virtual void set_mouse_show(bool p_show);
@@ -140,7 +138,15 @@ public:
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;
+ virtual Size2 get_screen_size(int p_screen=0) const;
+
+ virtual void set_window_size(const Size2);
virtual Size2 get_window_size() const;
+ virtual void set_window_maximized(bool p_enabled);
+ virtual bool is_window_maximized() const { return window_maximized; }
+ virtual void set_window_fullscreen(bool p_enable);
+ virtual bool is_window_fullscreen() const;
+
virtual String get_name();
virtual MainLoop *get_main_loop() const;
@@ -158,14 +164,13 @@ public:
virtual bool has_touchscreen_ui_hint() const;
void set_opengl_extensions(const char* p_gl_extensions);
- void set_display_size(Size2 p_size);
void reload_gfx();
virtual Error shell_open(String p_uri);
virtual String get_data_dir() const;
+ String get_executable_path() const;
virtual String get_resource_dir() const;
- virtual String get_locale() const;
void process_accelerometer(const Vector3& p_accelerometer);
void process_touch(int p_what,int p_pointer, const Vector<TouchPos>& p_points);
@@ -175,7 +180,7 @@ public:
virtual String get_joy_guid(int p_device) const;
bool joy_connection_changed(int p_type, const EmscriptenGamepadEvent *p_event);
- OS_JavaScript(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);
+ OS_JavaScript(GFXInitFunc p_gfx_init_func,void*p_gfx_init_ud, GetDataDirFunc p_get_data_dir_func);
~OS_JavaScript();
};
diff --git a/platform/javascript/platform_config.h b/platform/javascript/platform_config.h
index 143f16c1fa..cdef185ff0 100644
--- a/platform/javascript/platform_config.h
+++ b/platform/javascript/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/osx/SCsub b/platform/osx/SCsub
index 217dee81eb..00f23687cf 100644
--- a/platform/osx/SCsub
+++ b/platform/osx/SCsub
@@ -3,13 +3,13 @@
Import('env')
files = [
- 'os_osx.mm',
- 'godot_main_osx.mm',
- 'audio_driver_osx.cpp',
- 'sem_osx.cpp',
-# 'context_gl_osx.cpp',
- 'dir_access_osx.mm',
- 'joystick_osx.cpp',
- ]
+ 'os_osx.mm',
+ 'godot_main_osx.mm',
+ 'audio_driver_osx.cpp',
+ 'sem_osx.cpp',
+ # 'context_gl_osx.cpp',
+ 'dir_access_osx.mm',
+ 'joypad_osx.cpp',
+]
-env.Program('#bin/godot',files)
+env.Program('#bin/godot', files)
diff --git a/platform/osx/audio_driver_osx.cpp b/platform/osx/audio_driver_osx.cpp
index d9d91b22fb..4ad3a5b8fc 100644
--- a/platform/osx/audio_driver_osx.cpp
+++ b/platform/osx/audio_driver_osx.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 */
@@ -157,8 +157,8 @@ int AudioDriverOSX::get_mix_rate() const {
return 44100;
};
-AudioDriverSW::OutputFormat AudioDriverOSX::get_output_format() const {
- return OUTPUT_STEREO;
+AudioDriver::SpeakerMode AudioDriverOSX::get_speaker_mode() const {
+ return SPEAKER_MODE_STEREO;
};
void AudioDriverOSX::lock() {
diff --git a/platform/osx/audio_driver_osx.h b/platform/osx/audio_driver_osx.h
index 92893c64dc..9e9bb63726 100644
--- a/platform/osx/audio_driver_osx.h
+++ b/platform/osx/audio_driver_osx.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 */
@@ -31,11 +31,11 @@
#ifndef AUDIO_DRIVER_OSX_H
#define AUDIO_DRIVER_OSX_H
-#include "servers/audio/audio_server_sw.h"
+#include "servers/audio_server.h"
#include <AudioUnit/AudioUnit.h>
-class AudioDriverOSX : public AudioDriverSW {
+class AudioDriverOSX : public AudioDriver {
AudioComponentInstance audio_unit;
bool active;
@@ -61,7 +61,7 @@ public:
virtual Error init();
virtual void start();
virtual int get_mix_rate() const;
- virtual OutputFormat get_output_format() const;
+ virtual SpeakerMode get_speaker_mode() const;
virtual void lock();
virtual void unlock();
virtual void finish();
diff --git a/platform/osx/context_gl_osx.cpp b/platform/osx/context_gl_osx.cpp
index df1c14c643..d0819bbfb6 100644
--- a/platform/osx/context_gl_osx.cpp
+++ b/platform/osx/context_gl_osx.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/osx/context_gl_osx.h b/platform/osx/context_gl_osx.h
index 565a0ee02a..6a02aa23d1 100644
--- a/platform/osx/context_gl_osx.h
+++ b/platform/osx/context_gl_osx.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/osx/detect.py b/platform/osx/detect.py
index 4e772e37eb..ccd86177ab 100644
--- a/platform/osx/detect.py
+++ b/platform/osx/detect.py
@@ -4,99 +4,99 @@ import sys
def is_active():
- return True
+ return True
+
def get_name():
- return "OSX"
+ return "OSX"
+
def can_build():
- if (sys.platform == "darwin" or os.environ.has_key("OSXCROSS_ROOT")):
- return True
+ if (sys.platform == "darwin" or os.environ.has_key("OSXCROSS_ROOT")):
+ return True
+ return False
- return False
def get_opts():
- return [
- ('force_64_bits','Force 64 bits binary','no'),
- ('osxcross_sdk','OSXCross SDK version','darwin14'),
+ return [
+ ('force_64_bits', 'Force 64 bits binary', 'no'),
+ ('osxcross_sdk', 'OSXCross SDK version', 'darwin14'),
- ]
+ ]
-def get_flags():
- return [
- ]
+def get_flags():
+ return [
+ ]
def configure(env):
- env.Append(CPPPATH=['#platform/osx'])
-
- if (env["bits"]=="default"):
- env["bits"]="32"
-
- if (env["target"]=="release"):
-
- env.Append(CCFLAGS=['-O2','-ffast-math','-fomit-frame-pointer','-ftree-vectorize','-msse2'])
-
- elif (env["target"]=="release_debug"):
-
- env.Append(CCFLAGS=['-O2','-DDEBUG_ENABLED'])
-
- elif (env["target"]=="debug"):
-
- env.Append(CCFLAGS=['-g3', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
-
-
-
- if (not os.environ.has_key("OSXCROSS_ROOT")):
- #regular native build
- if (env["bits"]=="64"):
- env.Append(CCFLAGS=['-arch', 'x86_64'])
- env.Append(LINKFLAGS=['-arch', 'x86_64'])
- elif (env["bits"]=="32"):
- env.Append(CCFLAGS=['-arch', 'i386'])
- env.Append(LINKFLAGS=['-arch', 'i386'])
- else:
- env.Append(CCFLAGS=['-arch', 'i386', '-arch', 'x86_64'])
- env.Append(LINKFLAGS=['-arch', 'i386', '-arch', 'x86_64'])
- else:
- #osxcross build
- root=os.environ.get("OSXCROSS_ROOT",0)
- if env["bits"]=="64":
- basecmd=root+"/target/bin/x86_64-apple-"+env["osxcross_sdk"]+"-"
- else:
- basecmd=root+"/target/bin/i386-apple-"+env["osxcross_sdk"]+"-"
-
-
- env['CC'] = basecmd+"cc"
- env['CXX'] = basecmd+"c++"
- env['AR'] = basecmd+"ar"
- env['RANLIB'] = basecmd+"ranlib"
- env['AS'] = basecmd+"as"
-
-
- env.Append(CPPFLAGS=["-DAPPLE_STYLE_KEYS"])
- env.Append(CPPFLAGS=['-DUNIX_ENABLED','-DGLES2_ENABLED','-DOSX_ENABLED'])
- env.Append(LIBS=['pthread'])
- #env.Append(CPPFLAGS=['-F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks', '-isysroot', '/Developer/SDKs/MacOSX10.4u.sdk', '-mmacosx-version-min=10.4'])
- #env.Append(LINKFLAGS=['-mmacosx-version-min=10.4', '-isysroot', '/Developer/SDKs/MacOSX10.4u.sdk', '-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk'])
- env.Append(LINKFLAGS=['-framework', 'Cocoa', '-framework', 'Carbon', '-framework', 'OpenGL', '-framework', 'AGL', '-framework', 'AudioUnit','-lz', '-framework', 'IOKit', '-framework', 'ForceFeedback'])
-
- if (env["CXX"]=="clang++"):
- env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
- env["CC"]="clang"
- env["LD"]="clang++"
-
- 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.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } )
-
- env["x86_libtheora_opt_gcc"]=True
+ env.Append(CPPPATH=['#platform/osx'])
+
+ if (env["bits"] == "default"):
+ env["bits"] = "32"
+
+ if (env["target"] == "release"):
+
+ env.Append(CCFLAGS=['-O2', '-ffast-math', '-fomit-frame-pointer', '-ftree-vectorize', '-msse2'])
+
+ elif (env["target"] == "release_debug"):
+
+ env.Append(CCFLAGS=['-O2', '-DDEBUG_ENABLED'])
+
+ elif (env["target"] == "debug"):
+
+ env.Append(CCFLAGS=['-g3', '-Wall', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
+
+ if (not os.environ.has_key("OSXCROSS_ROOT")):
+ # regular native build
+ if (env["bits"] == "64"):
+ env.Append(CCFLAGS=['-arch', 'x86_64'])
+ env.Append(LINKFLAGS=['-arch', 'x86_64'])
+ elif (env["bits"] == "32"):
+ env.Append(CCFLAGS=['-arch', 'i386'])
+ env.Append(LINKFLAGS=['-arch', 'i386'])
+ else:
+ env.Append(CCFLAGS=['-arch', 'i386', '-arch', 'x86_64'])
+ env.Append(LINKFLAGS=['-arch', 'i386', '-arch', 'x86_64'])
+ else:
+ # osxcross build
+ root = os.environ.get("OSXCROSS_ROOT", 0)
+ if env["bits"] == "64":
+ basecmd = root + "/target/bin/x86_64-apple-" + env["osxcross_sdk"] + "-"
+ else:
+ basecmd = root + "/target/bin/i386-apple-" + env["osxcross_sdk"] + "-"
+
+ env['CC'] = basecmd + "cc"
+ env['CXX'] = basecmd + "c++"
+ env['AR'] = basecmd + "ar"
+ env['RANLIB'] = basecmd + "ranlib"
+ env['AS'] = basecmd + "as"
+
+ env.Append(CPPFLAGS=["-DAPPLE_STYLE_KEYS"])
+ env.Append(CPPFLAGS=['-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DOSX_ENABLED'])
+ env.Append(CPPFLAGS=["-mmacosx-version-min=10.9"])
+ env.Append(LIBS=['pthread'])
+ #env.Append(CPPFLAGS=['-F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks', '-isysroot', '/Developer/SDKs/MacOSX10.4u.sdk', '-mmacosx-version-min=10.4'])
+ #env.Append(LINKFLAGS=['-mmacosx-version-min=10.4', '-isysroot', '/Developer/SDKs/MacOSX10.4u.sdk', '-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk'])
+ env.Append(LINKFLAGS=['-framework', 'Cocoa', '-framework', 'Carbon', '-framework', 'OpenGL', '-framework', 'AGL', '-framework', 'AudioUnit', '-lz', '-framework', 'IOKit', '-framework', 'ForceFeedback'])
+ env.Append(LINKFLAGS=["-mmacosx-version-min=10.9"])
+
+ if (env["CXX"] == "clang++"):
+ env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
+ env["CC"] = "clang"
+ env["LD"] = "clang++"
+
+ 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.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } )
+
+ env["x86_libtheora_opt_gcc"] = True
diff --git a/platform/osx/dir_access_osx.h b/platform/osx/dir_access_osx.h
index d20eee1e2e..c30d380dd3 100644
--- a/platform/osx/dir_access_osx.h
+++ b/platform/osx/dir_access_osx.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/osx/dir_access_osx.mm b/platform/osx/dir_access_osx.mm
index 5615858262..476da2635e 100644
--- a/platform/osx/dir_access_osx.mm
+++ b/platform/osx/dir_access_osx.mm
@@ -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/osx/export/export.cpp b/platform/osx/export/export.cpp
index 30f4c58150..1cb41cede2 100644
--- a/platform/osx/export/export.cpp
+++ b/platform/osx/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 */
@@ -43,7 +43,7 @@
class EditorExportPlatformOSX : public EditorExportPlatform {
- OBJ_TYPE( EditorExportPlatformOSX,EditorExportPlatform );
+ GDCLASS( EditorExportPlatformOSX,EditorExportPlatform );
String custom_release_package;
String custom_debug_package;
@@ -207,7 +207,7 @@ void EditorExportPlatformOSX::_make_icon(const Image& p_icon,Vector<uint8_t>& ic
while(size>=16) {
Image copy = p_icon;
- copy.convert(Image::FORMAT_RGBA);
+ copy.convert(Image::FORMAT_RGBA8);
copy.resize(size,size);
it->create_from_image(copy);
String path = EditorSettings::get_singleton()->get_settings_path()+"/tmp/icon.png";
@@ -324,8 +324,8 @@ Error EditorExportPlatformOSX::export_project(const String& p_path, bool p_debug
String pkg_name;
if (app_name!="")
pkg_name=app_name;
- else if (String(Globals::get_singleton()->get("application/name"))!="")
- pkg_name=String(Globals::get_singleton()->get("application/name"));
+ else if (String(GlobalConfig::get_singleton()->get("application/name"))!="")
+ pkg_name=String(GlobalConfig::get_singleton()->get("application/name"));
else
pkg_name="Unnamed";
@@ -371,7 +371,7 @@ Error EditorExportPlatformOSX::export_project(const String& p_path, bool p_debug
if (file=="Contents/Resources/icon.icns") {
//see if there is an icon
- String iconpath = Globals::get_singleton()->get("application/icon");
+ String iconpath = GlobalConfig::get_singleton()->get("application/icon");
print_line("icon? "+iconpath);
if (iconpath!="") {
Image icon;
diff --git a/platform/osx/export/export.h b/platform/osx/export/export.h
index 8e0b83b457..98e63ff48e 100644
--- a/platform/osx/export/export.h
+++ b/platform/osx/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/osx/godot_main_osx.mm b/platform/osx/godot_main_osx.mm
index 7beb5248b4..8eedd7f6fc 100644
--- a/platform/osx/godot_main_osx.mm
+++ b/platform/osx/godot_main_osx.mm
@@ -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/osx/godot_osx.h b/platform/osx/godot_osx.h
index de363d8483..b6f2b06f26 100644
--- a/platform/osx/godot_osx.h
+++ b/platform/osx/godot_osx.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/osx/godot_osx.mm b/platform/osx/godot_osx.mm
index 02a1382b1a..2296fb016f 100644
--- a/platform/osx/godot_osx.mm
+++ b/platform/osx/godot_osx.mm
@@ -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/osx/joystick_osx.cpp b/platform/osx/joypad_osx.cpp
index ffb6ac326b..5d25017aa6 100644
--- a/platform/osx/joystick_osx.cpp
+++ b/platform/osx/joypad_osx.cpp
@@ -1,11 +1,11 @@
/*************************************************************************/
-/* joystick_osx.cpp */
+/* joypad_osx.cpp */
/*************************************************************************/
/* This file is part of: */
/* 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 */
@@ -26,14 +26,15 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "joystick_osx.h"
+#include "joypad_osx.h"
+
#include <machine/endian.h>
-#define GODOT_JOY_LOOP_RUN_MODE CFSTR("GodotJoystick")
+#define GODOT_JOY_LOOP_RUN_MODE CFSTR("GodotJoypad")
-static JoystickOSX* self = NULL;
+static JoypadOSX* self = NULL;
-joystick::joystick() {
+joypad::joypad() {
device_ref = NULL;
ff_device = NULL;
ff_axes = NULL;
@@ -56,7 +57,7 @@ joystick::joystick() {
ff_effect.dwSize = sizeof(ff_effect);
}
-void joystick::free() {
+void joypad::free() {
if (device_ref) {
IOHIDDeviceUnscheduleFromRunLoop(device_ref, CFRunLoopGetCurrent(), GODOT_JOY_LOOP_RUN_MODE);
}
@@ -68,7 +69,7 @@ void joystick::free() {
}
}
-bool joystick::has_element(IOHIDElementCookie p_cookie, Vector<rec_element> *p_list) const {
+bool joypad::has_element(IOHIDElementCookie p_cookie, Vector<rec_element> *p_list) const {
for (int i = 0; i < p_list->size(); i++) {
if (p_cookie == p_list->get(i).cookie) {
return true;
@@ -77,7 +78,7 @@ bool joystick::has_element(IOHIDElementCookie p_cookie, Vector<rec_element> *p_l
return false;
}
-int joystick::get_hid_element_state(rec_element *p_element) const {
+int joypad::get_hid_element_state(rec_element *p_element) const {
int value = 0;
if (p_element && p_element->ref) {
IOHIDValueRef valueRef;
@@ -95,7 +96,7 @@ int joystick::get_hid_element_state(rec_element *p_element) const {
}
return value;
}
-void joystick::add_hid_element(IOHIDElementRef p_element) {
+void joypad::add_hid_element(IOHIDElementRef p_element) {
const CFTypeID elementTypeID = p_element ? CFGetTypeID(p_element) : 0;
if (p_element && (elementTypeID == IOHIDElementGetTypeID())) {
@@ -198,26 +199,26 @@ void joystick::add_hid_element(IOHIDElementRef p_element) {
}
static void hid_element_added(const void *p_value, void *p_parameter) {
- joystick *joy = (joystick*) p_parameter;
+ joypad *joy = (joypad*) p_parameter;
joy->add_hid_element((IOHIDElementRef) p_value);
}
-void joystick::add_hid_elements(CFArrayRef p_array) {
+void joypad::add_hid_elements(CFArrayRef p_array) {
CFRange range = { 0, CFArrayGetCount(p_array) };
CFArrayApplyFunction(p_array, range,hid_element_added,this);
}
-static void joystick_removed_callback(void *ctx, IOReturn result, void *sender) {
+static void joypad_removed_callback(void *ctx, IOReturn result, void *sender) {
int id = (intptr_t) ctx;
self->_device_removed(id);
}
-static void joystick_added_callback(void *ctx, IOReturn res, void *sender, IOHIDDeviceRef ioHIDDeviceObject) {
+static void joypad_added_callback(void *ctx, IOReturn res, void *sender, IOHIDDeviceRef ioHIDDeviceObject) {
self->_device_added(res, ioHIDDeviceObject);
}
-static bool is_joystick(IOHIDDeviceRef p_device_ref) {
+static bool is_joypad(IOHIDDeviceRef p_device_ref) {
CFTypeRef refCF = NULL;
int usage_page = 0;
int usage = 0;
@@ -241,32 +242,32 @@ static bool is_joystick(IOHIDDeviceRef p_device_ref) {
return true;
}
-void JoystickOSX::_device_added(IOReturn p_res, IOHIDDeviceRef p_device) {
+void JoypadOSX::_device_added(IOReturn p_res, IOHIDDeviceRef p_device) {
if (p_res != kIOReturnSuccess || have_device(p_device)) {
return;
}
- joystick new_joystick;
- if (is_joystick(p_device)) {
- configure_joystick(p_device, &new_joystick);
+ joypad new_joypad;
+ if (is_joypad(p_device)) {
+ configure_joypad(p_device, &new_joypad);
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
if (IOHIDDeviceGetService != NULL) {
#endif
const io_service_t ioservice = IOHIDDeviceGetService(p_device);
- if ((ioservice) && (FFIsForceFeedback(ioservice) == FF_OK) && new_joystick.config_force_feedback(ioservice)) {
- new_joystick.ffservice = ioservice;
+ if ((ioservice) && (FFIsForceFeedback(ioservice) == FF_OK) && new_joypad.config_force_feedback(ioservice)) {
+ new_joypad.ffservice = ioservice;
}
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
}
#endif
- device_list.push_back(new_joystick);
+ device_list.push_back(new_joypad);
}
- IOHIDDeviceRegisterRemovalCallback(p_device, joystick_removed_callback, (void*) (intptr_t) new_joystick.id);
+ IOHIDDeviceRegisterRemovalCallback(p_device, joypad_removed_callback, (void*) (intptr_t) new_joypad.id);
IOHIDDeviceScheduleWithRunLoop(p_device, CFRunLoopGetCurrent(), GODOT_JOY_LOOP_RUN_MODE);
}
-void JoystickOSX::_device_removed(int p_id) {
+void JoypadOSX::_device_removed(int p_id) {
int device = get_joy_index(p_id);
ERR_FAIL_COND(device == -1);
@@ -289,7 +290,7 @@ static String _hex_str(uint8_t p_byte) {
return ret;
}
-bool JoystickOSX::configure_joystick(IOHIDDeviceRef p_device_ref, joystick* p_joy) {
+bool JoypadOSX::configure_joypad(IOHIDDeviceRef p_device_ref, joypad* p_joy) {
CFTypeRef refCF = NULL;
@@ -302,7 +303,7 @@ bool JoystickOSX::configure_joystick(IOHIDDeviceRef p_device_ref, joystick* p_jo
refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDManufacturerKey));
}
if ((!refCF) || (!CFStringGetCString((CFStringRef) refCF, c_name, sizeof (c_name), kCFStringEncodingUTF8))) {
- name = "Unidentified Joystick";
+ name = "Unidentified Joypad";
}
name = c_name;
@@ -345,7 +346,7 @@ bool JoystickOSX::configure_joystick(IOHIDDeviceRef p_device_ref, joystick* p_jo
}
#define FF_ERR() { if (ret != FF_OK) { FFReleaseDevice(ff_device); return false; } }
-bool joystick::config_force_feedback(io_service_t p_service) {
+bool joypad::config_force_feedback(io_service_t p_service) {
HRESULT ret = FFCreateDevice(p_service, &ff_device);
ERR_FAIL_COND_V(ret != FF_OK, false);
@@ -367,7 +368,7 @@ bool joystick::config_force_feedback(io_service_t p_service) {
#undef FF_ERR
#define TEST_FF(ff) (features.supportedEffects & (ff))
-bool joystick::check_ff_features() {
+bool joypad::check_ff_features() {
FFCAPABILITIES features;
HRESULT ret = FFDeviceGetForceFeedbackCapabilities(ff_device, &features);
@@ -432,7 +433,7 @@ static int process_hat_value(int p_min, int p_max, int p_value) {
return hat_value;
}
-void JoystickOSX::poll_joysticks() const {
+void JoypadOSX::poll_joypads() const {
while (CFRunLoopRunInMode(GODOT_JOY_LOOP_RUN_MODE,0,TRUE) == kCFRunLoopRunHandledSource) {
/* no-op. Pending callbacks will fire. */
}
@@ -454,11 +455,11 @@ static const InputDefault::JoyAxis axis_correct(int p_value, int p_min, int p_ma
return jx;
}
-uint32_t JoystickOSX::process_joysticks(uint32_t p_last_id){
- poll_joysticks();
+uint32_t JoypadOSX::process_joypads(uint32_t p_last_id){
+ poll_joypads();
for (int i = 0; i < device_list.size(); i++) {
- joystick &joy = device_list[i];
+ joypad &joy = device_list[i];
for (int j = 0; j < joy.axis_elements.size(); j++) {
rec_element &elem = joy.axis_elements[j];
@@ -482,11 +483,11 @@ uint32_t JoystickOSX::process_joysticks(uint32_t p_last_id){
Vector2 strength = input->get_joy_vibration_strength(joy.id);
float duration = input->get_joy_vibration_duration(joy.id);
if (strength.x == 0 && strength.y == 0) {
- joystick_vibration_stop(joy.id, timestamp);
+ joypad_vibration_stop(joy.id, timestamp);
}
else {
float gain = MAX(strength.x, strength.y);
- joystick_vibration_start(joy.id, gain, duration, timestamp);
+ joypad_vibration_start(joy.id, gain, duration, timestamp);
}
}
}
@@ -494,8 +495,8 @@ uint32_t JoystickOSX::process_joysticks(uint32_t p_last_id){
return p_last_id;
}
-void JoystickOSX::joystick_vibration_start(int p_id, float p_magnitude, float p_duration, uint64_t p_timestamp) {
- joystick *joy = &device_list[get_joy_index(p_id)];
+void JoypadOSX::joypad_vibration_start(int p_id, float p_magnitude, float p_duration, uint64_t p_timestamp) {
+ joypad *joy = &device_list[get_joy_index(p_id)];
joy->ff_timestamp = p_timestamp;
joy->ff_effect.dwDuration = p_duration * FF_SECONDS;
joy->ff_effect.dwGain = p_magnitude * FF_FFNOMINALMAX;
@@ -503,14 +504,14 @@ void JoystickOSX::joystick_vibration_start(int p_id, float p_magnitude, float p_
FFEffectStart(joy->ff_object, 1, 0);
}
-void JoystickOSX::joystick_vibration_stop(int p_id, uint64_t p_timestamp) {
- joystick* joy = &device_list[get_joy_index(p_id)];
+void JoypadOSX::joypad_vibration_stop(int p_id, uint64_t p_timestamp) {
+ joypad* joy = &device_list[get_joy_index(p_id)];
joy->ff_timestamp = p_timestamp;
FFEffectStop(joy->ff_object);
}
-int JoystickOSX::get_free_joy_id() {
- for (int i = 0; i < JOYSTICKS_MAX; i++) {
+int JoypadOSX::get_free_joy_id() {
+ for (int i = 0; i < JOYPADS_MAX; i++) {
if (!attached_devices[i]) {
attached_devices[i] = true;
return i;
@@ -519,14 +520,14 @@ int JoystickOSX::get_free_joy_id() {
return -1;
}
-int JoystickOSX::get_joy_index(int p_id) const {
+int JoypadOSX::get_joy_index(int p_id) const {
for (int i = 0; i < device_list.size(); i++) {
if (device_list[i].id == p_id) return i;
}
return -1;
}
-bool JoystickOSX::have_device(IOHIDDeviceRef p_device) const {
+bool JoypadOSX::have_device(IOHIDDeviceRef p_device) const {
for (int i = 0; i < device_list.size(); i++) {
if (device_list[i].device_ref == p_device) {
return true;
@@ -561,14 +562,14 @@ static CFDictionaryRef create_match_dictionary(const UInt32 page, const UInt32 u
return retval;
}
-void JoystickOSX::config_hid_manager(CFArrayRef p_matching_array) const {
+void JoypadOSX::config_hid_manager(CFArrayRef p_matching_array) const {
CFRunLoopRef runloop = CFRunLoopGetCurrent();
IOReturn ret = IOHIDManagerOpen(hid_manager, kIOHIDOptionsTypeNone);
ERR_FAIL_COND(ret != kIOReturnSuccess);
IOHIDManagerSetDeviceMatchingMultiple(hid_manager, p_matching_array);
- IOHIDManagerRegisterDeviceMatchingCallback(hid_manager, joystick_added_callback, NULL);
+ IOHIDManagerRegisterDeviceMatchingCallback(hid_manager, joypad_added_callback, NULL);
IOHIDManagerScheduleWithRunLoop(hid_manager, runloop, GODOT_JOY_LOOP_RUN_MODE);
while (CFRunLoopRunInMode(GODOT_JOY_LOOP_RUN_MODE,0,TRUE) == kCFRunLoopRunHandledSource) {
@@ -576,12 +577,12 @@ void JoystickOSX::config_hid_manager(CFArrayRef p_matching_array) const {
}
}
-JoystickOSX::JoystickOSX()
+JoypadOSX::JoypadOSX()
{
self = this;
input = (InputDefault*)Input::get_singleton();
- for (int i = 0; i < JOYSTICKS_MAX; i++) {
+ for (int i = 0; i < JOYPADS_MAX; i++) {
attached_devices[i] = false;
}
@@ -609,7 +610,7 @@ JoystickOSX::JoystickOSX()
}
}
-JoystickOSX::~JoystickOSX() {
+JoypadOSX::~JoypadOSX() {
for (int i = 0; i < device_list.size(); i++) {
device_list[i].free();
diff --git a/platform/osx/joystick_osx.h b/platform/osx/joypad_osx.h
index 38a4e3b1d3..aafd82880d 100644
--- a/platform/osx/joystick_osx.h
+++ b/platform/osx/joypad_osx.h
@@ -1,11 +1,11 @@
/*************************************************************************/
-/* joystick_osx.h */
+/* joypad_osx.h */
/*************************************************************************/
/* This file is part of: */
/* 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 */
@@ -26,8 +26,8 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef JOYSTICKOSX_H
-#define JOYSTICKOSX_H
+#ifndef JOYPADOSX_H
+#define JOYPADOSX_H
#ifdef MACOS_10_0_4
#include <IOKit/hidsystem/IOHIDUsageTables.h>
@@ -54,7 +54,7 @@ struct rec_element {
};
};
-struct joystick {
+struct joypad {
IOHIDDeviceRef device_ref;
Vector<rec_element> axis_elements;
@@ -82,44 +82,44 @@ struct joystick {
int get_hid_element_state(rec_element *p_element) const;
void free();
- joystick();
+ joypad();
};
-class JoystickOSX {
+class JoypadOSX {
enum {
- JOYSTICKS_MAX = 16,
+ JOYPADS_MAX = 16,
};
private:
InputDefault *input;
IOHIDManagerRef hid_manager;
- bool attached_devices[JOYSTICKS_MAX];
- Vector<joystick> device_list;
+ bool attached_devices[JOYPADS_MAX];
+ Vector<joypad> device_list;
bool have_device(IOHIDDeviceRef p_device) const;
- bool configure_joystick(IOHIDDeviceRef p_device_ref, joystick *p_joy);
+ bool configure_joypad(IOHIDDeviceRef p_device_ref, joypad *p_joy);
int get_free_joy_id();
int get_joy_index(int p_id) const;
- void poll_joysticks() const;
- void setup_joystick_objects();
+ void poll_joypads() const;
+ void setup_joypad_objects();
void config_hid_manager(CFArrayRef p_matching_array) const;
- void joystick_vibration_start(int p_id, float p_magnitude, float p_duration, uint64_t p_timestamp);
- void joystick_vibration_stop(int p_id, uint64_t p_timestamp);
+ void joypad_vibration_start(int p_id, float p_magnitude, float p_duration, uint64_t p_timestamp);
+ void joypad_vibration_stop(int p_id, uint64_t p_timestamp);
public:
- uint32_t process_joysticks(uint32_t p_last_id);
+ uint32_t process_joypads(uint32_t p_last_id);
void _device_added(IOReturn p_res, IOHIDDeviceRef p_device);
void _device_removed(int p_id);
- JoystickOSX();
- ~JoystickOSX();
+ JoypadOSX();
+ ~JoypadOSX();
};
-#endif // JOYSTICKOSX_H
+#endif // JOYPADOSX_H
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index e23ae49a35..d8c35472f2 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.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 */
@@ -31,17 +31,14 @@
#include "os/input.h"
-#include "joystick_osx.h"
+#include "joypad_osx.h"
#include "drivers/unix/os_unix.h"
#include "main/input_default.h"
#include "servers/visual_server.h"
-#include "servers/visual/visual_server_wrap_mt.h"
+// #include "servers/visual/visual_server_wrap_mt.h"
#include "servers/visual/rasterizer.h"
#include "servers/physics_server.h"
-#include "servers/audio/audio_server_sw.h"
-#include "servers/audio/sample_manager_sw.h"
-#include "servers/spatial_sound/spatial_sound_server_sw.h"
-#include "servers/spatial_sound_2d/spatial_sound_2d_server_sw.h"
+#include "servers/audio_server.h"
#include "drivers/rtaudio/audio_driver_rtaudio.h"
#include "drivers/alsa/audio_driver_alsa.h"
#include "servers/physics_2d/physics_2d_server_sw.h"
@@ -58,7 +55,8 @@
class OS_OSX : public OS_Unix {
public:
bool force_quit;
- Rasterizer *rasterizer;
+// rasterizer seems to no longer be given to visual server, its using GLES3 directly?
+ //Rasterizer *rasterizer;
VisualServer *visual_server;
List<String> args;
@@ -71,13 +69,9 @@ public:
IP_Unix *ip_unix;
AudioDriverOSX audio_driver_osx;
- AudioServerSW *audio_server;
- SampleManagerMallocSW *sample_manager;
- SpatialSoundServerSW *spatial_sound_server;
- SpatialSound2DServerSW *spatial_sound_2d_server;
InputDefault *input;
- JoystickOSX *joystick_osx;
+ JoypadOSX *joypad_osx;
/* objc */
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index cc893cc7a0..854ccacbf1 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -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 */
@@ -38,13 +38,14 @@
#include "servers/visual/visual_server_raster.h"
//#include "drivers/opengl/rasterizer_gl.h"
//#include "drivers/gles2/rasterizer_gles2.h"
+#include "drivers/gles3/rasterizer_gles3.h"
#include "os_osx.h"
#include <stdio.h>
#include <stdlib.h>
#include "print_string.h"
#include "servers/physics/physics_server_sw.h"
-#include "drivers/gles2/rasterizer_instance_gles2.h"
-#include "servers/visual/visual_server_wrap_mt.h"
+// #include "drivers/gles2/rasterizer_instance_gles2.h"
+// #include "servers/visual/visual_server_wrap_mt.h"
#include "main/main.h"
#include "os/keyboard.h"
#include "dir_access_osx.h"
@@ -147,36 +148,36 @@ static int button_mask=0;
- (void)applicationDidHide:(NSNotification *)notification
{
- /* _Godotwindow* window;
-
- for (window = _Godot.windowListHead; window; window = window->next)
- _GodotInputWindowVisibility(window, GL_FALSE);
+ /*
+ _Godotwindow* window;
+ for (window = _Godot.windowListHead; window; window = window->next)
+ _GodotInputWindowVisibility(window, GL_FALSE);
*/
}
- (void)applicationDidUnhide:(NSNotification *)notification
{
/*
- _Godotwindow* window;
+ _Godotwindow* window;
- for (window = _Godot.windowListHead; window; window = window->next)
- {
+ for (window = _Godot.windowListHead; window; window = window->next)
+ {
if ([window_object isVisible])
_GodotInputWindowVisibility(window, GL_TRUE);
- }
- */
+ }
+ */
}
- (void)applicationDidChangeScreenParameters:(NSNotification *) notification
{
- //_GodotInputMonitorChange();
+ //_GodotInputMonitorChange();
}
@end
@interface GodotWindowDelegate : NSObject
{
- // _Godotwindow* window;
+ //_Godotwindow* window;
}
@end
@@ -186,7 +187,7 @@ static int button_mask=0;
- (BOOL)windowShouldClose:(id)sender
{
- //_GodotInputWindowCloseRequest(window);
+ //_GodotInputWindowCloseRequest(window);
if (OS_OSX::singleton->get_main_loop())
OS_OSX::singleton->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_QUIT_REQUEST);
return NO;
@@ -206,38 +207,42 @@ static int button_mask=0;
OS_OSX::singleton->window_size.height=fbRect.size.height*OS_OSX::singleton->display_scale;
- // _GodotInputFramebufferSize(window, fbRect.size.width, fbRect.size.height);
- // _GodotInputWindowSize(window, contentRect.size.width, contentRect.size.height);
- //_GodotInputWindowDamage(window);
+ /*
+ _GodotInputFramebufferSize(window, fbRect.size.width, fbRect.size.height);
+ _GodotInputWindowSize(window, contentRect.size.width, contentRect.size.height);
+ _GodotInputWindowDamage(window);
- //if (window->cursorMode == Godot_CURSOR_DISABLED)
- // centerCursor(window);
+ if (window->cursorMode == Godot_CURSOR_DISABLED)
+ centerCursor(window);
+ */
}
- (void)windowDidMove:(NSNotification *)notification
{
- // [window->nsgl.context update];
+ /*
+ [window->nsgl.context update];
- // int x, y;
- // _GodotPlatformGetWindowPos(window, &x, &y);
- // _GodotInputWindowPos(window, x, y);
+ int x, y;
+ _GodotPlatformGetWindowPos(window, &x, &y);
+ _GodotInputWindowPos(window, x, y);
- //if (window->cursorMode == Godot_CURSOR_DISABLED)
- // centerCursor(window);
+ if (window->cursorMode == Godot_CURSOR_DISABLED)
+ centerCursor(window);
+ */
}
- (void)windowDidBecomeKey:(NSNotification *)notification
{
- // _GodotInputWindowFocus(window, GL_TRUE);
- // _GodotPlatformSetCursorMode(window, window->cursorMode);
+ //_GodotInputWindowFocus(window, GL_TRUE);
+ //_GodotPlatformSetCursorMode(window, window->cursorMode);
if (OS_OSX::singleton->get_main_loop())
OS_OSX::singleton->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN);
}
- (void)windowDidResignKey:(NSNotification *)notification
{
- // _GodotInputWindowFocus(window, GL_FALSE);
- // _GodotPlatformSetCursorMode(window, Godot_CURSOR_NORMAL);
+ //_GodotInputWindowFocus(window, GL_FALSE);
+ //_GodotPlatformSetCursorMode(window, Godot_CURSOR_NORMAL);
if (OS_OSX::singleton->get_main_loop())
OS_OSX::singleton->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT);
}
@@ -272,16 +277,18 @@ static int button_mask=0;
+ (void)initialize
{
- if (self == [GodotContentView class])
- {
- /* if (_glfw.ns.cursor == nil)
+ if (self == [GodotContentView class])
{
- NSImage* data = [[NSImage alloc] initWithSize:NSMakeSize(1, 1)];
- _glfw.ns.cursor = [[NSCursor alloc] initWithImage:data
- hotSpot:NSZeroPoint];
- [data release];
- }*/
- }
+ /*
+ if (_glfw.ns.cursor == nil)
+ {
+ NSImage* data = [[NSImage alloc] initWithSize:NSMakeSize(1, 1)];
+ _glfw.ns.cursor = [[NSCursor alloc] initWithImage:data
+ hotSpot:NSZeroPoint];
+ [data release];
+ }
+ */
+ }
}
- (id)init
@@ -986,24 +993,20 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
window_size.width = p_desired.width;
window_size.height = p_desired.height;
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6 && display_scale>1) {
[window_view setWantsBestResolutionOpenGLSurface:YES];
//if (current_videomode.resizable)
[window_object setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
}
-#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
-// [window_object setTitle:[NSString stringWithUTF8String:"GodotEnginies"]];
+ //[window_object setTitle:[NSString stringWithUTF8String:"GodotEnginies"]];
[window_object setContentView:window_view];
[window_object setDelegate:window_delegate];
[window_object setAcceptsMouseMovedEvents:YES];
[window_object center];
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
[window_object setRestorable:NO];
-#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
unsigned int attributeCount = 0;
@@ -1022,10 +1025,8 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
ADD_ATTR(NSOpenGLPFADoubleBuffer);
ADD_ATTR(NSOpenGLPFAClosestPolicy);
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
- if (false/* use gl3*/)
- ADD_ATTR2(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core);
-#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
+ //we now need OpenGL 3 or better, maybe even change this to 3_3Core ?
+ ADD_ATTR2(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core);
ADD_ATTR2(NSOpenGLPFAColorSize, colorBits);
@@ -1082,39 +1083,32 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
- AudioDriverManagerSW::add_driver(&audio_driver_osx);
-
+ AudioDriverManager::add_driver(&audio_driver_osx);
- rasterizer = instance_RasterizerGLES2();
+ // only opengl support here...
+ RasterizerGLES3::register_config();
+ RasterizerGLES3::make_current();
- visual_server = memnew( VisualServerRaster(rasterizer) );
+ //rasterizer = instance_RasterizerGLES2();
+ //visual_server = memnew( VisualServerRaster(rasterizer) );
+ visual_server = memnew( VisualServerRaster );
+ // FIXME: Reimplement threaded rendering? Or remove?
+ /*
if (get_render_thread_mode()!=RENDER_THREAD_UNSAFE) {
-
visual_server =memnew(VisualServerWrapMT(visual_server,get_render_thread_mode()==RENDER_SEPARATE_THREAD));
}
+ */
visual_server->init();
visual_server->cursor_set_visible(false, 0);
- AudioDriverManagerSW::get_driver(p_audio_driver)->set_singleton();
+ AudioDriverManager::get_driver(p_audio_driver)->set_singleton();
- if (AudioDriverManagerSW::get_driver(p_audio_driver)->init()!=OK) {
+ if (AudioDriverManager::get_driver(p_audio_driver)->init()!=OK) {
ERR_PRINT("Initializing audio failed.");
}
- sample_manager = memnew( SampleManagerMallocSW );
- audio_server = memnew( AudioServerSW(sample_manager) );
-
- audio_server->set_mixer_params(AudioMixerSW::INTERPOLATION_LINEAR,false);
- audio_server->init();
-
- spatial_sound_server = memnew( SpatialSoundServerSW );
- spatial_sound_server->init();
-
- spatial_sound_2d_server = memnew( SpatialSound2DServerSW );
- spatial_sound_2d_server->init();
-
//
physics_server = memnew( PhysicsServerSW );
physics_server->init();
@@ -1123,7 +1117,7 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
physics_2d_server->init();
input = memnew( InputDefault );
- joystick_osx = memnew( JoystickOSX );
+ joypad_osx = memnew( JoypadOSX );
_ensure_data_dir();
@@ -1161,22 +1155,12 @@ void OS_OSX::finalize() {
CFNotificationCenterRemoveObserver(CFNotificationCenterGetDistributedCenter(), NULL, kTISNotifySelectedKeyboardInputSourceChanged, NULL);
delete_main_loop();
- spatial_sound_server->finish();
- memdelete(spatial_sound_server);
- spatial_sound_2d_server->finish();
- memdelete(spatial_sound_2d_server);
-
- memdelete(joystick_osx);
+ memdelete(joypad_osx);
memdelete(input);
- memdelete(sample_manager);
-
- audio_server->finish();
- memdelete(audio_server);
-
visual_server->finish();
memdelete(visual_server);
- memdelete(rasterizer);
+ //memdelete(rasterizer);
physics_server->finish();
memdelete(physics_server);
@@ -1313,7 +1297,7 @@ void OS_OSX::set_window_title(const String& p_title) {
void OS_OSX::set_icon(const Image& p_icon) {
Image img=p_icon;
- img.convert(Image::FORMAT_RGBA);
+ img.convert(Image::FORMAT_RGBA8);
NSBitmapImageRep *imgrep= [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes: NULL
pixelsWide: p_icon.get_width()
pixelsHigh: p_icon.get_height()
@@ -1328,8 +1312,8 @@ void OS_OSX::set_icon(const Image& p_icon) {
uint8_t *pixels = [imgrep bitmapData];
int len = img.get_width()*img.get_height();
- DVector<uint8_t> data = img.get_data();
- DVector<uint8_t>::Read r = data.read();
+ PoolVector<uint8_t> data = img.get_data();
+ PoolVector<uint8_t>::Read r = data.read();
/* Premultiply the alpha channel */
for (int i = 0; i<len ; i++) {
@@ -1731,15 +1715,15 @@ void OS_OSX::run() {
set_window_fullscreen(true);
}
-// uint64_t last_ticks=get_ticks_usec();
+ //uint64_t last_ticks=get_ticks_usec();
-// int frames=0;
-// uint64_t frame=0;
+ //int frames=0;
+ //uint64_t frame=0;
while (!force_quit) {
process_events(); // get rid of pending events
- last_id = joystick_osx->process_joysticks(last_id);
+ last_id = joypad_osx->process_joypads(last_id);
if (Main::iteration()==true)
break;
};
diff --git a/platform/osx/platform_config.h b/platform/osx/platform_config.h
index f02a4bc444..834d0141a3 100644
--- a/platform/osx/platform_config.h
+++ b/platform/osx/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 */
@@ -27,5 +27,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include <alloca.h>
-#define GLES2_INCLUDE_H "GL/glew.h"
+
+#define GLES3_INCLUDE_H "glad/glad.h"
#define PTHREAD_RENAME_SELF
diff --git a/platform/osx/sem_osx.cpp b/platform/osx/sem_osx.cpp
index 6909097fec..ca710d8b1e 100644
--- a/platform/osx/sem_osx.cpp
+++ b/platform/osx/sem_osx.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/osx/sem_osx.h b/platform/osx/sem_osx.h
index ec5ddac4e0..da2fac434c 100644
--- a/platform/osx/sem_osx.h
+++ b/platform/osx/sem_osx.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/server/SCsub b/platform/server/SCsub
index 12758c5db0..30195bb908 100644
--- a/platform/server/SCsub
+++ b/platform/server/SCsub
@@ -3,8 +3,8 @@
Import('env')
-common_server=[\
- "os_server.cpp",\
+common_server = [\
+ "os_server.cpp",\
]
-env.Program('#bin/godot_server',['godot_server.cpp']+common_server)
+env.Program('#bin/godot_server', ['godot_server.cpp'] + common_server)
diff --git a/platform/server/detect.py b/platform/server/detect.py
index ce14100fd0..8bc85f342d 100644
--- a/platform/server/detect.py
+++ b/platform/server/detect.py
@@ -4,73 +4,116 @@ import sys
def is_active():
- return True
+ return True
+
def get_name():
- return "Server"
+ return "Server"
def can_build():
- if (os.name!="posix"):
- return False
+ if (os.name != "posix"):
+ return False
+
+ return True # enabled
- return True # enabled
def get_opts():
- return [
- ('use_llvm','Use llvm compiler','no'),
- ('force_32_bits','Force 32 bits binary','no')
- ]
+ return [
+ ('use_llvm', 'Use llvm compiler', 'no'),
+ ('force_32_bits', 'Force 32 bits binary', 'no')
+ ]
-def get_flags():
- return [
- ]
+def get_flags():
+ return [
+ ]
def configure(env):
- env.Append(CPPPATH=['#platform/server'])
- if (env["use_llvm"]=="yes"):
- env["CC"]="clang"
- env["CXX"]="clang++"
- env["LD"]="clang++"
+ env.Append(CPPPATH=['#platform/server'])
+ if (env["use_llvm"] == "yes"):
+ env["CC"] = "clang"
+ env["CXX"] = "clang++"
+ env["LD"] = "clang++"
+
+ is64 = sys.maxsize > 2**32
+
+ if (env["bits"] == "default"):
+ if (is64):
+ env["bits"] = "64"
+ else:
+ env["bits"] = "32"
+
+ # if (env["tools"]=="no"):
+ # #no tools suffix
+ # env['OBJSUFFIX'] = ".nt"+env['OBJSUFFIX']
+ # env['LIBSUFFIX'] = ".nt"+env['LIBSUFFIX']
+
+ 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=['-g2', '-Wall', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
+
+
+ # Shared libraries, when requested
+
+ if (env['builtin_openssl'] == 'no'):
+ env.ParseConfig('pkg-config openssl --cflags --libs')
- is64=sys.maxsize > 2**32
+ if (env['builtin_libwebp'] == 'no'):
+ env.ParseConfig('pkg-config libwebp --cflags --libs')
- if (env["bits"]=="default"):
- if (is64):
- env["bits"]="64"
- else:
- env["bits"]="32"
+ if (env['builtin_freetype'] == 'no'):
+ env.ParseConfig('pkg-config freetype2 --cflags --libs')
+ if (env['builtin_libpng'] == 'no'):
+ env.ParseConfig('pkg-config libpng --cflags --libs')
- #if (env["tools"]=="no"):
- # #no tools suffix
- # env['OBJSUFFIX'] = ".nt"+env['OBJSUFFIX']
- # env['LIBSUFFIX'] = ".nt"+env['LIBSUFFIX']
+ if (env['builtin_enet'] == 'no'):
+ env.ParseConfig('pkg-config libenet --cflags --libs')
+ if (env['builtin_squish'] == 'no' and env["tools"] == "yes"):
+ env.ParseConfig('pkg-config libsquish --cflags --libs')
- if (env["target"]=="release"):
+ # Sound and video libraries
+ # Keep the order as it triggers chained dependencies (ogg needed by others, etc.)
- env.Append(CCFLAGS=['-O2','-ffast-math','-fomit-frame-pointer'])
+ if (env['builtin_libtheora'] == 'no'):
+ env['builtin_libogg'] = 'no' # Needed to link against system libtheora
+ env['builtin_libvorbis'] = 'no' # Needed to link against system libtheora
+ env.ParseConfig('pkg-config theora theoradec --cflags --libs')
- elif (env["target"]=="release_debug"):
+ if (env['builtin_libvpx'] == 'no'):
+ env.ParseConfig('pkg-config vpx --cflags --libs')
- env.Append(CCFLAGS=['-O2','-ffast-math','-DDEBUG_ENABLED'])
+ if (env['builtin_libvorbis'] == 'no'):
+ env['builtin_libogg'] = 'no' # Needed to link against system libvorbis
+ env.ParseConfig('pkg-config vorbis vorbisfile --cflags --libs')
- elif (env["target"]=="debug"):
+ if (env['builtin_opus'] == 'no'):
+ env['builtin_libogg'] = 'no' # Needed to link against system opus
+ env.ParseConfig('pkg-config opus opusfile --cflags --libs')
- env.Append(CCFLAGS=['-g2', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
+ if (env['builtin_libogg'] == 'no'):
+ env.ParseConfig('pkg-config ogg --cflags --libs')
- env.Append(CPPFLAGS=['-DSERVER_ENABLED','-DUNIX_ENABLED'])
- env.Append(LIBS=['pthread','z']) #TODO detect linux/BSD!
- if (env["CXX"]=="clang++"):
- env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
- env["CC"]="clang"
- env["LD"]="clang++"
+ env.Append(CPPFLAGS=['-DSERVER_ENABLED', '-DUNIX_ENABLED'])
+ env.Append(LIBS=['pthread', 'z']) # TODO detect linux/BSD!
+ if (env["CXX"] == "clang++"):
+ env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
+ env["CC"] = "clang"
+ env["LD"] = "clang++"
diff --git a/platform/server/godot_server.cpp b/platform/server/godot_server.cpp
index 1c55c03bd7..37e73d663d 100644
--- a/platform/server/godot_server.cpp
+++ b/platform/server/godot_server.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/server/os_server.cpp b/platform/server/os_server.cpp
index 5404980ff3..d691ae35bd 100644
--- a/platform/server/os_server.cpp
+++ b/platform/server/os_server.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 */
@@ -26,8 +26,8 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "servers/visual/visual_server_raster.h"
-#include "servers/visual/rasterizer_dummy.h"
+//#include "servers/visual/visual_server_raster.h"
+//#include "servers/visual/rasterizer_dummy.h"
#include "os_server.h"
#include <stdio.h>
#include <stdlib.h>
@@ -57,13 +57,13 @@ void OS_Server::initialize(const VideoMode& p_desired,int p_video_driver,int p_a
current_videomode=p_desired;
main_loop=NULL;
- rasterizer = memnew( RasterizerDummy );
+ //rasterizer = memnew( RasterizerDummy );
- visual_server = memnew( VisualServerRaster(rasterizer) );
+ //visual_server = memnew( VisualServerRaster(rasterizer) );
- AudioDriverManagerSW::get_driver(p_audio_driver)->set_singleton();
+ AudioDriverManager::get_driver(p_audio_driver)->set_singleton();
- if (AudioDriverManagerSW::get_driver(p_audio_driver)->init()!=OK) {
+ if (AudioDriverManager::get_driver(p_audio_driver)->init()!=OK) {
ERR_PRINT("Initializing audio failed.");
}
@@ -103,9 +103,11 @@ void OS_Server::finalize() {
spatial_sound_2d_server->finish();
memdelete(spatial_sound_2d_server);
- //if (debugger_connection_console) {
-// memdelete(debugger_connection_console);
-//}
+ /*
+ if (debugger_connection_console) {
+ memdelete(debugger_connection_console);
+ }
+ */
memdelete(sample_manager);
@@ -114,7 +116,7 @@ void OS_Server::finalize() {
visual_server->finish();
memdelete(visual_server);
- memdelete(rasterizer);
+ //memdelete(rasterizer);
physics_server->finish();
memdelete(physics_server);
@@ -235,7 +237,7 @@ void OS_Server::run() {
OS_Server::OS_Server() {
- AudioDriverManagerSW::add_driver(&driver_dummy);
+ AudioDriverManager::add_driver(&driver_dummy);
//adriver here
grab=false;
diff --git a/platform/server/os_server.h b/platform/server/os_server.h
index 2081d5f2f4..2b6225c48d 100644
--- a/platform/server/os_server.h
+++ b/platform/server/os_server.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 */
@@ -29,17 +29,13 @@
#ifndef OS_SERVER_H
#define OS_SERVER_H
-
#include "main/input_default.h"
#include "drivers/unix/os_unix.h"
#include "servers/visual_server.h"
#include "servers/visual/rasterizer.h"
#include "servers/audio/audio_driver_dummy.h"
#include "servers/physics_server.h"
-#include "servers/audio/audio_server_sw.h"
-#include "servers/audio/sample_manager_sw.h"
-#include "servers/spatial_sound/spatial_sound_server_sw.h"
-#include "servers/spatial_sound_2d/spatial_sound_2d_server_sw.h"
+#include "servers/audio_server.h"
#include "drivers/rtaudio/audio_driver_rtaudio.h"
#include "servers/physics_2d/physics_2d_server_sw.h"
@@ -51,7 +47,7 @@
class OS_Server : public OS_Unix {
- Rasterizer *rasterizer;
+ //Rasterizer *rasterizer;
VisualServer *visual_server;
VideoMode current_videomode;
List<String> args;
@@ -66,11 +62,6 @@ class OS_Server : public OS_Unix {
virtual void delete_main_loop();
IP_Unix *ip_unix;
- AudioServerSW *audio_server;
- SampleManagerMallocSW *sample_manager;
- SpatialSoundServerSW *spatial_sound_server;
- SpatialSound2DServerSW *spatial_sound_2d_server;
-
bool force_quit;
InputDefault *input;
diff --git a/platform/server/platform_config.h b/platform/server/platform_config.h
index 143f16c1fa..cdef185ff0 100644
--- a/platform/server/platform_config.h
+++ b/platform/server/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/uwp/SCsub b/platform/uwp/SCsub
new file mode 100644
index 0000000000..0167ea9e02
--- /dev/null
+++ b/platform/uwp/SCsub
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+
+Import('env')
+
+files = [
+ 'thread_uwp.cpp',
+ '#platform/windows/tcp_server_winsock.cpp',
+ '#platform/windows/packet_peer_udp_winsock.cpp',
+ '#platform/windows/stream_peer_winsock.cpp',
+ '#platform/windows/key_mapping_win.cpp',
+ 'joypad_uwp.cpp',
+ 'gl_context_egl.cpp',
+ 'app.cpp',
+ 'os_uwp.cpp',
+]
+
+if "build_angle" in env and env["build_angle"]:
+ cmd = env.AlwaysBuild(env.ANGLE('libANGLE.lib', None))
+
+prog = env.Program('#bin/godot', files)
+
+if "build_angle" in env and env["build_angle"]:
+ env.Depends(prog, [cmd])
diff --git a/platform/winrt/app.cpp b/platform/uwp/app.cpp
index c2b7ba0641..0bae148c6b 100644
--- a/platform/winrt/app.cpp
+++ b/platform/uwp/app.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 */
@@ -53,7 +53,7 @@ using namespace Windows::System;
using namespace Windows::System::Threading::Core;
using namespace Microsoft::WRL;
-using namespace GodotWinRT;
+using namespace GodotUWP;
// Helper to convert a length in device-independent pixels (DIPs) to a length in physical pixels.
inline float ConvertDipsToPixels(float dips, float dpi)
@@ -63,7 +63,7 @@ inline float ConvertDipsToPixels(float dips, float dpi)
}
// Implementation of the IFrameworkViewSource interface, necessary to run our app.
-ref class GodotWinrtViewSource sealed : Windows::ApplicationModel::Core::IFrameworkViewSource
+ref class GodotUWPViewSource sealed : Windows::ApplicationModel::Core::IFrameworkViewSource
{
public:
virtual Windows::ApplicationModel::Core::IFrameworkView^ CreateView()
@@ -76,7 +76,7 @@ public:
[Platform::MTAThread]
int main(Platform::Array<Platform::String^>^)
{
- auto godotApplicationSource = ref new GodotWinrtViewSource();
+ auto godotApplicationSource = ref new GodotUWPViewSource();
CoreApplication::Run(godotApplicationSource);
return 0;
}
@@ -105,7 +105,7 @@ void App::Initialize(CoreApplicationView^ applicationView)
// Information about the Suspending and Resuming event handlers can be found here:
// http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh994930.aspx
- os = new OSWinrt;
+ os = new OSUWP;
}
@@ -157,7 +157,7 @@ void App::SetWindow(CoreWindow^ p_window)
unsigned int argc;
char** argv = get_command_line(&argc);
- Main::setup("winrt", argc, argv, false);
+ Main::setup("uwp", argc, argv, false);
// The CoreWindow has been created, so EGL can be initialized.
ContextEGL* context = memnew(ContextEGL(window));
@@ -431,7 +431,7 @@ void App::OnMouseMoved(MouseDevice ^ mouse_device, MouseEventArgs ^ args) {
void App::key_event(Windows::UI::Core::CoreWindow^ sender, bool p_pressed, Windows::UI::Core::KeyEventArgs^ key_args, Windows::UI::Core::CharacterReceivedEventArgs^ char_args)
{
- OSWinrt::KeyEvent ke;
+ OSUWP::KeyEvent ke;
InputModifierState mod;
mod.meta = false;
@@ -445,14 +445,14 @@ void App::key_event(Windows::UI::Core::CoreWindow^ sender, bool p_pressed, Windo
if (key_args != nullptr) {
- ke.type = OSWinrt::KeyEvent::MessageType::KEY_EVENT_MESSAGE;
+ ke.type = OSUWP::KeyEvent::MessageType::KEY_EVENT_MESSAGE;
ke.unicode = 0;
ke.scancode = KeyMappingWindows::get_keysym((unsigned int)key_args->VirtualKey);
ke.echo = (!p_pressed && !key_args->KeyStatus.IsKeyReleased) || (p_pressed && key_args->KeyStatus.WasKeyDown);
} else {
- ke.type = OSWinrt::KeyEvent::MessageType::CHAR_EVENT_MESSAGE;
+ ke.type = OSUWP::KeyEvent::MessageType::CHAR_EVENT_MESSAGE;
ke.unicode = char_args->KeyCode;
ke.scancode = 0;
ke.echo = (!p_pressed && !char_args->KeyStatus.IsKeyReleased) || (p_pressed && char_args->KeyStatus.WasKeyDown);
diff --git a/platform/winrt/app.h b/platform/uwp/app.h
index 652ec86e1f..fd6fc950a7 100644
--- a/platform/winrt/app.h
+++ b/platform/uwp/app.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 */
@@ -32,38 +32,41 @@
#include <wrl.h>
-#include "os_winrt.h"
#include "GLES2/gl2.h"
+#include "os_uwp.h"
-namespace GodotWinRT
+/** clang-format does not play nice with this C++/CX hybrid, needs investigation. */
+/* clang-format off */
+
+namespace GodotUWP
{
- ref class App sealed : public Windows::ApplicationModel::Core::IFrameworkView
- {
- public:
- App();
-
- // IFrameworkView Methods.
- virtual void Initialize(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView);
- virtual void SetWindow(Windows::UI::Core::CoreWindow^ window);
- virtual void Load(Platform::String^ entryPoint);
- virtual void Run();
- virtual void Uninitialize();
+ ref class App sealed : public Windows::ApplicationModel::Core::IFrameworkView
+ {
+ public:
+ App();
+
+ // IFrameworkView Methods.
+ virtual void Initialize(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView);
+ virtual void SetWindow(Windows::UI::Core::CoreWindow^ window);
+ virtual void Load(Platform::String^ entryPoint);
+ virtual void Run();
+ virtual void Uninitialize();
property Windows::Foundation::EventRegistrationToken MouseMovedToken {
- Windows::Foundation::EventRegistrationToken get() { return this->mouseMovedToken; }
- void set(Windows::Foundation::EventRegistrationToken p_token) { this->mouseMovedToken = p_token; }
- };
+ Windows::Foundation::EventRegistrationToken get() { return this->mouseMovedToken; }
+ void set(Windows::Foundation::EventRegistrationToken p_token) { this->mouseMovedToken = p_token; }
+ }
- private:
+ private:
void RecreateRenderer();
- // Application lifecycle event handlers.
- void OnActivated(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView, Windows::ApplicationModel::Activation::IActivatedEventArgs^ args);
+ // Application lifecycle event handlers.
+ void OnActivated(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView, Windows::ApplicationModel::Activation::IActivatedEventArgs^ args);
- // Window event handlers.
- void OnWindowSizeChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ args);
- void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args);
- void OnWindowClosed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CoreWindowEventArgs^ args);
+ // Window event handlers.
+ void OnWindowSizeChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ args);
+ void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args);
+ void OnWindowClosed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CoreWindowEventArgs^ args);
void pointer_event(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args, bool p_pressed, bool p_is_wheel = false);
void OnPointerPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
@@ -81,28 +84,29 @@ namespace GodotWinRT
void OnKeyUp(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args);
void OnCharacterReceived(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CharacterReceivedEventArgs^ args);
- void UpdateWindowSize(Windows::Foundation::Size size);
- void InitializeEGL(Windows::UI::Core::CoreWindow^ window);
- void CleanupEGL();
+ void UpdateWindowSize(Windows::Foundation::Size size);
+ void InitializeEGL(Windows::UI::Core::CoreWindow^ window);
+ void CleanupEGL();
char** get_command_line(unsigned int* out_argc);
- bool mWindowClosed;
- bool mWindowVisible;
- GLsizei mWindowWidth;
- GLsizei mWindowHeight;
+ bool mWindowClosed;
+ bool mWindowVisible;
+ GLsizei mWindowWidth;
+ GLsizei mWindowHeight;
- EGLDisplay mEglDisplay;
- EGLContext mEglContext;
- EGLSurface mEglSurface;
+ EGLDisplay mEglDisplay;
+ EGLContext mEglContext;
+ EGLSurface mEglSurface;
CoreWindow^ window;
- OSWinrt* os;
+ OSUWP* os;
int last_touch_x[32]; // 20 fingers, index 31 reserved for the mouse
int last_touch_y[32];
int number_of_contacts;
Windows::Foundation::Point last_mouse_pos;
- };
-
+ }
}
+
+/* clang-format on */
diff --git a/platform/uwp/detect.py b/platform/uwp/detect.py
new file mode 100644
index 0000000000..f1e0716241
--- /dev/null
+++ b/platform/uwp/detect.py
@@ -0,0 +1,170 @@
+import os
+
+import sys
+import string
+import methods
+
+
+def is_active():
+ return True
+
+
+def get_name():
+ return "UWP"
+
+
+def can_build():
+ if (os.name == "nt"):
+ # building natively on windows!
+ if (os.getenv("VSINSTALLDIR")):
+
+ if (os.getenv("ANGLE_SRC_PATH") == None):
+ return False
+
+ return True
+ return False
+
+
+def get_opts():
+ return []
+
+
+def get_flags():
+
+ return [
+ ('tools', 'no'),
+ ('xaudio2', 'yes'),
+ ]
+
+
+def configure(env):
+
+ if(env["bits"] != "default"):
+ print "Error: bits argument is disabled for MSVC"
+ print ("Bits argument is not supported for MSVC compilation. Architecture depends on the Native/Cross Compile Tools Prompt/Developer Console (or Visual Studio settings)"
+ + " that is being used to run SCons. As a consequence, bits argument is disabled. Run scons again without bits argument (example: scons p=uwp) and SCons will attempt to detect what MSVC compiler"
+ + " will be executed and inform you.")
+ sys.exit()
+
+ arch = ""
+ env['ENV'] = os.environ
+
+ # ANGLE
+ angle_root = os.getenv("ANGLE_SRC_PATH")
+ env.Append(CPPPATH=[angle_root + '/include'])
+ jobs = str(env.GetOption("num_jobs"))
+ angle_build_cmd = "msbuild.exe " + angle_root + "/winrt/10/src/angle.sln /nologo /v:m /m:" + jobs + " /p:Configuration=Release /p:Platform="
+
+ if os.path.isfile(str(os.getenv("ANGLE_SRC_PATH")) + "/winrt/10/src/angle.sln"):
+ env["build_angle"] = True
+
+ if os.getenv('Platform') == "ARM":
+
+ print "Compiled program architecture will be an ARM executable. (forcing bits=32)."
+
+ arch = "arm"
+ env["bits"] = "32"
+ env.Append(LINKFLAGS=['/MACHINE:ARM'])
+ env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store/arm'])
+
+ angle_build_cmd += "ARM"
+
+ env.Append(LIBPATH=[angle_root + '/winrt/10/src/Release_ARM/lib'])
+
+ else:
+
+ compiler_version_str = methods.detect_visual_c_compiler_version(env['ENV'])
+
+ if(compiler_version_str == "amd64" or compiler_version_str == "x86_amd64"):
+ env["bits"] = "64"
+ print "Compiled program architecture will be a x64 executable (forcing bits=64)."
+ elif (compiler_version_str == "x86" or compiler_version_str == "amd64_x86"):
+ env["bits"] = "32"
+ print "Compiled program architecture will be a x86 executable. (forcing bits=32)."
+ else:
+ print "Failed to detect MSVC compiler architecture version... Defaulting to 32bit executable settings (forcing bits=32). Compilation attempt will continue, but SCons can not detect for what architecture this build is compiled for. You should check your settings/compilation setup."
+ env["bits"] = "32"
+
+ if (env["bits"] == "32"):
+ arch = "x86"
+
+ angle_build_cmd += "Win32"
+
+ env.Append(CPPFLAGS=['/DPNG_ABORT=abort'])
+ env.Append(LINKFLAGS=['/MACHINE:X86'])
+ env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store'])
+ env.Append(LIBPATH=[angle_root + '/winrt/10/src/Release_Win32/lib'])
+
+ else:
+ arch = "x64"
+
+ angle_build_cmd += "x64"
+
+ env.Append(LINKFLAGS=['/MACHINE:X64'])
+ env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store/amd64'])
+ env.Append(LIBPATH=[angle_root + '/winrt/10/src/Release_x64/lib'])
+
+ env.Append(CPPPATH=['#platform/uwp', '#drivers/windows'])
+ env.Append(LINKFLAGS=['/MANIFEST:NO', '/NXCOMPAT', '/DYNAMICBASE', '/WINMD', '/APPCONTAINER', '/ERRORREPORT:PROMPT', '/NOLOGO', '/TLBID:1', '/NODEFAULTLIB:"kernel32.lib"', '/NODEFAULTLIB:"ole32.lib"'])
+ env.Append(CPPFLAGS=['/D', '__WRL_NO_DEFAULT_LIB__', '/D', 'WIN32'])
+ env.Append(CPPFLAGS=['/FU', os.environ['VCINSTALLDIR'] + 'lib/store/references/platform.winmd'])
+ env.Append(CPPFLAGS=['/AI', os.environ['VCINSTALLDIR'] + 'lib/store/references'])
+
+ env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store/references'])
+
+ if (env["target"] == "release"):
+
+ env.Append(CPPFLAGS=['/O2', '/GL'])
+ env.Append(CPPFLAGS=['/MD'])
+ env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS', '/LTCG'])
+
+ elif (env["target"] == "release_debug"):
+
+ env.Append(CCFLAGS=['/O2', '/Zi', '/DDEBUG_ENABLED'])
+ env.Append(CPPFLAGS=['/MD'])
+ env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
+
+ elif (env["target"] == "debug"):
+
+ env.Append(CCFLAGS=['/Zi', '/DDEBUG_ENABLED', '/DDEBUG_MEMORY_ENABLED'])
+ env.Append(CPPFLAGS=['/MDd'])
+ env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
+ env.Append(LINKFLAGS=['/DEBUG'])
+
+ env.Append(CCFLAGS=string.split('/FS /MP /GS /wd"4453" /wd"28204" /wd"4291" /Zc:wchar_t /Gm- /fp:precise /D "_UNICODE" /D "UNICODE" /D "WINAPI_FAMILY=WINAPI_FAMILY_APP" /errorReport:prompt /WX- /Zc:forScope /Gd /EHsc /nologo'))
+ env.Append(CXXFLAGS=string.split('/ZW /FS'))
+ env.Append(CCFLAGS=['/AI', os.environ['VCINSTALLDIR'] + '\\vcpackages', '/AI', os.environ['WINDOWSSDKDIR'] + '\\References\\CommonConfiguration\\Neutral'])
+
+ env["PROGSUFFIX"] = "." + arch + env["PROGSUFFIX"]
+ env["OBJSUFFIX"] = "." + arch + env["OBJSUFFIX"]
+ env["LIBSUFFIX"] = "." + arch + env["LIBSUFFIX"]
+
+ env.Append(CCFLAGS=['/DUWP_ENABLED'])
+ env.Append(CCFLAGS=['/DWINDOWS_ENABLED'])
+ env.Append(CCFLAGS=['/DTYPED_METHOD_BIND'])
+
+ env.Append(CCFLAGS=['/DGLES2_ENABLED', '/DGL_GLEXT_PROTOTYPES', '/DEGL_EGLEXT_PROTOTYPES', '/DANGLE_ENABLED'])
+
+ winver = "0x0602" # Windows 8 is the minimum target for UWP build
+ env.Append(CCFLAGS=['/DWINVER=%s' % winver, '/D_WIN32_WINNT=%s' % winver])
+
+ LIBS = [
+ 'WindowsApp',
+ 'mincore',
+ 'ws2_32',
+ 'libANGLE',
+ 'libEGL',
+ 'libGLESv2',
+ ]
+ env.Append(LINKFLAGS=[p + ".lib" for p in LIBS])
+
+ # Incremental linking fix
+ env['BUILDERS']['ProgramOriginal'] = env['BUILDERS']['Program']
+ env['BUILDERS']['Program'] = methods.precious_program
+
+ env.Append(BUILDERS={'ANGLE': env.Builder(action=angle_build_cmd)})
+
+ 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={'HLSL9': env.Builder(action=methods.build_hlsl_dx9_headers, suffix='hlsl.h', src_suffix='.hlsl')})
+ env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.h', src_suffix='.glsl')})
diff --git a/platform/winrt/export/export.cpp b/platform/uwp/export/export.cpp
index eca9f09de6..f31c91ef6d 100644
--- a/platform/winrt/export/export.cpp
+++ b/platform/uwp/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 */
@@ -71,7 +71,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "object.h"
#include "tools/editor/editor_import_export.h"
#include "tools/editor/editor_node.h"
-#include "platform/winrt/logo.h"
+#include "platform/uwp/logo.h"
#include "os/file_access.h"
#include "io/zip.h"
#include "io/unzip.h"
@@ -432,9 +432,9 @@ public:
~AppxPackager();
};
-class EditorExportPlatformWinrt : public EditorExportPlatform {
+class EditorExportPlatformUWP : public EditorExportPlatform {
- OBJ_TYPE(EditorExportPlatformWinrt, EditorExportPlatform);
+ GDCLASS(EditorExportPlatformUWP, EditorExportPlatform);
Ref<ImageTexture> logo;
@@ -528,8 +528,8 @@ public:
virtual Error export_project(const String& p_path, bool p_debug, int p_flags = 0);
- EditorExportPlatformWinrt();
- ~EditorExportPlatformWinrt();
+ EditorExportPlatformUWP();
+ ~EditorExportPlatformUWP();
};
@@ -612,15 +612,13 @@ void AppxPackager::make_content_types() {
for (int i = 0; i < file_metadata.size(); i++) {
- String ext = file_metadata[i].name.extension();
+ String ext = file_metadata[i].name.get_extension();
if (types.has(ext)) continue;
types[ext] = content_type(ext);
- tmp_file->store_string("<Default Extension=\"" + ext +
- "\" ContentType=\""
- + types[ext] + "\" />");
+ tmp_file->store_string("<Default Extension=\"" + ext + "\" ContentType=\"" + types[ext] + "\" />");
}
// Appx signature file
@@ -1174,9 +1172,9 @@ Error AppxPackager::MakeIndirectDataContent(asn1::SPCIndirectDataContent &idc) {
MakeSPCInfoValue(*infoValue);
ASN1_TYPE* value =
- EncodedASN1::FromItem<asn1::SPCInfoValue,
- asn1::i2d_SPCInfoValue>(infoValue)
- .ToSequenceType();
+ EncodedASN1::FromItem<asn1::SPCInfoValue,
+ asn1::i2d_SPCInfoValue>(infoValue)
+ .ToSequenceType();
{
Vector<uint8_t> digest;
@@ -1202,8 +1200,10 @@ Error AppxPackager::add_attributes(PKCS7_SIGNER_INFO * p_signer_info) {
asn1::SPCSpOpusInfo* opus = asn1::SPCSpOpusInfo_new();
if (!opus) return openssl_error(ERR_peek_last_error());
- ASN1_STRING* opus_value = EncodedASN1::FromItem<asn1::SPCSpOpusInfo, asn1::i2d_SPCSpOpusInfo>(opus)
- .ToSequenceString();
+ ASN1_STRING* opus_value =
+ EncodedASN1::FromItem<asn1::SPCSpOpusInfo,
+ asn1::i2d_SPCSpOpusInfo>(opus)
+ .ToSequenceString();
if (!PKCS7_add_signed_attribute(
p_signer_info,
@@ -1237,8 +1237,9 @@ Error AppxPackager::add_attributes(PKCS7_SIGNER_INFO * p_signer_info) {
statement_type->type = OBJ_nid2obj(NID_ms_code_ind);
ASN1_STRING* statement_type_value =
- EncodedASN1::FromItem<asn1::SPCStatementType, asn1::i2d_SPCStatementType>(statement_type)
- .ToSequenceString();
+ EncodedASN1::FromItem<asn1::SPCStatementType,
+ asn1::i2d_SPCStatementType>(statement_type)
+ .ToSequenceString();
if (!PKCS7_add_signed_attribute(
p_signer_info,
@@ -1452,7 +1453,7 @@ Error AppxPackager::sign(const CertFile & p_cert, const AppxDigests & digests, P
////////////////////////////////////////////////////////////////////
-bool EditorExportPlatformWinrt::_valid_resource_name(const String &p_name) const {
+bool EditorExportPlatformUWP::_valid_resource_name(const String &p_name) const {
if (p_name.empty()) return false;
if (p_name.ends_with(".")) return false;
@@ -1472,7 +1473,7 @@ bool EditorExportPlatformWinrt::_valid_resource_name(const String &p_name) const
return true;
}
-bool EditorExportPlatformWinrt::_valid_guid(const String & p_guid) const {
+bool EditorExportPlatformUWP::_valid_guid(const String & p_guid) const {
Vector<String> parts = p_guid.split("-");
@@ -1485,7 +1486,7 @@ bool EditorExportPlatformWinrt::_valid_guid(const String & p_guid) const {
return true;
}
-bool EditorExportPlatformWinrt::_valid_bgcolor(const String & p_color) const {
+bool EditorExportPlatformUWP::_valid_bgcolor(const String & p_color) const {
if (p_color.empty()) return true;
if (p_color.begins_with("#") && p_color.is_valid_html_color()) return true;
@@ -1529,7 +1530,7 @@ bool EditorExportPlatformWinrt::_valid_bgcolor(const String & p_color) const {
return false;
}
-bool EditorExportPlatformWinrt::_valid_image(const Ref<ImageTexture> p_image, int p_width, int p_height) const {
+bool EditorExportPlatformUWP::_valid_image(const Ref<ImageTexture> p_image, int p_width, int p_height) const {
if (!p_image.is_valid()) return false;
@@ -1553,7 +1554,7 @@ bool EditorExportPlatformWinrt::_valid_image(const Ref<ImageTexture> p_image, in
return valid_w && valid_h;
}
-Vector<uint8_t> EditorExportPlatformWinrt::_fix_manifest(const Vector<uint8_t> &p_template, bool p_give_internet) const {
+Vector<uint8_t> EditorExportPlatformUWP::_fix_manifest(const Vector<uint8_t> &p_template, bool p_give_internet) const {
String result = String::utf8((const char*)p_template.ptr(), p_template.size());
@@ -1571,7 +1572,7 @@ Vector<uint8_t> EditorExportPlatformWinrt::_fix_manifest(const Vector<uint8_t> &
String architecture = arch == ARM ? "ARM" : arch == X86 ? "x86" : "x64";
result = result.replace("$architecture$", architecture);
- result = result.replace("$display_name$", display_name.empty() ? (String)Globals::get_singleton()->get("application/name") : display_name);
+ result = result.replace("$display_name$", display_name.empty() ? (String)GlobalConfig::get_singleton()->get("application/name") : display_name);
result = result.replace("$publisher_display_name$", publisher_display_name);
result = result.replace("$app_description$", description);
result = result.replace("$bg_color$", background_color);
@@ -1659,7 +1660,7 @@ Vector<uint8_t> EditorExportPlatformWinrt::_fix_manifest(const Vector<uint8_t> &
return r_ret;
}
-Vector<uint8_t> EditorExportPlatformWinrt::_get_image_data(const String & p_path) {
+Vector<uint8_t> EditorExportPlatformUWP::_get_image_data(const String & p_path) {
Vector<uint8_t> data;
Ref<ImageTexture> ref;
@@ -1741,7 +1742,7 @@ Vector<uint8_t> EditorExportPlatformWinrt::_get_image_data(const String & p_path
return data;
}
-Error EditorExportPlatformWinrt::save_appx_file(void * p_userdata, const String & p_path, const Vector<uint8_t>& p_data, int p_file, int p_total) {
+Error EditorExportPlatformUWP::save_appx_file(void * p_userdata, const String & p_path, const Vector<uint8_t>& p_data, int p_file, int p_total) {
AppxPackager *packager = (AppxPackager*)p_userdata;
String dst_path = p_path.replace_first("res://", "game/");
@@ -1751,7 +1752,7 @@ Error EditorExportPlatformWinrt::save_appx_file(void * p_userdata, const String
return OK;
}
-bool EditorExportPlatformWinrt::_should_compress_asset(const String & p_path, const Vector<uint8_t>& p_data) {
+bool EditorExportPlatformUWP::_should_compress_asset(const String & p_path, const Vector<uint8_t>& p_data) {
/* TODO: This was copied verbatim from Android export. It should be
* refactored to the parent class and also be used for .zip export.
@@ -1800,7 +1801,7 @@ bool EditorExportPlatformWinrt::_should_compress_asset(const String & p_path, co
return true;
}
-bool EditorExportPlatformWinrt::_set(const StringName& p_name, const Variant& p_value) {
+bool EditorExportPlatformUWP::_set(const StringName& p_name, const Variant& p_value) {
String n = p_name;
@@ -1906,7 +1907,7 @@ bool EditorExportPlatformWinrt::_set(const StringName& p_name, const Variant& p_
return true;
}
-bool EditorExportPlatformWinrt::_get(const StringName& p_name, Variant &r_ret) const {
+bool EditorExportPlatformUWP::_get(const StringName& p_name, Variant &r_ret) const {
String n = p_name;
@@ -2002,7 +2003,7 @@ bool EditorExportPlatformWinrt::_get(const StringName& p_name, Variant &r_ret) c
return true;
}
-void EditorExportPlatformWinrt::_get_property_list(List<PropertyInfo>* p_list) const {
+void EditorExportPlatformUWP::_get_property_list(List<PropertyInfo>* p_list) const {
p_list->push_back(PropertyInfo(Variant::STRING, "custom_package/debug", PROPERTY_HINT_GLOBAL_FILE, "appx"));
p_list->push_back(PropertyInfo(Variant::STRING, "custom_package/release", PROPERTY_HINT_GLOBAL_FILE, "appx"));
@@ -2071,14 +2072,14 @@ void EditorExportPlatformWinrt::_get_property_list(List<PropertyInfo>* p_list) c
}
-bool EditorExportPlatformWinrt::can_export(String * r_error) const {
+bool EditorExportPlatformUWP::can_export(String * r_error) const {
String err;
bool valid = true;
- if (!exists_export_template("winrt_x86_debug.zip") || !exists_export_template("winrt_x86_release.zip")
- || !exists_export_template("winrt_arm_debug.zip") || !exists_export_template("winrt_arm_release.zip")
- || !exists_export_template("winrt_x64_debug.zip") || !exists_export_template("winrt_x64_release.zip")) {
+ if (!exists_export_template("uwp_x86_debug.zip") || !exists_export_template("uwp_x86_release.zip")
+ || !exists_export_template("uwp_arm_debug.zip") || !exists_export_template("uwp_arm_release.zip")
+ || !exists_export_template("uwp_x64_debug.zip") || !exists_export_template("uwp_x64_release.zip")) {
valid = false;
err += TTR("No export templates found.\nDownload and install export templates.") + "\n";
}
@@ -2154,7 +2155,7 @@ bool EditorExportPlatformWinrt::can_export(String * r_error) const {
return valid;
}
-Error EditorExportPlatformWinrt::export_project(const String & p_path, bool p_debug, int p_flags) {
+Error EditorExportPlatformUWP::export_project(const String & p_path, bool p_debug, int p_flags) {
String src_appx;
@@ -2170,30 +2171,30 @@ Error EditorExportPlatformWinrt::export_project(const String & p_path, bool p_de
if (p_debug) {
switch (arch) {
case X86: {
- src_appx = find_export_template("winrt_x86_debug.zip", &err);
+ src_appx = find_export_template("uwp_x86_debug.zip", &err);
break;
}
case X64: {
- src_appx = find_export_template("winrt_x64_debug.zip", &err);
+ src_appx = find_export_template("uwp_x64_debug.zip", &err);
break;
}
case ARM: {
- src_appx = find_export_template("winrt_arm_debug.zip", &err);
+ src_appx = find_export_template("uwp_arm_debug.zip", &err);
break;
}
}
} else {
switch (arch) {
case X86: {
- src_appx = find_export_template("winrt_x86_release.zip", &err);
+ src_appx = find_export_template("uwp_x86_release.zip", &err);
break;
}
case X64: {
- src_appx = find_export_template("winrt_x64_release.zip", &err);
+ src_appx = find_export_template("uwp_x64_release.zip", &err);
break;
}
case ARM: {
- src_appx = find_export_template("winrt_arm_release.zip", &err);
+ src_appx = find_export_template("uwp_arm_release.zip", &err);
break;
}
}
@@ -2337,9 +2338,9 @@ Error EditorExportPlatformWinrt::export_project(const String & p_path, bool p_de
return OK;
}
-EditorExportPlatformWinrt::EditorExportPlatformWinrt() {
+EditorExportPlatformUWP::EditorExportPlatformUWP() {
- Image img(_winrt_logo);
+ Image img(_uwp_logo);
logo = Ref<ImageTexture>(memnew(ImageTexture));
logo->create_from_image(img);
@@ -2381,11 +2382,11 @@ EditorExportPlatformWinrt::EditorExportPlatformWinrt() {
certificate_pass = "";
}
-EditorExportPlatformWinrt::~EditorExportPlatformWinrt() {}
+EditorExportPlatformUWP::~EditorExportPlatformUWP() {}
-void register_winrt_exporter() {
+void register_uwp_exporter() {
- Ref<EditorExportPlatformWinrt> exporter = Ref<EditorExportPlatformWinrt>(memnew(EditorExportPlatformWinrt));
+ Ref<EditorExportPlatformUWP> exporter = Ref<EditorExportPlatformUWP>(memnew(EditorExportPlatformUWP));
EditorImportExport::get_singleton()->add_export_platform(exporter);
}
diff --git a/platform/winrt/export/export.h b/platform/uwp/export/export.h
index 278d6d23cd..2d6e02bb10 100644
--- a/platform/winrt/export/export.h
+++ b/platform/uwp/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 */
@@ -26,4 +26,4 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-void register_winrt_exporter();
+void register_uwp_exporter();
diff --git a/platform/winrt/gl_context_egl.cpp b/platform/uwp/gl_context_egl.cpp
index f7b514b3c0..c9c03db8a1 100644
--- a/platform/winrt/gl_context_egl.cpp
+++ b/platform/uwp/gl_context_egl.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/winrt/gl_context_egl.h b/platform/uwp/gl_context_egl.h
index 8124c2903d..858eaa6d12 100644
--- a/platform/winrt/gl_context_egl.h
+++ b/platform/uwp/gl_context_egl.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/winrt/joystick_winrt.cpp b/platform/uwp/joypad_uwp.cpp
index 9f93c5a26b..7f0837d7be 100644
--- a/platform/winrt/joystick_winrt.cpp
+++ b/platform/uwp/joypad_uwp.cpp
@@ -1,11 +1,11 @@
/*************************************************************************/
-/* joystick.cpp */
+/* joypad_uwp.cpp */
/*************************************************************************/
/* This file is part of: */
/* 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 */
@@ -27,20 +27,20 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "joystick_winrt.h"
+#include "joypad_uwp.h"
using namespace Windows::Gaming::Input;
using namespace Windows::Foundation;
-void JoystickWinrt::register_events() {
+void JoypadUWP::register_events() {
Gamepad::GamepadAdded +=
- ref new EventHandler<Gamepad^>(this, &JoystickWinrt::OnGamepadAdded);
+ ref new EventHandler<Gamepad^>(this, &JoypadUWP::OnGamepadAdded);
Gamepad::GamepadRemoved +=
- ref new EventHandler<Gamepad^>(this, &JoystickWinrt::OnGamepadRemoved);
+ ref new EventHandler<Gamepad^>(this, &JoypadUWP::OnGamepadRemoved);
}
-uint32_t JoystickWinrt::process_controllers(uint32_t p_last_id) {
+uint32_t JoypadUWP::process_controllers(uint32_t p_last_id) {
for (int i = 0; i < MAX_CONTROLLERS; i++) {
@@ -74,20 +74,20 @@ uint32_t JoystickWinrt::process_controllers(uint32_t p_last_id) {
return p_last_id;
}
-JoystickWinrt::JoystickWinrt() {
+JoypadUWP::JoypadUWP() {
for (int i = 0; i < MAX_CONTROLLERS; i++)
controllers[i].id = i;
}
-JoystickWinrt::JoystickWinrt(InputDefault * p_input) {
+JoypadUWP::JoypadUWP(InputDefault * p_input) {
input = p_input;
- JoystickWinrt();
+ JoypadUWP();
}
-void JoystickWinrt::OnGamepadAdded(Platform::Object ^ sender, Windows::Gaming::Input::Gamepad ^ value) {
+void JoypadUWP::OnGamepadAdded(Platform::Object ^ sender, Windows::Gaming::Input::Gamepad ^ value) {
short idx = -1;
@@ -106,10 +106,10 @@ void JoystickWinrt::OnGamepadAdded(Platform::Object ^ sender, Windows::Gaming::I
controllers[idx].id = idx;
controllers[idx].type = ControllerType::GAMEPAD_CONTROLLER;
- input->joy_connection_changed(controllers[idx].id, true, "Xbox Controller", "__WINRT_GAMEPAD__");
+ input->joy_connection_changed(controllers[idx].id, true, "Xbox Controller", "__UWP_GAMEPAD__");
}
-void JoystickWinrt::OnGamepadRemoved(Platform::Object ^ sender, Windows::Gaming::Input::Gamepad ^ value) {
+void JoypadUWP::OnGamepadRemoved(Platform::Object ^ sender, Windows::Gaming::Input::Gamepad ^ value) {
short idx = -1;
@@ -136,7 +136,7 @@ void JoystickWinrt::OnGamepadRemoved(Platform::Object ^ sender, Windows::Gaming:
input->joy_connection_changed(idx, false, "Xbox Controller");
}
-InputDefault::JoyAxis JoystickWinrt::axis_correct(double p_val, bool p_negate, bool p_trigger) const {
+InputDefault::JoyAxis JoypadUWP::axis_correct(double p_val, bool p_negate, bool p_trigger) const {
InputDefault::JoyAxis jx;
diff --git a/platform/winrt/joystick_winrt.h b/platform/uwp/joypad_uwp.h
index 17f9565708..5d81ac44c0 100644
--- a/platform/winrt/joystick_winrt.h
+++ b/platform/uwp/joypad_uwp.h
@@ -1,11 +1,11 @@
/*************************************************************************/
-/* joystick.h */
+/* joypad_uwp.h */
/*************************************************************************/
/* This file is part of: */
/* 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 */
@@ -26,20 +26,22 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef JOYSTICK_WINRT_H
-#define JOYSTICK_WINRT_H
+#ifndef JOYPAD_UWP_H
+#define JOYPAD_UWP_H
#include "main/input_default.h"
-ref class JoystickWinrt sealed {
+ref class JoypadUWP sealed {
+ /** clang-format breaks this, it does not understand this token. */
+ /* clang-format off */
internal:
-
void register_events();
uint32_t process_controllers(uint32_t p_last_id);
+ /* clang-format on */
- JoystickWinrt();
- JoystickWinrt(InputDefault* p_input);
+ JoypadUWP();
+ JoypadUWP(InputDefault* p_input);
private:
diff --git a/platform/winrt/logo.png b/platform/uwp/logo.png
index 4376abd563..4376abd563 100644
--- a/platform/winrt/logo.png
+++ b/platform/uwp/logo.png
Binary files differ
diff --git a/platform/winrt/os_winrt.cpp b/platform/uwp/os_uwp.cpp
index 4b23f3960e..90c21e11a1 100644
--- a/platform/winrt/os_winrt.cpp
+++ b/platform/uwp/os_uwp.cpp
@@ -1,11 +1,11 @@
/*************************************************************************/
-/* os_winrt.cpp */
+/* os_uwp.cpp */
/*************************************************************************/
/* This file is part of: */
/* 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 */
@@ -27,25 +27,21 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "drivers/gles2/rasterizer_gles2.h"
-#include "os_winrt.h"
+#include "os_uwp.h"
#include "drivers/unix/memory_pool_static_malloc.h"
#include "os/memory_pool_dynamic_static.h"
-#include "thread_winrt.h"
+#include "thread_uwp.h"
#include "drivers/windows/semaphore_windows.h"
#include "drivers/windows/mutex_windows.h"
#include "main/main.h"
#include "drivers/windows/file_access_windows.h"
#include "drivers/windows/dir_access_windows.h"
-
-
#include "servers/visual/visual_server_raster.h"
-#include "servers/audio/audio_server_sw.h"
-#include "servers/visual/visual_server_wrap_mt.h"
-
+#include "servers/audio_server.h"
+//#include "servers/visual/visual_server_wrap_mt.h"
#include "os/memory_pool_dynamic_prealloc.h"
#include "globals.h"
#include "io/marshalls.h"
-
#include "platform/windows/packet_peer_udp_winsock.h"
#include "platform/windows/stream_peer_winsock.h"
#include "platform/windows/tcp_server_winsock.h"
@@ -69,28 +65,28 @@ using namespace Windows::ApplicationModel::DataTransfer;
using namespace concurrency;
-int OSWinrt::get_video_driver_count() const {
+int OSUWP::get_video_driver_count() const {
return 1;
}
-const char * OSWinrt::get_video_driver_name(int p_driver) const {
+const char * OSUWP::get_video_driver_name(int p_driver) const {
return "GLES2";
}
-OS::VideoMode OSWinrt::get_default_video_mode() const {
+OS::VideoMode OSUWP::get_default_video_mode() const {
return video_mode;
}
-Size2 OSWinrt::get_window_size() const {
+Size2 OSUWP::get_window_size() const {
Size2 size;
size.width = video_mode.width;
size.height = video_mode.height;
return size;
}
-void OSWinrt::set_window_size(const Size2 p_size) {
+void OSUWP::set_window_size(const Size2 p_size) {
Windows::Foundation::Size new_size;
new_size.Width = p_size.width;
@@ -105,7 +101,7 @@ void OSWinrt::set_window_size(const Size2 p_size) {
}
}
-void OSWinrt::set_window_fullscreen(bool p_enabled) {
+void OSUWP::set_window_fullscreen(bool p_enabled) {
ApplicationView^ view = ApplicationView::GetForCurrentView();
@@ -126,12 +122,12 @@ void OSWinrt::set_window_fullscreen(bool p_enabled) {
}
}
-bool OSWinrt::is_window_fullscreen() const {
+bool OSUWP::is_window_fullscreen() const {
return ApplicationView::GetForCurrentView()->IsFullScreenMode;
}
-void OSWinrt::set_keep_screen_on(bool p_enabled) {
+void OSUWP::set_keep_screen_on(bool p_enabled) {
if (is_keep_screen_on() == p_enabled) return;
@@ -143,28 +139,29 @@ void OSWinrt::set_keep_screen_on(bool p_enabled) {
OS::set_keep_screen_on(p_enabled);
}
-int OSWinrt::get_audio_driver_count() const {
+int OSUWP::get_audio_driver_count() const {
- return AudioDriverManagerSW::get_driver_count();
+ return AudioDriverManager::get_driver_count();
}
-const char * OSWinrt::get_audio_driver_name(int p_driver) const {
- AudioDriverSW* driver = AudioDriverManagerSW::get_driver(p_driver);
+const char * OSUWP::get_audio_driver_name(int p_driver) const {
+
+ AudioDriver* driver = AudioDriverManager::get_driver(p_driver);
ERR_FAIL_COND_V( !driver, "" );
- return AudioDriverManagerSW::get_driver(p_driver)->get_name();
+ return AudioDriverManager::get_driver(p_driver)->get_name();
}
static MemoryPoolStatic *mempool_static=NULL;
static MemoryPoolDynamic *mempool_dynamic=NULL;
-void OSWinrt::initialize_core() {
+void OSUWP::initialize_core() {
last_button_state=0;
//RedirectIOToConsole();
- ThreadWinrt::make_default();
+ ThreadUWP::make_default();
SemaphoreWindows::make_default();
MutexWindows::make_default();
@@ -206,23 +203,23 @@ void OSWinrt::initialize_core() {
cursor_shape=CURSOR_ARROW;
}
-bool OSWinrt::can_draw() const {
+bool OSUWP::can_draw() const {
return !minimized;
};
-void OSWinrt::set_gl_context(ContextEGL* p_context) {
+void OSUWP::set_gl_context(ContextEGL* p_context) {
gl_context = p_context;
};
-void OSWinrt::screen_size_changed() {
+void OSUWP::screen_size_changed() {
gl_context->reset();
};
-void OSWinrt::initialize(const VideoMode& p_desired,int p_video_driver,int p_audio_driver) {
+void OSUWP::initialize(const VideoMode& p_desired,int p_video_driver,int p_audio_driver) {
main_loop=NULL;
outside=true;
@@ -285,26 +282,16 @@ void OSWinrt::initialize(const VideoMode& p_desired,int p_video_driver,int p_aud
input = memnew( InputDefault );
- joystick = ref new JoystickWinrt(input);
- joystick->register_events();
+ joypad = ref new JoypadUWP(input);
+ joypad->register_events();
- AudioDriverManagerSW::get_driver(p_audio_driver)->set_singleton();
+ AudioDriverManager::get_driver(p_audio_driver)->set_singleton();
- if (AudioDriverManagerSW::get_driver(p_audio_driver)->init()!=OK) {
+ if (AudioDriverManager::get_driver(p_audio_driver)->init()!=OK) {
ERR_PRINT("Initializing audio failed.");
}
- sample_manager = memnew( SampleManagerMallocSW );
- audio_server = memnew( AudioServerSW(sample_manager) );
-
- audio_server->init();
-
- spatial_sound_server = memnew( SpatialSoundServerSW );
- spatial_sound_server->init();
- spatial_sound_2d_server = memnew( SpatialSound2DServerSW );
- spatial_sound_2d_server->init();
-
managed_object->update_clipboard();
Clipboard::ContentChanged += ref new EventHandler<Platform::Object^>(managed_object, &ManagedType::on_clipboard_changed);
@@ -345,7 +332,7 @@ void OSWinrt::initialize(const VideoMode& p_desired,int p_video_driver,int p_aud
}
-void OSWinrt::set_clipboard(const String& p_text) {
+void OSUWP::set_clipboard(const String& p_text) {
DataPackage^ clip = ref new DataPackage();
clip->RequestedOperation = DataPackageOperation::Copy;
@@ -354,7 +341,7 @@ void OSWinrt::set_clipboard(const String& p_text) {
Clipboard::SetContent(clip);
};
-String OSWinrt::get_clipboard() const {
+String OSUWP::get_clipboard() const {
if (managed_object->clipboard != nullptr)
return managed_object->clipboard->Data();
@@ -363,7 +350,7 @@ String OSWinrt::get_clipboard() const {
};
-void OSWinrt::input_event(InputEvent &p_event) {
+void OSUWP::input_event(InputEvent &p_event) {
p_event.ID = ++last_id;
@@ -378,20 +365,20 @@ void OSWinrt::input_event(InputEvent &p_event) {
}
};
-void OSWinrt::delete_main_loop() {
+void OSUWP::delete_main_loop() {
if (main_loop)
memdelete(main_loop);
main_loop=NULL;
}
-void OSWinrt::set_main_loop( MainLoop * p_main_loop ) {
+void OSUWP::set_main_loop( MainLoop * p_main_loop ) {
input->set_main_loop(p_main_loop);
main_loop=p_main_loop;
}
-void OSWinrt::finalize() {
+void OSUWP::finalize() {
if(main_loop)
memdelete(main_loop);
@@ -407,19 +394,11 @@ void OSWinrt::finalize() {
if (rasterizer)
memdelete(rasterizer);
- spatial_sound_server->finish();
- memdelete(spatial_sound_server);
- spatial_sound_2d_server->finish();
- memdelete(spatial_sound_2d_server);
-
- //if (debugger_connection_console) {
-// memdelete(debugger_connection_console);
-//}
-
- memdelete(sample_manager);
-
- audio_server->finish();
- memdelete(audio_server);
+ /*
+ if (debugger_connection_console) {
+ memdelete(debugger_connection_console);
+ }
+ */
memdelete(input);
@@ -429,10 +408,10 @@ void OSWinrt::finalize() {
physics_2d_server->finish();
memdelete(physics_2d_server);
- joystick = nullptr;
+ joypad = nullptr;
}
-void OSWinrt::finalize_core() {
+void OSUWP::finalize_core() {
if (mempool_dynamic)
memdelete( mempool_dynamic );
@@ -440,7 +419,7 @@ void OSWinrt::finalize_core() {
}
-void OSWinrt::vprint(const char* p_format, va_list p_list, bool p_stderr) {
+void OSUWP::vprint(const char* p_format, va_list p_list, bool p_stderr) {
char buf[16384+1];
int len = vsnprintf(buf,16384,p_format,p_list);
@@ -467,14 +446,14 @@ void OSWinrt::vprint(const char* p_format, va_list p_list, bool p_stderr) {
fflush(stdout);
};
-void OSWinrt::alert(const String& p_alert,const String& p_title) {
+void OSUWP::alert(const String& p_alert,const String& p_title) {
Platform::String^ alert = ref new Platform::String(p_alert.c_str());
Platform::String^ title = ref new Platform::String(p_title.c_str());
MessageDialog^ msg = ref new MessageDialog(alert, title);
- UICommand^ close = ref new UICommand("Close", ref new UICommandInvokedHandler(managed_object, &OSWinrt::ManagedType::alert_close));
+ UICommand^ close = ref new UICommand("Close", ref new UICommandInvokedHandler(managed_object, &OSUWP::ManagedType::alert_close));
msg->Commands->Append(close);
msg->DefaultCommandIndex = 0;
@@ -483,17 +462,17 @@ void OSWinrt::alert(const String& p_alert,const String& p_title) {
msg->ShowAsync();
}
-void OSWinrt::ManagedType::alert_close(IUICommand^ command) {
+void OSUWP::ManagedType::alert_close(IUICommand^ command) {
alert_close_handle = false;
}
-void OSWinrt::ManagedType::on_clipboard_changed(Platform::Object ^ sender, Platform::Object ^ ev) {
+void OSUWP::ManagedType::on_clipboard_changed(Platform::Object ^ sender, Platform::Object ^ ev) {
update_clipboard();
}
-void OSWinrt::ManagedType::update_clipboard() {
+void OSUWP::ManagedType::update_clipboard() {
DataPackageView^ data = Clipboard::GetContent();
@@ -507,7 +486,7 @@ void OSWinrt::ManagedType::update_clipboard() {
}
}
-void OSWinrt::ManagedType::on_accelerometer_reading_changed(Accelerometer ^ sender, AccelerometerReadingChangedEventArgs ^ args) {
+void OSUWP::ManagedType::on_accelerometer_reading_changed(Accelerometer ^ sender, AccelerometerReadingChangedEventArgs ^ args) {
AccelerometerReading^ reading = args->Reading;
@@ -518,7 +497,7 @@ void OSWinrt::ManagedType::on_accelerometer_reading_changed(Accelerometer ^ send
));
}
-void OSWinrt::ManagedType::on_magnetometer_reading_changed(Magnetometer ^ sender, MagnetometerReadingChangedEventArgs ^ args) {
+void OSUWP::ManagedType::on_magnetometer_reading_changed(Magnetometer ^ sender, MagnetometerReadingChangedEventArgs ^ args) {
MagnetometerReading^ reading = args->Reading;
@@ -529,7 +508,7 @@ void OSWinrt::ManagedType::on_magnetometer_reading_changed(Magnetometer ^ sender
));
}
-void OSWinrt::ManagedType::on_gyroscope_reading_changed(Gyrometer ^ sender, GyrometerReadingChangedEventArgs ^ args) {
+void OSUWP::ManagedType::on_gyroscope_reading_changed(Gyrometer ^ sender, GyrometerReadingChangedEventArgs ^ args) {
GyrometerReading^ reading = args->Reading;
@@ -540,7 +519,7 @@ void OSWinrt::ManagedType::on_gyroscope_reading_changed(Gyrometer ^ sender, Gyro
));
}
-void OSWinrt::set_mouse_mode(MouseMode p_mode) {
+void OSUWP::set_mouse_mode(MouseMode p_mode) {
if (p_mode == MouseMode::MOUSE_MODE_CAPTURED) {
@@ -566,41 +545,41 @@ void OSWinrt::set_mouse_mode(MouseMode p_mode) {
SetEvent(mouse_mode_changed);
}
-OSWinrt::MouseMode OSWinrt::get_mouse_mode() const{
+OSUWP::MouseMode OSUWP::get_mouse_mode() const{
return mouse_mode;
}
-Point2 OSWinrt::get_mouse_pos() const {
+Point2 OSUWP::get_mouse_pos() const {
return Point2(old_x, old_y);
}
-int OSWinrt::get_mouse_button_state() const {
+int OSUWP::get_mouse_button_state() const {
return last_button_state;
}
-void OSWinrt::set_window_title(const String& p_title) {
+void OSUWP::set_window_title(const String& p_title) {
}
-void OSWinrt::set_video_mode(const VideoMode& p_video_mode,int p_screen) {
+void OSUWP::set_video_mode(const VideoMode& p_video_mode,int p_screen) {
video_mode = p_video_mode;
}
-OS::VideoMode OSWinrt::get_video_mode(int p_screen) const {
+OS::VideoMode OSUWP::get_video_mode(int p_screen) const {
return video_mode;
}
-void OSWinrt::get_fullscreen_mode_list(List<VideoMode> *p_list,int p_screen) const {
+void OSUWP::get_fullscreen_mode_list(List<VideoMode> *p_list,int p_screen) const {
}
-void OSWinrt::print_error(const char* p_function, const char* p_file, int p_line, const char* p_code, const char* p_rationale, ErrorType p_type) {
+void OSUWP::print_error(const char* p_function, const char* p_file, int p_line, const char* p_code, const char* p_rationale, ErrorType p_type) {
const char* err_details;
if (p_rationale && p_rationale[0])
@@ -625,12 +604,12 @@ void OSWinrt::print_error(const char* p_function, const char* p_file, int p_line
}
-String OSWinrt::get_name() {
+String OSUWP::get_name() {
- return "WinRT";
+ return "UWP";
}
-OS::Date OSWinrt::get_date(bool utc) const {
+OS::Date OSUWP::get_date(bool utc) const {
SYSTEMTIME systemtime;
if (utc)
@@ -646,7 +625,7 @@ OS::Date OSWinrt::get_date(bool utc) const {
date.dst=false;
return date;
}
-OS::Time OSWinrt::get_time(bool utc) const {
+OS::Time OSUWP::get_time(bool utc) const {
SYSTEMTIME systemtime;
if (utc)
@@ -661,7 +640,7 @@ OS::Time OSWinrt::get_time(bool utc) const {
return time;
}
-OS::TimeZoneInfo OSWinrt::get_time_zone_info() const {
+OS::TimeZoneInfo OSUWP::get_time_zone_info() const {
TIME_ZONE_INFORMATION info;
bool daylight = false;
if (GetTimeZoneInformation(&info) == TIME_ZONE_ID_DAYLIGHT)
@@ -678,7 +657,7 @@ OS::TimeZoneInfo OSWinrt::get_time_zone_info() const {
return ret;
}
-uint64_t OSWinrt::get_unix_time() const {
+uint64_t OSUWP::get_unix_time() const {
FILETIME ft;
SYSTEMTIME st;
@@ -700,7 +679,7 @@ uint64_t OSWinrt::get_unix_time() const {
return (*(uint64_t*)&ft - *(uint64_t*)&fep) / 10000000;
};
-void OSWinrt::delay_usec(uint32_t p_usec) const {
+void OSUWP::delay_usec(uint32_t p_usec) const {
int msec = p_usec < 1000 ? 1 : p_usec / 1000;
@@ -708,7 +687,7 @@ void OSWinrt::delay_usec(uint32_t p_usec) const {
WaitForSingleObjectEx(GetCurrentThread(), msec, false);
}
-uint64_t OSWinrt::get_ticks_usec() const {
+uint64_t OSUWP::get_ticks_usec() const {
uint64_t ticks;
uint64_t time;
@@ -723,13 +702,13 @@ uint64_t OSWinrt::get_ticks_usec() const {
}
-void OSWinrt::process_events() {
+void OSUWP::process_events() {
- last_id = joystick->process_controllers(last_id);
+ last_id = joypad->process_controllers(last_id);
process_key_events();
}
-void OSWinrt::process_key_events()
+void OSUWP::process_key_events()
{
for (int i = 0; i < key_event_pos; i++) {
@@ -750,7 +729,7 @@ void OSWinrt::process_key_events()
key_event_pos = 0;
}
-void OSWinrt::queue_key_event(KeyEvent & p_event)
+void OSUWP::queue_key_event(KeyEvent & p_event)
{
// This merges Char events with the previous Key event, so
// the unicode can be retrieved without sending duplicate events.
@@ -768,7 +747,7 @@ void OSWinrt::queue_key_event(KeyEvent & p_event)
key_event_buffer[key_event_pos++] = p_event;
}
-void OSWinrt::set_cursor_shape(CursorShape p_shape) {
+void OSUWP::set_cursor_shape(CursorShape p_shape) {
ERR_FAIL_INDEX(p_shape, CURSOR_MAX);
@@ -800,58 +779,58 @@ void OSWinrt::set_cursor_shape(CursorShape p_shape) {
cursor_shape = p_shape;
}
-Error OSWinrt::execute(const String& p_path, const List<String>& p_arguments,bool p_blocking,ProcessID *r_child_id,String* r_pipe,int *r_exitcode) {
+Error OSUWP::execute(const String& p_path, const List<String>& p_arguments,bool p_blocking,ProcessID *r_child_id,String* r_pipe,int *r_exitcode) {
return FAILED;
};
-Error OSWinrt::kill(const ProcessID& p_pid) {
+Error OSUWP::kill(const ProcessID& p_pid) {
return FAILED;
};
-Error OSWinrt::set_cwd(const String& p_cwd) {
+Error OSUWP::set_cwd(const String& p_cwd) {
return FAILED;
}
-String OSWinrt::get_executable_path() const {
+String OSUWP::get_executable_path() const {
return "";
}
-void OSWinrt::set_icon(const Image& p_icon) {
+void OSUWP::set_icon(const Image& p_icon) {
}
-bool OSWinrt::has_environment(const String& p_var) const {
+bool OSUWP::has_environment(const String& p_var) const {
return false;
};
-String OSWinrt::get_environment(const String& p_var) const {
+String OSUWP::get_environment(const String& p_var) const {
return "";
};
-String OSWinrt::get_stdin_string(bool p_block) {
+String OSUWP::get_stdin_string(bool p_block) {
return String();
}
-void OSWinrt::move_window_to_foreground() {
+void OSUWP::move_window_to_foreground() {
}
-Error OSWinrt::shell_open(String p_uri) {
+Error OSUWP::shell_open(String p_uri) {
return FAILED;
}
-String OSWinrt::get_locale() const {
+String OSUWP::get_locale() const {
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP // this should work on phone 8.1, but it doesn't
return "en";
@@ -861,46 +840,46 @@ String OSWinrt::get_locale() const {
#endif
}
-void OSWinrt::release_rendering_thread() {
+void OSUWP::release_rendering_thread() {
gl_context->release_current();
}
-void OSWinrt::make_rendering_thread() {
+void OSUWP::make_rendering_thread() {
gl_context->make_current();
}
-void OSWinrt::swap_buffers() {
+void OSUWP::swap_buffers() {
gl_context->swap_buffers();
}
-bool OSWinrt::has_touchscreen_ui_hint() const {
+bool OSUWP::has_touchscreen_ui_hint() const {
TouchCapabilities^ tc = ref new TouchCapabilities();
return tc->TouchPresent != 0 || UIViewSettings::GetForCurrentView()->UserInteractionMode == UserInteractionMode::Touch;
}
-bool OSWinrt::has_virtual_keyboard() const {
+bool OSUWP::has_virtual_keyboard() const {
return UIViewSettings::GetForCurrentView()->UserInteractionMode == UserInteractionMode::Touch;
}
-void OSWinrt::show_virtual_keyboard(const String & p_existing_text, const Rect2 & p_screen_rect) {
+void OSUWP::show_virtual_keyboard(const String & p_existing_text, const Rect2 & p_screen_rect) {
InputPane^ pane = InputPane::GetForCurrentView();
pane->TryShow();
}
-void OSWinrt::hide_virtual_keyboard() {
+void OSUWP::hide_virtual_keyboard() {
InputPane^ pane = InputPane::GetForCurrentView();
pane->TryHide();
}
-void OSWinrt::run() {
+void OSUWP::run() {
if (!main_loop)
return;
@@ -927,13 +906,13 @@ void OSWinrt::run() {
-MainLoop *OSWinrt::get_main_loop() const {
+MainLoop *OSUWP::get_main_loop() const {
return main_loop;
}
-String OSWinrt::get_data_dir() const {
+String OSUWP::get_data_dir() const {
Windows::Storage::StorageFolder ^data_folder = Windows::Storage::ApplicationData::Current->LocalFolder;
@@ -941,7 +920,7 @@ String OSWinrt::get_data_dir() const {
}
-OSWinrt::OSWinrt() {
+OSUWP::OSUWP() {
key_event_pos=0;
force_quit=false;
@@ -969,11 +948,11 @@ OSWinrt::OSWinrt() {
mouse_mode_changed = CreateEvent(NULL, TRUE, FALSE, L"os_mouse_mode_changed");
- AudioDriverManagerSW::add_driver(&audio_driver);
+ AudioDriverManager::add_driver(&audio_driver);
}
-OSWinrt::~OSWinrt()
+OSUWP::~OSUWP()
{
#ifdef STDOUT_FILE
fclose(stdo);
diff --git a/platform/winrt/os_winrt.h b/platform/uwp/os_uwp.h
index a4667f213d..f65aa2d8d9 100644
--- a/platform/winrt/os_winrt.h
+++ b/platform/uwp/os_uwp.h
@@ -1,11 +1,11 @@
/*************************************************************************/
-/* os_winrt.h */
+/* os_uwp.h */
/*************************************************************************/
/* This file is part of: */
/* 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 */
@@ -26,41 +26,32 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef OSWinrt_H
-#define OSWinrt_H
+#ifndef OSUWP_H
+#define OSUWP_H
#include "os/input.h"
#include "os/os.h"
#include "servers/visual_server.h"
#include "servers/visual/rasterizer.h"
#include "servers/physics/physics_server_sw.h"
-
-#include "servers/audio/audio_server_sw.h"
-#include "servers/audio/sample_manager_sw.h"
-#include "servers/spatial_sound/spatial_sound_server_sw.h"
-#include "servers/spatial_sound_2d/spatial_sound_2d_server_sw.h"
+#include "servers/audio_server.h"
#include "servers/physics_2d/physics_2d_server_sw.h"
#include "drivers/xaudio2/audio_driver_xaudio2.h"
-
#include "gl_context_egl.h"
-
#include "core/math/math_2d.h"
#include "core/ustring.h"
+#include "main/input_default.h"
+#include "joypad_uwp.h"
#include <windows.h>
-
#include <io.h>
-
#include <fcntl.h>
#include <stdio.h>
-#include "main/input_default.h"
-
-#include "joystick_winrt.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
-class OSWinrt : public OS {
+class OSUWP : public OS {
public:
@@ -85,7 +76,7 @@ public:
private:
enum {
- JOYSTICKS_MAX = 8,
+ JOYPADS_MAX = 8,
JOY_AXIS_COUNT = 6,
MAX_JOY_AXIS = 32768, // I've no idea
KEY_EVENT_BUFFER_SIZE=512
@@ -119,10 +110,6 @@ private:
MainLoop *main_loop;
AudioDriverXAudio2 audio_driver;
- AudioServerSW *audio_server;
- SampleManagerMallocSW *sample_manager;
- SpatialSoundServerSW *spatial_sound_server;
- SpatialSound2DServerSW *spatial_sound_2d_server;
MouseMode mouse_mode;
bool alt_mem;
@@ -137,7 +124,7 @@ private:
InputDefault *input;
- JoystickWinrt^ joystick;
+ JoypadUWP^ joypad;
Windows::System::Display::DisplayRequest^ display_request;
@@ -157,9 +144,12 @@ private:
void on_magnetometer_reading_changed(Windows::Devices::Sensors::Magnetometer^ sender, Windows::Devices::Sensors::MagnetometerReadingChangedEventArgs^ args);
void on_gyroscope_reading_changed(Windows::Devices::Sensors::Gyrometer^ sender, Windows::Devices::Sensors::GyrometerReadingChangedEventArgs^ args);
+ /** clang-format breaks this, it does not understand this token. */
+ /* clang-format off */
internal:
ManagedType() { alert_close_handle = false; }
- property OSWinrt* os;
+ property OSUWP* os;
+ /* clang-format on */
};
ManagedType^ managed_object;
Windows::Devices::Sensors::Accelerometer^ accelerometer;
@@ -273,8 +263,8 @@ public:
void queue_key_event(KeyEvent &p_event);
- OSWinrt();
- ~OSWinrt();
+ OSUWP();
+ ~OSUWP();
};
diff --git a/platform/winrt/platform_config.h b/platform/uwp/platform_config.h
index 88b1fefed8..7939e1c9ee 100644
--- a/platform/winrt/platform_config.h
+++ b/platform/uwp/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/winrt/thread_winrt.cpp b/platform/uwp/thread_uwp.cpp
index 8e3e0d5bef..4008a1eeb0 100644
--- a/platform/winrt/thread_winrt.cpp
+++ b/platform/uwp/thread_uwp.cpp
@@ -1,11 +1,11 @@
/*************************************************************************/
-/* thread_winrt.cpp */
+/* thread_uwp.cpp */
/*************************************************************************/
/* This file is part of: */
/* 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 */
@@ -26,13 +26,13 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "thread_winrt.h"
+#include "thread_uwp.h"
#include "os/memory.h"
-Thread* ThreadWinrt::create_func_winrt(ThreadCreateCallback p_callback,void *p_user,const Settings&) {
+Thread* ThreadUWP::create_func_uwp(ThreadCreateCallback p_callback,void *p_user,const Settings&) {
- ThreadWinrt* thread = memnew(ThreadWinrt);
+ ThreadUWP* thread = memnew(ThreadUWP);
std::thread new_thread(p_callback, p_user);
@@ -41,34 +41,34 @@ Thread* ThreadWinrt::create_func_winrt(ThreadCreateCallback p_callback,void *p_u
return thread;
};
-Thread::ID ThreadWinrt::get_thread_ID_func_winrt() {
+Thread::ID ThreadUWP::get_thread_ID_func_uwp() {
return std::hash<std::thread::id>()(std::this_thread::get_id());
};
-void ThreadWinrt::wait_to_finish_func_winrt(Thread* p_thread) {
+void ThreadUWP::wait_to_finish_func_uwp(Thread* p_thread) {
- ThreadWinrt *tp=static_cast<ThreadWinrt*>(p_thread);
+ ThreadUWP *tp=static_cast<ThreadUWP*>(p_thread);
tp->thread.join();
};
-Thread::ID ThreadWinrt::get_ID() const {
+Thread::ID ThreadUWP::get_ID() const {
return std::hash<std::thread::id>()(thread.get_id());
};
-void ThreadWinrt::make_default() {
- create_func = create_func_winrt;
- get_thread_ID_func = get_thread_ID_func_winrt;
- wait_to_finish_func = wait_to_finish_func_winrt;
+void ThreadUWP::make_default() {
+ create_func = create_func_uwp;
+ get_thread_ID_func = get_thread_ID_func_uwp;
+ wait_to_finish_func = wait_to_finish_func_uwp;
};
-ThreadWinrt::ThreadWinrt() {
+ThreadUWP::ThreadUWP() {
};
-ThreadWinrt::~ThreadWinrt() {
+ThreadUWP::~ThreadUWP() {
};
diff --git a/platform/winrt/thread_winrt.h b/platform/uwp/thread_uwp.h
index df275d560a..06c19c0139 100644
--- a/platform/winrt/thread_winrt.h
+++ b/platform/uwp/thread_uwp.h
@@ -1,11 +1,11 @@
/*************************************************************************/
-/* thread_winrt.h */
+/* thread_uwp.h */
/*************************************************************************/
/* This file is part of: */
/* 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 */
@@ -26,24 +26,24 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef THREAD_WINRT_H
-#define THREAD_WINRT_H
+#ifndef THREAD_UWP_H
+#define THREAD_UWP_H
-#ifdef WINRT_ENABLED
+#ifdef UWP_ENABLED
#include "os/thread.h"
#include <thread>
-class ThreadWinrt : public Thread {
+class ThreadUWP : public Thread {
std::thread thread;
- static Thread* create_func_winrt(ThreadCreateCallback p_callback,void *,const Settings&);
- static ID get_thread_ID_func_winrt();
- static void wait_to_finish_func_winrt(Thread* p_thread);
+ static Thread* create_func_uwp(ThreadCreateCallback p_callback,void *,const Settings&);
+ static ID get_thread_ID_func_uwp();
+ static void wait_to_finish_func_uwp(Thread* p_thread);
- ThreadWinrt();
+ ThreadUWP();
public:
@@ -52,7 +52,7 @@ public:
static void make_default();
- ~ThreadWinrt();
+ ~ThreadUWP();
};
diff --git a/platform/windows/SCsub b/platform/windows/SCsub
index e53eb7af34..ae8c07384f 100644
--- a/platform/windows/SCsub
+++ b/platform/windows/SCsub
@@ -3,27 +3,27 @@
Import('env')
-common_win=[
- "context_gl_win.cpp",
- "os_windows.cpp",
- "ctxgl_procaddr.cpp",
- "key_mapping_win.cpp",
- "tcp_server_winsock.cpp",
- "packet_peer_udp_winsock.cpp",
- "stream_peer_winsock.cpp",
- "joystick.cpp",
+common_win = [
+ "context_gl_win.cpp",
+ "os_windows.cpp",
+ "ctxgl_procaddr.cpp",
+ "key_mapping_win.cpp",
+ "tcp_server_winsock.cpp",
+ "packet_peer_udp_winsock.cpp",
+ "stream_peer_winsock.cpp",
+ "joypad.cpp",
]
-restarget="godot_res"+env["OBJSUFFIX"]
+restarget = "godot_res" + env["OBJSUFFIX"]
-obj = env.RES(restarget,'godot_res.rc')
+obj = env.RES(restarget, 'godot_res.rc')
common_win.append(obj)
-env.Program('#bin/godot',['godot_win.cpp']+common_win,PROGSUFFIX=env["PROGSUFFIX"])
+env.Program('#bin/godot', ['godot_win.cpp'] + common_win, PROGSUFFIX=env["PROGSUFFIX"])
# Microsoft Visual Studio Project Generation
-if (env['vsproj'])=="yes":
- env.vs_srcs = env.vs_srcs + ["platform/windows/godot_win.cpp"]
- for x in common_win:
- env.vs_srcs = env.vs_srcs + ["platform/windows/" + str(x)]
+if (env['vsproj']) == "yes":
+ env.vs_srcs = env.vs_srcs + ["platform/windows/godot_win.cpp"]
+ for x in common_win:
+ env.vs_srcs = env.vs_srcs + ["platform/windows/" + str(x)]
diff --git a/platform/windows/context_gl_win.cpp b/platform/windows/context_gl_win.cpp
index fd9e895370..7a81dfef77 100644
--- a/platform/windows/context_gl_win.cpp
+++ b/platform/windows/context_gl_win.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 */
@@ -40,7 +40,6 @@
//
//
-#define WINVER 0x0500
#include "context_gl_win.h"
//#include "drivers/opengl/glwrapper.h"
@@ -110,6 +109,7 @@ bool ContextGL_Win::is_using_vsync() const {
return use_vsync;
}
+#define _WGL_CONTEXT_DEBUG_BIT_ARB 0x0001
Error ContextGL_Win::initialize() {
@@ -162,10 +162,10 @@ Error ContextGL_Win::initialize() {
if (opengl_3_context) {
int attribs[] = {
- WGL_CONTEXT_MAJOR_VERSION_ARB, 3,//we want a 3.1 context
- WGL_CONTEXT_MINOR_VERSION_ARB, 2,
+ WGL_CONTEXT_MAJOR_VERSION_ARB, 3,//we want a 3.3 context
+ WGL_CONTEXT_MINOR_VERSION_ARB, 3,
//and it shall be forward compatible so that we can only use up to date functionality
- WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
+ WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB|_WGL_CONTEXT_DEBUG_BIT_ARB,
0}; //zero indicates the end of the array
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = NULL; //pointer to the method
@@ -182,7 +182,7 @@ Error ContextGL_Win::initialize() {
if (!(new_hRC=wglCreateContextAttribsARB(hDC,0, attribs)))
{
wglDeleteContext(hRC);
- MessageBox(NULL,"Can't Create An OpenGL 3.1 Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);
+ MessageBox(NULL,"Can't Create An OpenGL 3.3 Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return ERR_CANT_CREATE; // Return false
}
wglMakeCurrent(hDC,NULL);
@@ -191,15 +191,15 @@ Error ContextGL_Win::initialize() {
if (!wglMakeCurrent(hDC,hRC)) // Try To Activate The Rendering Context
{
- MessageBox(NULL,"Can't Activate The GL 3.1 Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);
+ MessageBox(NULL,"Can't Activate The GL 3.3 Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return ERR_CANT_CREATE; // Return FALSE
}
- printf("Activated GL 3.1 context");
+ printf("Activated GL 3.3 context");
}
wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC) wglGetProcAddress ("wglSwapIntervalEXT");
-// glWrapperInit(wrapper_get_proc_address);
+ //glWrapperInit(wrapper_get_proc_address);
return OK;
}
diff --git a/platform/windows/context_gl_win.h b/platform/windows/context_gl_win.h
index e1ab6fb26a..96b54c6c14 100644
--- a/platform/windows/context_gl_win.h
+++ b/platform/windows/context_gl_win.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/windows/ctxgl_procaddr.cpp b/platform/windows/ctxgl_procaddr.cpp
index 1072197f89..bc8611dce4 100644
--- a/platform/windows/ctxgl_procaddr.cpp
+++ b/platform/windows/ctxgl_procaddr.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/windows/ctxgl_procaddr.h b/platform/windows/ctxgl_procaddr.h
index 2118e20e02..72f39e71ac 100644
--- a/platform/windows/ctxgl_procaddr.h
+++ b/platform/windows/ctxgl_procaddr.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/windows/detect.py b/platform/windows/detect.py
index 7ae0100762..382783d6bc 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -85,7 +85,7 @@
#####
# TODO :
-#
+#
# - finish to cleanup this script to remove all the remains of previous hacks and workarounds
# - make it work with the Windows7 SDK that is supposed to enable 64bits compilation for MSVC2010-Express
# - confirm it works well with other Visual Studio versions.
@@ -99,300 +99,301 @@ import sys
import methods
-def is_active():
- return True
-
-def get_name():
- return "Windows"
-
-def can_build():
-
- if (os.name=="nt"):
- #building natively on windows!
- if ( os.getenv("VCINSTALLDIR") ):
- return True
- else:
- print("\nMSVC not detected, attempting Mingw.")
- mingw32 = ""
- mingw64 = ""
- if ( os.getenv("MINGW32_PREFIX") ) :
- mingw32 = os.getenv("MINGW32_PREFIX")
- if ( os.getenv("MINGW64_PREFIX") ) :
- mingw64 = os.getenv("MINGW64_PREFIX")
-
- test = "gcc --version > NUL 2>&1"
- if os.system(test)!= 0 and os.system(mingw32+test)!=0 and os.system(mingw64+test)!=0 :
- print("- could not detect gcc.")
- print("Please, make sure a path to a Mingw /bin directory is accessible into the environment PATH.\n")
- return False
- else:
- print("- gcc detected.")
-
- return True
-
- if (os.name=="posix"):
-
- mingw = "i586-mingw32msvc-"
- mingw64 = "x86_64-w64-mingw32-"
- mingw32 = "i686-w64-mingw32-"
-
- if (os.getenv("MINGW32_PREFIX")):
- mingw32=os.getenv("MINGW32_PREFIX")
- mingw = mingw32
- if (os.getenv("MINGW64_PREFIX")):
- mingw64=os.getenv("MINGW64_PREFIX")
-
- test = "gcc --version &>/dev/null"
- if (os.system(mingw+test) == 0 or os.system(mingw64+test) == 0 or os.system(mingw32+test) == 0):
- return True
-
- return False
-
-def get_opts():
-
- mingw=""
- mingw32=""
- mingw64=""
- if ( os.name == "posix" ):
- mingw = "i586-mingw32msvc-"
- mingw32 = "i686-w64-mingw32-"
- mingw64 = "x86_64-w64-mingw32-"
-
- if os.system(mingw32+"gcc --version &>/dev/null") != 0 :
- mingw32 = mingw
-
- if (os.getenv("MINGW32_PREFIX")):
- mingw32=os.getenv("MINGW32_PREFIX")
- mingw = mingw32
- if (os.getenv("MINGW64_PREFIX")):
- mingw64=os.getenv("MINGW64_PREFIX")
-
-
- return [
- ('mingw_prefix','Mingw Prefix',mingw32),
- ('mingw_prefix_64','Mingw Prefix 64 bits',mingw64),
- ]
-
-def get_flags():
-
- return [
- ('builtin_zlib', 'yes'),
- ('openssl','builtin'), #use builtin openssl
- ]
-
-def build_res_file( target, source, env ):
-
- cmdbase = ""
- if (env["bits"] == "32"):
- cmdbase = env['mingw_prefix']
- else:
- cmdbase = env['mingw_prefix_64']
- CPPPATH = env['CPPPATH']
- cmdbase = cmdbase + 'windres --include-dir . '
- import subprocess
- for x in range(len(source)):
- cmd = cmdbase + '-i ' + str(source[x]) + ' -o ' + str(target[x])
- try:
- out = subprocess.Popen(cmd,shell = True,stderr = subprocess.PIPE).communicate()
- if len(out[1]):
- return 1
- except:
- return 1
- return 0
-
-def configure(env):
-
- env.Append(CPPPATH=['#platform/windows'])
- env['is_mingw']=False
- if (os.name=="nt" and os.getenv("VCINSTALLDIR") ):
- #build using visual studio
- env['ENV']['TMP'] = os.environ['TMP']
- env.Append(CPPPATH=['#platform/windows/include'])
- env.Append(LIBPATH=['#platform/windows/lib'])
-
-
- if (env["target"]=="release"):
-
- env.Append(CCFLAGS=['/O2'])
- env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS'])
- env.Append(LINKFLAGS=['/ENTRY:mainCRTStartup'])
-
- elif (env["target"]=="release_debug"):
-
- env.Append(CCFLAGS=['/O2','/DDEBUG_ENABLED'])
- env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
- elif (env["target"]=="debug_release"):
-
- env.Append(CCFLAGS=['/Z7','/Od'])
- env.Append(LINKFLAGS=['/DEBUG'])
- env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS'])
- env.Append(LINKFLAGS=['/ENTRY:mainCRTStartup'])
-
- elif (env["target"]=="debug"):
-
- env.Append(CCFLAGS=['/Z7','/DDEBUG_ENABLED','/DDEBUG_MEMORY_ENABLED','/DD3D_DEBUG_INFO','/Od'])
- env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
- env.Append(LINKFLAGS=['/DEBUG'])
-
-
- env.Append(CCFLAGS=['/MT','/Gd','/GR','/nologo'])
- env.Append(CXXFLAGS=['/TP'])
- env.Append(CPPFLAGS=['/DMSVC', '/GR', ])
- env.Append(CCFLAGS=['/I'+os.getenv("WindowsSdkDir")+"/Include"])
- env.Append(CCFLAGS=['/DWINDOWS_ENABLED'])
- env.Append(CCFLAGS=['/DRTAUDIO_ENABLED'])
- env.Append(CCFLAGS=['/DWIN32'])
- env.Append(CCFLAGS=['/DTYPED_METHOD_BIND'])
-
- env.Append(CCFLAGS=['/DGLES2_ENABLED'])
- LIBS=['winmm','opengl32','dsound','kernel32','ole32','oleaut32','user32','gdi32', 'IPHLPAPI','Shlwapi', 'wsock32','Ws2_32', 'shell32','advapi32','dinput8','dxguid']
- env.Append(LINKFLAGS=[p+env["LIBSUFFIX"] for p in LIBS])
-
- env.Append(LIBPATH=[os.getenv("WindowsSdkDir")+"/Lib"])
- if (os.getenv("DXSDK_DIR")):
- DIRECTX_PATH=os.getenv("DXSDK_DIR")
- else:
- DIRECTX_PATH="C:/Program Files/Microsoft DirectX SDK (March 2009)"
-
- if (os.getenv("VCINSTALLDIR")):
- VC_PATH=os.getenv("VCINSTALLDIR")
- else:
- VC_PATH=""
-
- env.Append(CCFLAGS=["/I" + p for p in os.getenv("INCLUDE").split(";")])
- env.Append(LIBPATH=[p for p in os.getenv("LIB").split(";")])
- env.Append(CCFLAGS=["/I"+DIRECTX_PATH+"/Include"])
- env.Append(LIBPATH=[DIRECTX_PATH+"/Lib/x86"])
- env['ENV'] = os.environ;
-
- # This detection function needs the tools env (that is env['ENV'], not SCons's env), and that is why it's this far bellow in the code
- compiler_version_str = methods.detect_visual_c_compiler_version(env['ENV'])
-
- # Note: this detection/override code from here onward should be here instead of in SConstruct because it's platform and compiler specific (MSVC/Windows)
- if(env["bits"] != "default"):
- print "Error: bits argument is disabled for MSVC"
- print ("Bits argument is not supported for MSVC compilation. Architecture depends on the Native/Cross Compile Tools Prompt/Developer Console (or Visual Studio settings)"
- +" that is being used to run SCons. As a consequence, bits argument is disabled. Run scons again without bits argument (example: scons p=windows) and SCons will attempt to detect what MSVC compiler"
- +" will be executed and inform you.")
- sys.exit()
-
- # Forcing bits argument because MSVC does not have a flag to set this through SCons... it's different compilers (cl.exe's) called from the propper command prompt
- # that decide the architecture that is build for. Scons can only detect the os.getenviron (because vsvarsall.bat sets a lot of stuff for cl.exe to work with)
- env["bits"]="32"
- env["x86_libtheora_opt_vc"]=True
-
- print "Detected MSVC compiler: "+compiler_version_str
- # If building for 64bit architecture, disable assembly optimisations for 32 bit builds (theora as of writting)... vc compiler for 64bit can not compile _asm
- if(compiler_version_str == "amd64" or compiler_version_str == "x86_amd64"):
- env["bits"]="64"
- env["x86_libtheora_opt_vc"]=False
- print "Compiled program architecture will be a 64 bit executable (forcing bits=64)."
- elif (compiler_version_str=="x86" or compiler_version_str == "amd64_x86"):
- print "Compiled program architecture will be a 32 bit executable. (forcing bits=32)."
- else:
- print "Failed to detect MSVC compiler architecture version... Defaulting to 32bit executable settings (forcing bits=32). Compilation attempt will continue, but SCons can not detect for what architecture this build is compiled for. You should check your settings/compilation setup."
- if env["bits"]=="64":
- env.Append(CCFLAGS=['/D_WIN64'])
-
- # Incremental linking fix
- env['BUILDERS']['ProgramOriginal'] = env['BUILDERS']['Program']
- env['BUILDERS']['Program'] = methods.precious_program
- else:
-
- # Workaround for MinGW. See:
- # http://www.scons.org/wiki/LongCmdLinesOnWin32
- env.use_windows_spawn_fix()
-
- #build using mingw
- if (os.name=="nt"):
- env['ENV']['TMP'] = os.environ['TMP'] #way to go scons, you can be so stupid sometimes
- else:
- env["PROGSUFFIX"]=env["PROGSUFFIX"]+".exe" # for linux cross-compilation
-
- mingw_prefix=""
+def is_active():
+ return True
- if (env["bits"]=="default"):
- env["bits"]="32"
- if (env["bits"]=="32"):
- env.Append(LINKFLAGS=['-static'])
- env.Append(LINKFLAGS=['-static-libgcc'])
- env.Append(LINKFLAGS=['-static-libstdc++'])
- mingw_prefix=env["mingw_prefix"];
- else:
- env.Append(LINKFLAGS=['-static'])
- mingw_prefix=env["mingw_prefix_64"];
+def get_name():
+ return "Windows"
- nulstr=""
- if (os.name=="posix"):
- nulstr=">/dev/null"
- else:
- nulstr=">nul"
+def can_build():
+ if (os.name == "nt"):
+ # building natively on windows!
+ if (os.getenv("VCINSTALLDIR")):
+ return True
+ else:
+ print("\nMSVC not detected, attempting Mingw.")
+ mingw32 = ""
+ mingw64 = ""
+ if (os.getenv("MINGW32_PREFIX")):
+ mingw32 = os.getenv("MINGW32_PREFIX")
+ if (os.getenv("MINGW64_PREFIX")):
+ mingw64 = os.getenv("MINGW64_PREFIX")
+ test = "gcc --version > NUL 2>&1"
+ if os.system(test) != 0 and os.system(mingw32 + test) != 0 and os.system(mingw64 + test) != 0:
+ print("- could not detect gcc.")
+ print("Please, make sure a path to a Mingw /bin directory is accessible into the environment PATH.\n")
+ return False
+ else:
+ print("- gcc detected.")
- # if os.system(mingw_prefix+"gcc --version"+nulstr)!=0:
- # #not really super consistent but..
- # print("Can't find Windows compiler: "+mingw_prefix)
- # sys.exit(255)
+ return True
- if (env["target"]=="release"):
+ if (os.name == "posix"):
- env.Append(CCFLAGS=['-msse2'])
+ mingw = "i586-mingw32msvc-"
+ mingw64 = "x86_64-w64-mingw32-"
+ mingw32 = "i686-w64-mingw32-"
- if (env["bits"]=="64"):
- env.Append(CCFLAGS=['-O3'])
- else:
- env.Append(CCFLAGS=['-O2'])
+ if (os.getenv("MINGW32_PREFIX")):
+ mingw32 = os.getenv("MINGW32_PREFIX")
+ mingw = mingw32
+ if (os.getenv("MINGW64_PREFIX")):
+ mingw64 = os.getenv("MINGW64_PREFIX")
- env.Append(LINKFLAGS=['-Wl,--subsystem,windows'])
+ test = "gcc --version &>/dev/null"
+ if (os.system(mingw + test) == 0 or os.system(mingw64 + test) == 0 or os.system(mingw32 + test) == 0):
+ return True
- elif (env["target"]=="release_debug"):
+ return False
- env.Append(CCFLAGS=['-O2','-DDEBUG_ENABLED'])
- elif (env["target"]=="debug"):
+def get_opts():
- env.Append(CCFLAGS=['-g', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
+ mingw = ""
+ mingw32 = ""
+ mingw64 = ""
+ if (os.name == "posix"):
+ mingw = "i586-mingw32msvc-"
+ mingw32 = "i686-w64-mingw32-"
+ mingw64 = "x86_64-w64-mingw32-"
+ if os.system(mingw32 + "gcc --version &>/dev/null") != 0:
+ mingw32 = mingw
+ if (os.getenv("MINGW32_PREFIX")):
+ mingw32 = os.getenv("MINGW32_PREFIX")
+ mingw = mingw32
+ if (os.getenv("MINGW64_PREFIX")):
+ mingw64 = os.getenv("MINGW64_PREFIX")
- env["CC"]=mingw_prefix+"gcc"
- env['AS']=mingw_prefix+"as"
- env['CXX'] = mingw_prefix+"g++"
- env['AR'] = mingw_prefix+"ar"
- env['RANLIB'] = mingw_prefix+"ranlib"
- env['LD'] = mingw_prefix+"g++"
- env["x86_libtheora_opt_gcc"]=True
+ return [
+ ('mingw_prefix', 'Mingw Prefix', mingw32),
+ ('mingw_prefix_64', 'Mingw Prefix 64 bits', mingw64),
+ ]
- #env['CC'] = "winegcc"
- #env['CXX'] = "wineg++"
- env.Append(CCFLAGS=['-DWINDOWS_ENABLED','-mwindows'])
- env.Append(CPPFLAGS=['-DRTAUDIO_ENABLED'])
- env.Append(CCFLAGS=['-DGLES2_ENABLED'])
- env.Append(LIBS=['mingw32','opengl32', 'dsound', 'ole32', 'd3d9','winmm','gdi32','iphlpapi','shlwapi','wsock32','ws2_32','kernel32', 'oleaut32', 'dinput8', 'dxguid'])
+def get_flags():
- # if (env["bits"]=="32"):
- # env.Append(LIBS=['gcc_s'])
- # #--with-arch=i686
- # env.Append(CPPFLAGS=['-march=i686'])
- # env.Append(LINKFLAGS=['-march=i686'])
+ return [
+ ]
+def build_res_file(target, source, env):
+ cmdbase = ""
+ if (env["bits"] == "32"):
+ cmdbase = env['mingw_prefix']
+ else:
+ cmdbase = env['mingw_prefix_64']
+ CPPPATH = env['CPPPATH']
+ cmdbase = cmdbase + 'windres --include-dir . '
+ import subprocess
+ for x in range(len(source)):
+ cmd = cmdbase + '-i ' + str(source[x]) + ' -o ' + str(target[x])
+ try:
+ out = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE).communicate()
+ if len(out[1]):
+ return 1
+ except:
+ return 1
+ return 0
- #'d3dx9d'
- env.Append(CPPFLAGS=['-DMINGW_ENABLED'])
- #env.Append(LINKFLAGS=['-g'])
- # resrc
- env['is_mingw']=True
- env.Append( BUILDERS = { 'RES' : env.Builder(action = build_res_file, suffix = '.o',src_suffix = '.rc') } )
+def configure(env):
- 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 = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } )
- env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
+ env.Append(CPPPATH=['#platform/windows'])
+
+ # Targeted Windows version: Vista (and later)
+ winver = "0x0600" # Windows Vista is the minimum target for windows builds
+
+ env['is_mingw'] = False
+ if (os.name == "nt" and os.getenv("VCINSTALLDIR")):
+ # build using visual studio
+ env['ENV']['TMP'] = os.environ['TMP']
+ env.Append(CPPPATH=['#platform/windows/include'])
+ env.Append(LIBPATH=['#platform/windows/lib'])
+ env.Append(CCFLAGS=['/DWINVER=%s' % winver, '/D_WIN32_WINNT=%s' % winver])
+
+ if (env["target"] == "release"):
+
+ env.Append(CCFLAGS=['/O2'])
+ env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS'])
+ env.Append(LINKFLAGS=['/ENTRY:mainCRTStartup'])
+
+ elif (env["target"] == "release_debug"):
+
+ env.Append(CCFLAGS=['/O2', '/DDEBUG_ENABLED'])
+ env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
+ elif (env["target"] == "debug_release"):
+
+ env.Append(CCFLAGS=['/Z7', '/Od'])
+ env.Append(LINKFLAGS=['/DEBUG'])
+ env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS'])
+ env.Append(LINKFLAGS=['/ENTRY:mainCRTStartup'])
+
+ elif (env["target"] == "debug"):
+
+ env.Append(CCFLAGS=['/Z7', '/DDEBUG_ENABLED', '/DDEBUG_MEMORY_ENABLED', '/DD3D_DEBUG_INFO', '/Od'])
+ env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
+ env.Append(LINKFLAGS=['/DEBUG'])
+
+ env.Append(CCFLAGS=['/MT', '/Gd', '/GR', '/nologo'])
+ env.Append(CXXFLAGS=['/TP'])
+ env.Append(CPPFLAGS=['/DMSVC', '/GR', ])
+ env.Append(CCFLAGS=['/I' + os.getenv("WindowsSdkDir") + "/Include"])
+ env.Append(CCFLAGS=['/DWINDOWS_ENABLED'])
+ env.Append(CCFLAGS=['/DRTAUDIO_ENABLED'])
+ env.Append(CCFLAGS=['/DWIN32'])
+ env.Append(CCFLAGS=['/DTYPED_METHOD_BIND'])
+
+ env.Append(CCFLAGS=['/DOPENGL_ENABLED'])
+ LIBS = ['winmm', 'opengl32', 'dsound', 'kernel32', 'ole32', 'oleaut32', 'user32', 'gdi32', 'IPHLPAPI', 'Shlwapi', 'wsock32', 'Ws2_32', 'shell32', 'advapi32', 'dinput8', 'dxguid']
+ env.Append(LINKFLAGS=[p + env["LIBSUFFIX"] for p in LIBS])
+
+ env.Append(LIBPATH=[os.getenv("WindowsSdkDir") + "/Lib"])
+ if (os.getenv("DXSDK_DIR")):
+ DIRECTX_PATH = os.getenv("DXSDK_DIR")
+ else:
+ DIRECTX_PATH = "C:/Program Files/Microsoft DirectX SDK (March 2009)"
+
+ if (os.getenv("VCINSTALLDIR")):
+ VC_PATH = os.getenv("VCINSTALLDIR")
+ else:
+ VC_PATH = ""
+
+ env.Append(CCFLAGS=["/I" + p for p in os.getenv("INCLUDE").split(";")])
+ env.Append(LIBPATH=[p for p in os.getenv("LIB").split(";")])
+ env.Append(CCFLAGS=["/I" + DIRECTX_PATH + "/Include"])
+ env.Append(LIBPATH=[DIRECTX_PATH + "/Lib/x86"])
+ env['ENV'] = os.environ
+
+ # This detection function needs the tools env (that is env['ENV'], not SCons's env), and that is why it's this far bellow in the code
+ compiler_version_str = methods.detect_visual_c_compiler_version(env['ENV'])
+
+ # Note: this detection/override code from here onward should be here instead of in SConstruct because it's platform and compiler specific (MSVC/Windows)
+ if(env["bits"] != "default"):
+ print "Error: bits argument is disabled for MSVC"
+ print ("Bits argument is not supported for MSVC compilation. Architecture depends on the Native/Cross Compile Tools Prompt/Developer Console (or Visual Studio settings)"
+ + " that is being used to run SCons. As a consequence, bits argument is disabled. Run scons again without bits argument (example: scons p=windows) and SCons will attempt to detect what MSVC compiler"
+ + " will be executed and inform you.")
+ sys.exit()
+
+ # Forcing bits argument because MSVC does not have a flag to set this through SCons... it's different compilers (cl.exe's) called from the propper command prompt
+ # that decide the architecture that is build for. Scons can only detect the os.getenviron (because vsvarsall.bat sets a lot of stuff for cl.exe to work with)
+ env["bits"] = "32"
+ env["x86_libtheora_opt_vc"] = True
+
+ print "Detected MSVC compiler: " + compiler_version_str
+ # If building for 64bit architecture, disable assembly optimisations for 32 bit builds (theora as of writting)... vc compiler for 64bit can not compile _asm
+ if(compiler_version_str == "amd64" or compiler_version_str == "x86_amd64"):
+ env["bits"] = "64"
+ env["x86_libtheora_opt_vc"] = False
+ print "Compiled program architecture will be a 64 bit executable (forcing bits=64)."
+ elif (compiler_version_str == "x86" or compiler_version_str == "amd64_x86"):
+ print "Compiled program architecture will be a 32 bit executable. (forcing bits=32)."
+ else:
+ print "Failed to detect MSVC compiler architecture version... Defaulting to 32bit executable settings (forcing bits=32). Compilation attempt will continue, but SCons can not detect for what architecture this build is compiled for. You should check your settings/compilation setup."
+ if env["bits"] == "64":
+ env.Append(CCFLAGS=['/D_WIN64'])
+
+ # Incremental linking fix
+ env['BUILDERS']['ProgramOriginal'] = env['BUILDERS']['Program']
+ env['BUILDERS']['Program'] = methods.precious_program
+
+ else:
+
+ # Workaround for MinGW. See:
+ # http://www.scons.org/wiki/LongCmdLinesOnWin32
+ env.use_windows_spawn_fix()
+
+ # build using mingw
+ env.Append(CCFLAGS=['-DWINVER=%s' % winver, '-D_WIN32_WINNT=%s' % winver])
+ if (os.name == "nt"):
+ env['ENV']['TMP'] = os.environ['TMP'] # way to go scons, you can be so stupid sometimes
+ else:
+ env["PROGSUFFIX"] = env["PROGSUFFIX"] + ".exe" # for linux cross-compilation
+
+ mingw_prefix = ""
+
+ if (env["bits"] == "default"):
+ env["bits"] = "64" if "PROGRAMFILES(X86)" in os.environ else "32"
+
+ if (env["bits"] == "32"):
+ env.Append(LINKFLAGS=['-static'])
+ env.Append(LINKFLAGS=['-static-libgcc'])
+ env.Append(LINKFLAGS=['-static-libstdc++'])
+ mingw_prefix = env["mingw_prefix"]
+ else:
+ env.Append(LINKFLAGS=['-static'])
+ mingw_prefix = env["mingw_prefix_64"]
+
+ nulstr = ""
+
+ if (os.name == "posix"):
+ nulstr = ">/dev/null"
+ else:
+ nulstr = ">nul"
+
+ # if os.system(mingw_prefix+"gcc --version"+nulstr)!=0:
+ # #not really super consistent but..
+ # print("Can't find Windows compiler: "+mingw_prefix)
+ # sys.exit(255)
+
+ if (env["target"] == "release"):
+
+ env.Append(CCFLAGS=['-msse2'])
+
+ if (env["bits"] == "64"):
+ env.Append(CCFLAGS=['-O3'])
+ else:
+ env.Append(CCFLAGS=['-O2'])
+
+ env.Append(LINKFLAGS=['-Wl,--subsystem,windows'])
+
+ elif (env["target"] == "release_debug"):
+
+ env.Append(CCFLAGS=['-O2', '-DDEBUG_ENABLED'])
+
+ elif (env["target"] == "debug"):
+
+ env.Append(CCFLAGS=['-g', '-Wall', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
+
+ env["CC"] = mingw_prefix + "gcc"
+ env['AS'] = mingw_prefix + "as"
+ env['CXX'] = mingw_prefix + "g++"
+ env['AR'] = mingw_prefix + "ar"
+ env['RANLIB'] = mingw_prefix + "ranlib"
+ env['LD'] = mingw_prefix + "g++"
+ env["x86_libtheora_opt_gcc"] = True
+
+ #env['CC'] = "winegcc"
+ #env['CXX'] = "wineg++"
+
+ env.Append(CCFLAGS=['-DWINDOWS_ENABLED', '-mwindows'])
+ env.Append(CPPFLAGS=['-DRTAUDIO_ENABLED'])
+ env.Append(CCFLAGS=['-DOPENGL_ENABLED'])
+ env.Append(LIBS=['mingw32', 'opengl32', 'dsound', 'ole32', 'd3d9', 'winmm', 'gdi32', 'iphlpapi', 'shlwapi', 'wsock32', 'ws2_32', 'kernel32', 'oleaut32', 'dinput8', 'dxguid'])
+
+ # if (env["bits"]=="32"):
+ # env.Append(LIBS=['gcc_s'])
+ # #--with-arch=i686
+ # env.Append(CPPFLAGS=['-march=i686'])
+ # env.Append(LINKFLAGS=['-march=i686'])
+
+ #'d3dx9d'
+ env.Append(CPPFLAGS=['-DMINGW_ENABLED'])
+ # env.Append(LINKFLAGS=['-g'])
+
+ # resrc
+ env['is_mingw'] = True
+ env.Append(BUILDERS={'RES': env.Builder(action=build_res_file, suffix='.o', src_suffix='.rc')})
+
+ 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={'HLSL9': env.Builder(action=methods.build_hlsl_dx9_headers, suffix='hlsl.h', src_suffix='.hlsl')})
+ env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.h', src_suffix='.glsl')})
diff --git a/platform/windows/export/export.cpp b/platform/windows/export/export.cpp
index 9bf9ba93fe..1ad61844d0 100644
--- a/platform/windows/export/export.cpp
+++ b/platform/windows/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 */
diff --git a/platform/windows/export/export.h b/platform/windows/export/export.h
index aa3578fb98..b437efc48e 100644
--- a/platform/windows/export/export.h
+++ b/platform/windows/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/windows/godot_win.cpp b/platform/windows/godot_win.cpp
index c89d02bb05..5260f7f641 100644
--- a/platform/windows/godot_win.cpp
+++ b/platform/windows/godot_win.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/windows/joystick.cpp b/platform/windows/joypad.cpp
index e69bfe6a52..f2848268fc 100644
--- a/platform/windows/joystick.cpp
+++ b/platform/windows/joypad.cpp
@@ -1,11 +1,11 @@
/*************************************************************************/
-/* joystick.cpp */
+/* joypad.cpp */
/*************************************************************************/
/* This file is part of: */
/* 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 */
@@ -26,8 +26,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-//author: Andreas Haas <hondres, liugam3@gmail.com>
-#include "joystick.h"
+#include "joypad.h"
#include <iostream>
#include <wbemidl.h>
#include <oleauto.h>
@@ -39,15 +38,15 @@
DWORD WINAPI _xinput_get_state(DWORD dwUserIndex, XINPUT_STATE* pState) { return ERROR_DEVICE_NOT_CONNECTED; }
DWORD WINAPI _xinput_set_state(DWORD dwUserIndex, XINPUT_VIBRATION* pVibration) { return ERROR_DEVICE_NOT_CONNECTED; }
-joystick_windows::joystick_windows() {
+JoypadWindows::JoypadWindows() {
}
-joystick_windows::joystick_windows(InputDefault* _input, HWND* hwnd) {
+JoypadWindows::JoypadWindows(InputDefault* _input, HWND* hwnd) {
input = _input;
hWnd = hwnd;
- joystick_count = 0;
+ joypad_count = 0;
dinput = NULL;
xinput_dll = NULL;
xinput_get_state = NULL;
@@ -55,8 +54,8 @@ joystick_windows::joystick_windows(InputDefault* _input, HWND* hwnd) {
load_xinput();
- for (int i = 0; i < JOYSTICKS_MAX; i++)
- attached_joysticks[i] = false;
+ for (int i = 0; i < JOYPADS_MAX; i++)
+ attached_joypads[i] = false;
HRESULT result;
@@ -64,35 +63,35 @@ joystick_windows::joystick_windows(InputDefault* _input, HWND* hwnd) {
if (FAILED(result)) {
printf("failed init DINPUT: %ld\n", result);
}
- probe_joysticks();
+ probe_joypads();
}
-joystick_windows::~joystick_windows() {
+JoypadWindows::~JoypadWindows() {
- close_joystick();
+ close_joypad();
dinput->Release();
unload_xinput();
}
-bool joystick_windows::have_device(const GUID &p_guid) {
+bool JoypadWindows::have_device(const GUID &p_guid) {
- for (int i = 0; i < JOYSTICKS_MAX; i++) {
+ for (int i = 0; i < JOYPADS_MAX; i++) {
- if (d_joysticks[i].guid == p_guid) {
+ if (d_joypads[i].guid == p_guid) {
- d_joysticks[i].confirmed = true;
+ d_joypads[i].confirmed = true;
return true;
}
}
return false;
}
-int joystick_windows::check_free_joy_slot() const {
+int JoypadWindows::check_free_joy_slot() const {
- for (int i = 0; i < JOYSTICKS_MAX; i++) {
+ for (int i = 0; i < JOYPADS_MAX; i++) {
- if (!attached_joysticks[i])
+ if (!attached_joypads[i])
return i;
}
return -1;
@@ -100,7 +99,7 @@ int joystick_windows::check_free_joy_slot() const {
// adapted from SDL2, works a lot better than the MSDN version
-bool joystick_windows::is_xinput_device(const GUID *p_guid) {
+bool JoypadWindows::is_xinput_device(const GUID *p_guid) {
static GUID IID_ValveStreamingGamepad = { MAKELONG(0x28DE, 0x11FF), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } };
static GUID IID_X360WiredGamepad = { MAKELONG(0x045E, 0x02A1), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } };
@@ -144,7 +143,7 @@ bool joystick_windows::is_xinput_device(const GUID *p_guid) {
return false;
}
-bool joystick_windows::setup_dinput_joystick(const DIDEVICEINSTANCE* instance) {
+bool JoypadWindows::setup_dinput_joypad(const DIDEVICEINSTANCE* instance) {
HRESULT hr;
int num = check_free_joy_slot();
@@ -152,8 +151,8 @@ bool joystick_windows::setup_dinput_joystick(const DIDEVICEINSTANCE* instance) {
if (have_device(instance->guidInstance) || num == -1)
return false;
- d_joysticks[joystick_count] = dinput_gamepad();
- dinput_gamepad* joy = &d_joysticks[joystick_count];
+ d_joypads[joypad_count] = dinput_gamepad();
+ dinput_gamepad* joy = &d_joypads[joypad_count];
const DWORD devtype = (instance->dwDevType & 0xFF);
@@ -177,7 +176,7 @@ bool joystick_windows::setup_dinput_joystick(const DIDEVICEINSTANCE* instance) {
guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],
guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
- id_to_change = joystick_count;
+ id_to_change = joypad_count;
joy->di_joy->SetDataFormat(&c_dfDIJoystick2);
joy->di_joy->SetCooperativeLevel(*hWnd, DISCL_FOREGROUND);
@@ -188,13 +187,13 @@ bool joystick_windows::setup_dinput_joystick(const DIDEVICEINSTANCE* instance) {
input->joy_connection_changed(num, true, instance->tszProductName, uid);
joy->attached = true;
joy->id = num;
- attached_joysticks[num] = true;
+ attached_joypads[num] = true;
joy->confirmed = true;
- joystick_count++;
+ joypad_count++;
return true;
}
-void joystick_windows::setup_joystick_object(const DIDEVICEOBJECTINSTANCE *ob, int p_joy_id) {
+void JoypadWindows::setup_joypad_object(const DIDEVICEOBJECTINSTANCE *ob, int p_joy_id) {
if (ob->dwType & DIDFT_AXIS) {
@@ -225,7 +224,7 @@ void joystick_windows::setup_joystick_object(const DIDEVICEOBJECTINSTANCE *ob, i
prop_range.lMin = -MAX_JOY_AXIS;
prop_range.lMax = +MAX_JOY_AXIS;
- dinput_gamepad &joy = d_joysticks[p_joy_id];
+ dinput_gamepad &joy = d_joypads[p_joy_id];
res = IDirectInputDevice8_SetProperty(joy.di_joy, DIPROP_RANGE, &prop_range.diph);
@@ -246,100 +245,100 @@ void joystick_windows::setup_joystick_object(const DIDEVICEOBJECTINSTANCE *ob, i
}
}
-BOOL CALLBACK joystick_windows::enumCallback(const DIDEVICEINSTANCE* instance, void* pContext) {
+BOOL CALLBACK JoypadWindows::enumCallback(const DIDEVICEINSTANCE* instance, void* pContext) {
- joystick_windows* self = (joystick_windows*)pContext;
- if (self->is_xinput_device(&instance->guidProduct)) {;
+ JoypadWindows* self = (JoypadWindows*)pContext;
+ if (self->is_xinput_device(&instance->guidProduct)) {
return DIENUM_CONTINUE;
}
- self->setup_dinput_joystick(instance);
+ self->setup_dinput_joypad(instance);
return DIENUM_CONTINUE;
}
-BOOL CALLBACK joystick_windows::objectsCallback(const DIDEVICEOBJECTINSTANCE *instance, void *context) {
+BOOL CALLBACK JoypadWindows::objectsCallback(const DIDEVICEOBJECTINSTANCE *instance, void *context) {
- joystick_windows* self = (joystick_windows*)context;
- self->setup_joystick_object(instance, self->id_to_change);
+ JoypadWindows* self = (JoypadWindows*)context;
+ self->setup_joypad_object(instance, self->id_to_change);
return DIENUM_CONTINUE;
}
-void joystick_windows::close_joystick(int id) {
+void JoypadWindows::close_joypad(int id) {
if (id == -1) {
- for (int i = 0; i < JOYSTICKS_MAX; i++) {
+ for (int i = 0; i < JOYPADS_MAX; i++) {
- close_joystick(i);
+ close_joypad(i);
}
return;
}
- if (!d_joysticks[id].attached) return;
+ if (!d_joypads[id].attached) return;
- d_joysticks[id].di_joy->Unacquire();
- d_joysticks[id].di_joy->Release();
- d_joysticks[id].attached = false;
- attached_joysticks[d_joysticks[id].id] = false;
- d_joysticks[id].guid.Data1 = d_joysticks[id].guid.Data2 = d_joysticks[id].guid.Data3 = 0;
- input->joy_connection_changed(d_joysticks[id].id, false, "");
- joystick_count--;
+ d_joypads[id].di_joy->Unacquire();
+ d_joypads[id].di_joy->Release();
+ d_joypads[id].attached = false;
+ attached_joypads[d_joypads[id].id] = false;
+ d_joypads[id].guid.Data1 = d_joypads[id].guid.Data2 = d_joypads[id].guid.Data3 = 0;
+ input->joy_connection_changed(d_joypads[id].id, false, "");
+ joypad_count--;
}
-void joystick_windows::probe_joysticks() {
+void JoypadWindows::probe_joypads() {
DWORD dwResult;
for (DWORD i = 0; i < XUSER_MAX_COUNT; i++) {
- ZeroMemory(&x_joysticks[i].state, sizeof(XINPUT_STATE));
+ ZeroMemory(&x_joypads[i].state, sizeof(XINPUT_STATE));
- dwResult = xinput_get_state(i, &x_joysticks[i].state);
+ dwResult = xinput_get_state(i, &x_joypads[i].state);
if ( dwResult == ERROR_SUCCESS) {
int id = check_free_joy_slot();
- if (id != -1 && !x_joysticks[i].attached) {
-
- x_joysticks[i].attached = true;
- x_joysticks[i].id = id;
- x_joysticks[i].ff_timestamp = 0;
- x_joysticks[i].ff_end_timestamp = 0;
- x_joysticks[i].vibrating = false;
- attached_joysticks[id] = true;
+ if (id != -1 && !x_joypads[i].attached) {
+
+ x_joypads[i].attached = true;
+ x_joypads[i].id = id;
+ x_joypads[i].ff_timestamp = 0;
+ x_joypads[i].ff_end_timestamp = 0;
+ x_joypads[i].vibrating = false;
+ attached_joypads[id] = true;
input->joy_connection_changed(id, true, "XInput Gamepad","__XINPUT_DEVICE__");
}
}
- else if (x_joysticks[i].attached) {
+ else if (x_joypads[i].attached) {
- x_joysticks[i].attached = false;
- attached_joysticks[x_joysticks[i].id] = false;
- input->joy_connection_changed(x_joysticks[i].id, false, "");
+ x_joypads[i].attached = false;
+ attached_joypads[x_joypads[i].id] = false;
+ input->joy_connection_changed(x_joypads[i].id, false, "");
}
}
- for (int i = 0; i < joystick_count; i++) {
+ for (int i = 0; i < joypad_count; i++) {
- d_joysticks[i].confirmed = false;
+ d_joypads[i].confirmed = false;
}
dinput->EnumDevices(DI8DEVCLASS_GAMECTRL, enumCallback, this, DIEDFL_ATTACHEDONLY);
- for (int i = 0; i < joystick_count; i++) {
+ for (int i = 0; i < joypad_count; i++) {
- if (!d_joysticks[i].confirmed) {
+ if (!d_joypads[i].confirmed) {
- close_joystick(i);
+ close_joypad(i);
}
}
}
-unsigned int joystick_windows::process_joysticks(unsigned int p_last_id) {
+unsigned int JoypadWindows::process_joypads(unsigned int p_last_id) {
HRESULT hr;
for (int i = 0; i < XUSER_MAX_COUNT; i++) {
- xinput_gamepad &joy = x_joysticks[i];
+ xinput_gamepad &joy = x_joypads[i];
if (!joy.attached) {
continue;
}
@@ -368,20 +367,20 @@ unsigned int joystick_windows::process_joysticks(unsigned int p_last_id) {
Vector2 strength = input->get_joy_vibration_strength(joy.id);
float duration = input->get_joy_vibration_duration(joy.id);
if (strength.x == 0 && strength.y == 0) {
- joystick_vibration_stop_xinput(i, timestamp);
+ joypad_vibration_stop_xinput(i, timestamp);
} else {
- joystick_vibration_start_xinput(i, strength.x, strength.y, duration, timestamp);
+ joypad_vibration_start_xinput(i, strength.x, strength.y, duration, timestamp);
}
} else if (joy.vibrating && joy.ff_end_timestamp != 0) {
uint64_t current_time = OS::get_singleton()->get_ticks_usec();
if (current_time >= joy.ff_end_timestamp)
- joystick_vibration_stop_xinput(i, current_time);
+ joypad_vibration_stop_xinput(i, current_time);
}
}
- for (int i = 0; i < JOYSTICKS_MAX; i++) {
+ for (int i = 0; i < JOYPADS_MAX; i++) {
- dinput_gamepad* joy = &d_joysticks[i];
+ dinput_gamepad* joy = &d_joypads[i];
if (!joy->attached)
continue;
@@ -438,7 +437,7 @@ unsigned int joystick_windows::process_joysticks(unsigned int p_last_id) {
return p_last_id;
}
-unsigned int joystick_windows::post_hat(unsigned int p_last_id, int p_device, DWORD p_dpad) {
+unsigned int JoypadWindows::post_hat(unsigned int p_last_id, int p_device, DWORD p_dpad) {
int dpad_val = 0;
@@ -487,7 +486,7 @@ unsigned int joystick_windows::post_hat(unsigned int p_last_id, int p_device, DW
return input->joy_hat(p_last_id, p_device, dpad_val);
};
-InputDefault::JoyAxis joystick_windows::axis_correct(int p_val, bool p_xinput, bool p_trigger, bool p_negate) const {
+InputDefault::JoyAxis JoypadWindows::axis_correct(int p_val, bool p_xinput, bool p_trigger, bool p_negate) const {
InputDefault::JoyAxis jx;
if (Math::abs(p_val) < MIN_JOY_AXIS) {
@@ -519,8 +518,8 @@ InputDefault::JoyAxis joystick_windows::axis_correct(int p_val, bool p_xinput, b
return jx;
}
-void joystick_windows::joystick_vibration_start_xinput(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp) {
- xinput_gamepad &joy = x_joysticks[p_device];
+void JoypadWindows::joypad_vibration_start_xinput(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp) {
+ xinput_gamepad &joy = x_joypads[p_device];
if (joy.attached) {
XINPUT_VIBRATION effect;
effect.wLeftMotorSpeed = (65535 * p_strong_magnitude);
@@ -533,8 +532,8 @@ void joystick_windows::joystick_vibration_start_xinput(int p_device, float p_wea
}
}
-void joystick_windows::joystick_vibration_stop_xinput(int p_device, uint64_t p_timestamp) {
- xinput_gamepad &joy = x_joysticks[p_device];
+void JoypadWindows::joypad_vibration_stop_xinput(int p_device, uint64_t p_timestamp) {
+ xinput_gamepad &joy = x_joypads[p_device];
if (joy.attached) {
XINPUT_VIBRATION effect;
effect.wLeftMotorSpeed = 0;
@@ -547,7 +546,7 @@ void joystick_windows::joystick_vibration_stop_xinput(int p_device, uint64_t p_t
}
-void joystick_windows::load_xinput() {
+void JoypadWindows::load_xinput() {
xinput_get_state = &_xinput_get_state;
xinput_set_state = &_xinput_set_state;
@@ -576,7 +575,7 @@ void joystick_windows::load_xinput() {
xinput_set_state = set_func;
}
-void joystick_windows::unload_xinput() {
+void JoypadWindows::unload_xinput() {
if (xinput_dll) {
diff --git a/platform/windows/joystick.h b/platform/windows/joypad.h
index 77dee0466f..63eee8c015 100644
--- a/platform/windows/joystick.h
+++ b/platform/windows/joypad.h
@@ -1,11 +1,11 @@
/*************************************************************************/
-/* joystick.h */
+/* joypad.h */
/*************************************************************************/
/* This file is part of: */
/* 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 */
@@ -26,9 +26,8 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-//author: Andreas Haas <hondres, liugam3@gmail.com>
-#ifndef JOYSTICK_H
-#define JOYSTICK_H
+#ifndef JOYPAD_H
+#define JOYPAD_H
#include "os_windows.h"
#define DIRECTINPUT_VERSION 0x0800
@@ -48,19 +47,19 @@ if(x != NULL) \
#define XUSER_MAX_COUNT 4
#endif
-class joystick_windows
+class JoypadWindows
{
public:
- joystick_windows();
- joystick_windows(InputDefault* _input, HWND* hwnd);
- ~joystick_windows();
+ JoypadWindows();
+ JoypadWindows(InputDefault* _input, HWND* hwnd);
+ ~JoypadWindows();
- void probe_joysticks();
- unsigned int process_joysticks(unsigned int p_last_id);
+ void probe_joypads();
+ unsigned int process_joypads(unsigned int p_last_id);
private:
enum {
- JOYSTICKS_MAX = 16,
+ JOYPADS_MAX = 16,
JOY_AXIS_COUNT = 6,
MIN_JOY_AXIS = 10,
MAX_JOY_AXIS = 32768,
@@ -120,16 +119,16 @@ private:
InputDefault* input;
int id_to_change;
- int joystick_count;
- bool attached_joysticks[JOYSTICKS_MAX];
- dinput_gamepad d_joysticks[JOYSTICKS_MAX];
- xinput_gamepad x_joysticks[XUSER_MAX_COUNT];
+ int joypad_count;
+ bool attached_joypads[JOYPADS_MAX];
+ dinput_gamepad d_joypads[JOYPADS_MAX];
+ xinput_gamepad x_joypads[XUSER_MAX_COUNT];
static BOOL CALLBACK enumCallback(const DIDEVICEINSTANCE* p_instance, void* p_context);
static BOOL CALLBACK objectsCallback(const DIDEVICEOBJECTINSTANCE* instance, void* context);
- void setup_joystick_object(const DIDEVICEOBJECTINSTANCE* ob, int p_joy_id);
- void close_joystick(int id = -1);
+ void setup_joypad_object(const DIDEVICEOBJECTINSTANCE* ob, int p_joy_id);
+ void close_joypad(int id = -1);
void load_xinput();
void unload_xinput();
@@ -138,9 +137,9 @@ private:
bool have_device(const GUID &p_guid);
bool is_xinput_device(const GUID* p_guid);
- bool setup_dinput_joystick(const DIDEVICEINSTANCE* instance);
- void joystick_vibration_start_xinput(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp);
- void joystick_vibration_stop_xinput(int p_device, uint64_t p_timestamp);
+ bool setup_dinput_joypad(const DIDEVICEINSTANCE* instance);
+ void joypad_vibration_start_xinput(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp);
+ void joypad_vibration_stop_xinput(int p_device, uint64_t p_timestamp);
InputDefault::JoyAxis axis_correct(int p_val, bool p_xinput = false, bool p_trigger = false, bool p_negate = false) const;
XInputGetState_t xinput_get_state;
diff --git a/platform/windows/key_mapping_win.cpp b/platform/windows/key_mapping_win.cpp
index 23fa29d68f..9ab222e9ee 100644
--- a/platform/windows/key_mapping_win.cpp
+++ b/platform/windows/key_mapping_win.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 */
@@ -26,8 +26,8 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#define WINVER 0x0500
#include "key_mapping_win.h"
+
#include <stdio.h>
struct _WinTranslatePair {
diff --git a/platform/windows/key_mapping_win.h b/platform/windows/key_mapping_win.h
index da649d0115..2f1b36d9f2 100644
--- a/platform/windows/key_mapping_win.h
+++ b/platform/windows/key_mapping_win.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/windows/lang_table.h b/platform/windows/lang_table.h
index c9551b2d38..bacbf89e85 100644
--- a/platform/windows/lang_table.h
+++ b/platform/windows/lang_table.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/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 286f5fb0b7..d1d769adf7 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.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 */
@@ -26,33 +26,29 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "drivers/gles2/rasterizer_gles2.h"
#include "os_windows.h"
-#include "drivers/unix/memory_pool_static_malloc.h"
-#include "os/memory_pool_dynamic_static.h"
+
+#include "drivers/gles3/rasterizer_gles3.h"
#include "drivers/windows/thread_windows.h"
#include "drivers/windows/semaphore_windows.h"
#include "drivers/windows/mutex_windows.h"
-#include "main/main.h"
+#include "drivers/windows/rw_lock_windows.h"
#include "drivers/windows/file_access_windows.h"
#include "drivers/windows/dir_access_windows.h"
-
-
#include "servers/visual/visual_server_raster.h"
-#include "servers/audio/audio_server_sw.h"
-#include "servers/visual/visual_server_wrap_mt.h"
-
+#include "servers/audio_server.h"
+//#include "servers/visual/visual_server_wrap_mt.h"
+#include "main/main.h"
#include "tcp_server_winsock.h"
#include "packet_peer_udp_winsock.h"
#include "stream_peer_winsock.h"
#include "lang_table.h"
-#include "os/memory_pool_dynamic_prealloc.h"
#include "globals.h"
#include "io/marshalls.h"
-#include "joystick.h"
+#include "joypad.h"
-#include "shlobj.h"
+#include <shlobj.h>
#include <regstr.h>
#include <process.h>
@@ -157,17 +153,15 @@ OS::VideoMode OS_Windows::get_default_video_mode() const {
int OS_Windows::get_audio_driver_count() const {
- return AudioDriverManagerSW::get_driver_count();
+ return AudioDriverManager::get_driver_count();
}
const char * OS_Windows::get_audio_driver_name(int p_driver) const {
- AudioDriverSW* driver = AudioDriverManagerSW::get_driver(p_driver);
+ AudioDriver* driver = AudioDriverManager::get_driver(p_driver);
ERR_FAIL_COND_V( !driver, "" );
- return AudioDriverManagerSW::get_driver(p_driver)->get_name();
+ return AudioDriverManager::get_driver(p_driver)->get_name();
}
-static MemoryPoolStatic *mempool_static=NULL;
-static MemoryPoolDynamic *mempool_dynamic=NULL;
void OS_Windows::initialize_core() {
@@ -182,6 +176,7 @@ void OS_Windows::initialize_core() {
ThreadWindows::make_default();
SemaphoreWindows::make_default();
MutexWindows::make_default();
+ RWLockWindows::make_default();
FileAccess::make_default<FileAccessWindows>(FileAccess::ACCESS_RESOURCES);
FileAccess::make_default<FileAccessWindows>(FileAccess::ACCESS_USERDATA);
@@ -195,15 +190,6 @@ void OS_Windows::initialize_core() {
StreamPeerWinsock::make_default();
PacketPeerUDPWinsock::make_default();
- mempool_static = new MemoryPoolStaticMalloc;
-#if 1
- mempool_dynamic = memnew( MemoryPoolDynamicStatic );
-#else
-#define DYNPOOL_SIZE 4*1024*1024
- void * buffer = malloc( DYNPOOL_SIZE );
- mempool_dynamic = memnew( MemoryPoolDynamicPrealloc(buffer,DYNPOOL_SIZE) );
-
-#endif
// We need to know how often the clock is updated
if( !QueryPerformanceFrequency((LARGE_INTEGER *)&ticks_per_second) )
@@ -410,8 +396,8 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) {
}
input->set_mouse_pos(Point2(mm.x,mm.y));
- mm.speed_x=input->get_mouse_speed().x;
- mm.speed_y=input->get_mouse_speed().y;
+ mm.speed_x=input->get_last_mouse_speed().x;
+ mm.speed_y=input->get_last_mouse_speed().y;
if (old_invalid) {
@@ -644,8 +630,10 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) {
gr_mem=alt_mem;
}
- //if (wParam==VK_WIN) TODO wtf is this?
- // meta_mem=uMsg==WM_KEYDOWN;
+ /*
+ if (wParam==VK_WIN) TODO wtf is this?
+ meta_mem=uMsg==WM_KEYDOWN;
+ */
} //fallthrough
@@ -686,7 +674,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) {
print_line("input lang change");
} break;
- #if WINVER >= 0x0700 // for windows 7
+ #if WINVER >= 0x0601 // for windows 7
case WM_TOUCH: {
BOOL bHandled = FALSE;
@@ -723,7 +711,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) {
#endif
case WM_DEVICECHANGE: {
- joystick->probe_joysticks();
+ joypad->probe_joypads();
} break;
case WM_SETCURSOR: {
@@ -1078,23 +1066,28 @@ void OS_Windows::initialize(const VideoMode& p_desired,int p_video_driver,int p_
};
-#if defined(OPENGL_ENABLED) || defined(GLES2_ENABLED) || defined(LEGACYGL_ENABLED)
- gl_context = memnew( ContextGL_Win(hWnd,false) );
+#if defined(OPENGL_ENABLED)
+ gl_context = memnew( ContextGL_Win(hWnd,true) );
gl_context->initialize();
- rasterizer = memnew( RasterizerGLES2 );
+
+ RasterizerGLES3::register_config();
+
+ RasterizerGLES3::make_current();
#else
- #ifdef DX9_ENABLED
+ // FIXME: Does DX support still work now that rasterizer is no longer used?
+#ifdef DX9_ENABLED
rasterizer = memnew( RasterizerDX9(hWnd) );
- #endif
+#endif
#endif
- visual_server = memnew( VisualServerRaster(rasterizer) );
+ visual_server = memnew( VisualServerRaster );
+ // FIXME: Reimplement threaded rendering? Or remove?
+ /*
if (get_render_thread_mode()!=RENDER_THREAD_UNSAFE) {
-
visual_server =memnew(VisualServerWrapMT(visual_server,get_render_thread_mode()==RENDER_SEPARATE_THREAD));
}
+ */
- //
physics_server = memnew( PhysicsServerSW );
physics_server->init();
@@ -1124,25 +1117,15 @@ void OS_Windows::initialize(const VideoMode& p_desired,int p_video_driver,int p_
visual_server->init();
input = memnew( InputDefault );
- joystick = memnew (joystick_windows(input, &hWnd));
+ joypad = memnew (JoypadWindows(input, &hWnd));
- AudioDriverManagerSW::get_driver(p_audio_driver)->set_singleton();
+ AudioDriverManager::get_driver(p_audio_driver)->set_singleton();
- if (AudioDriverManagerSW::get_driver(p_audio_driver)->init()!=OK) {
+ if (AudioDriverManager::get_driver(p_audio_driver)->init()!=OK) {
ERR_PRINT("Initializing audio failed.");
}
- sample_manager = memnew( SampleManagerMallocSW );
- audio_server = memnew( AudioServerSW(sample_manager) );
-
- audio_server->init();
-
- spatial_sound_server = memnew( SpatialSoundServerSW );
- spatial_sound_server->init();
- spatial_sound_2d_server = memnew( SpatialSound2DServerSW );
- spatial_sound_2d_server->init();
-
TRACKMOUSEEVENT tme;
tme.cbSize=sizeof(TRACKMOUSEEVENT);
tme.dwFlags=TME_LEAVE;
@@ -1257,7 +1240,7 @@ void OS_Windows::finalize() {
main_loop=NULL;
- memdelete(joystick);
+ memdelete(joypad);
memdelete(input);
visual_server->finish();
@@ -1273,19 +1256,11 @@ void OS_Windows::finalize() {
SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)user_proc);
};
- spatial_sound_server->finish();
- memdelete(spatial_sound_server);
- spatial_sound_2d_server->finish();
- memdelete(spatial_sound_2d_server);
-
- //if (debugger_connection_console) {
-// memdelete(debugger_connection_console);
-//}
-
- memdelete(sample_manager);
-
- audio_server->finish();
- memdelete(audio_server);
+ /*
+ if (debugger_connection_console) {
+ memdelete(debugger_connection_console);
+ }
+ */
physics_server->finish();
memdelete(physics_server);
@@ -1300,10 +1275,6 @@ void OS_Windows::finalize_core() {
memdelete(process_map);
- if (mempool_dynamic)
- memdelete( mempool_dynamic );
- delete mempool_static;
-
TCPServerWinsock::cleanup();
StreamPeerWinsock::cleanup();
@@ -1330,9 +1301,9 @@ void OS_Windows::vprint(const char* p_format, va_list p_list, bool p_stderr) {
wbuf[wlen]=0;
if (p_stderr)
- fwprintf(stderr,L"%s",wbuf);
+ fwprintf(stderr, L"%ls", wbuf);
else
- wprintf(L"%s",wbuf);
+ wprintf(L"%ls", wbuf);
#ifdef STDOUT_FILE
//vwfprintf(stdo,p_format,p_list);
@@ -1608,7 +1579,7 @@ void OS_Windows::set_window_fullscreen(bool p_enabled){
*/
}
-// MoveWindow(hWnd,r.left,r.top,p_size.x,p_size.y,TRUE);
+ //MoveWindow(hWnd,r.left,r.top,p_size.x,p_size.y,TRUE);
}
@@ -1729,6 +1700,10 @@ void OS_Windows::print_error(const char* p_function, const char* p_file, int p_l
print("SCRIPT ERROR: %s: %s\n", p_function, err_details);
print(" At: %s:%i\n", p_file, p_line);
break;
+ case ERR_SHADER:
+ print("SHADER ERROR: %s: %s\n", p_function, err_details);
+ print(" At: %s:%i\n", p_file, p_line);
+ break;
}
} else {
@@ -1744,6 +1719,7 @@ void OS_Windows::print_error(const char* p_function, const char* p_file, int p_l
case ERR_ERROR: basecol = FOREGROUND_RED; break;
case ERR_WARNING: basecol = FOREGROUND_RED | FOREGROUND_GREEN; break;
case ERR_SCRIPT: basecol = FOREGROUND_RED | FOREGROUND_BLUE; break;
+ case ERR_SHADER: basecol = FOREGROUND_GREEN | FOREGROUND_BLUE; break;
}
basecol |= current_bg;
@@ -1755,6 +1731,7 @@ void OS_Windows::print_error(const char* p_function, const char* p_file, int p_l
case ERR_ERROR: print("ERROR: "); break;
case ERR_WARNING: print("WARNING: "); break;
case ERR_SCRIPT: print("SCRIPT ERROR: "); break;
+ case ERR_SHADER: print("SHADER ERROR: "); break;
}
SetConsoleTextAttribute(hCon, current_fg | current_bg | FOREGROUND_INTENSITY);
@@ -1765,6 +1742,7 @@ void OS_Windows::print_error(const char* p_function, const char* p_file, int p_l
case ERR_ERROR: print(" At: "); break;
case ERR_WARNING: print(" At: "); break;
case ERR_SCRIPT: print(" At: "); break;
+ case ERR_SHADER: print(" At: "); break;
}
SetConsoleTextAttribute(hCon, current_fg | current_bg);
@@ -1777,6 +1755,7 @@ void OS_Windows::print_error(const char* p_function, const char* p_file, int p_l
case ERR_ERROR: print("ERROR: %s: ", p_function); break;
case ERR_WARNING: print("WARNING: %s: ", p_function); break;
case ERR_SCRIPT: print("SCRIPT ERROR: %s: ", p_function); break;
+ case ERR_SHADER: print("SCRIPT ERROR: %s: ", p_function); break;
}
SetConsoleTextAttribute(hCon, current_fg | current_bg | FOREGROUND_INTENSITY);
@@ -1787,6 +1766,7 @@ void OS_Windows::print_error(const char* p_function, const char* p_file, int p_l
case ERR_ERROR: print(" At: "); break;
case ERR_WARNING: print(" At: "); break;
case ERR_SCRIPT: print(" At: "); break;
+ case ERR_SHADER: print(" At: "); break;
}
SetConsoleTextAttribute(hCon, current_fg | current_bg);
@@ -1919,7 +1899,7 @@ void OS_Windows::process_events() {
MSG msg;
- last_id = joystick->process_joysticks(last_id);
+ last_id = joypad->process_joypads(last_id);
while(PeekMessageW(&msg,NULL,0,0,PM_REMOVE)) {
@@ -1977,7 +1957,7 @@ Error OS_Windows::execute(const String& p_path, const List<String>& p_arguments,
argss+=String(" \"")+p_arguments[i]+"\"";
}
-// print_line("ARGS: "+argss);
+ //print_line("ARGS: "+argss);
//argss+"\"";
//argss+=" 2>nul";
@@ -2083,8 +2063,8 @@ void OS_Windows::set_icon(const Image& p_icon) {
Image icon=p_icon;
- if (icon.get_format()!=Image::FORMAT_RGBA)
- icon.convert(Image::FORMAT_RGBA);
+ if (icon.get_format()!=Image::FORMAT_RGBA8)
+ icon.convert(Image::FORMAT_RGBA8);
int w = icon.get_width();
int h = icon.get_height();
@@ -2107,7 +2087,7 @@ void OS_Windows::set_icon(const Image& p_icon) {
encode_uint32(0,&icon_bmp[36]);
uint8_t *wr=&icon_bmp[40];
- DVector<uint8_t>::Read r= icon.get_data().read();
+ PoolVector<uint8_t>::Read r= icon.get_data().read();
for(int i=0;i<h;i++) {
@@ -2361,7 +2341,7 @@ String OS_Windows::get_data_dir() const {
if (has_environment("APPDATA")) {
- bool use_godot = Globals::get_singleton()->get("application/use_shared_user_dir");
+ bool use_godot = GlobalConfig::get_singleton()->get("application/use_shared_user_dir");
if (!use_godot)
return (OS::get_singleton()->get_environment("APPDATA")+"/"+an).replace("\\","/");
else
@@ -2369,7 +2349,7 @@ String OS_Windows::get_data_dir() const {
}
}
- return Globals::get_singleton()->get_resource_path();
+ return GlobalConfig::get_singleton()->get_resource_path();
}
@@ -2388,7 +2368,7 @@ void OS_Windows::set_use_vsync(bool p_enable) {
gl_context->set_use_vsync(p_enable);
}
-bool OS_Windows::is_vsnc_enabled() const{
+bool OS_Windows::is_vsync_enabled() const{
if (gl_context)
return gl_context->is_using_vsync();
@@ -2419,10 +2399,10 @@ OS_Windows::OS_Windows(HINSTANCE _hInstance) {
user_proc = NULL;
#ifdef RTAUDIO_ENABLED
- AudioDriverManagerSW::add_driver(&driver_rtaudio);
+ AudioDriverManager::add_driver(&driver_rtaudio);
#endif
#ifdef XAUDIO2_ENABLED
- AudioDriverManagerSW::add_driver(&driver_xaudio2);
+ AudioDriverManager::add_driver(&driver_xaudio2);
#endif
}
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index 903dd10c70..a5c8ecbe1b 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.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 */
@@ -29,41 +29,34 @@
#ifndef OS_WINDOWS_H
#define OS_WINDOWS_H
-#define WINVER 0x0600
-
#include "os/input.h"
#include "os/os.h"
#include "context_gl_win.h"
#include "servers/visual_server.h"
#include "servers/visual/rasterizer.h"
#include "servers/physics/physics_server_sw.h"
-
-#include "servers/audio/audio_server_sw.h"
-#include "servers/audio/sample_manager_sw.h"
+#include "servers/audio_server.h"
#include "drivers/rtaudio/audio_driver_rtaudio.h"
#ifdef XAUDIO2_ENABLED
#include "drivers/xaudio2/audio_driver_xaudio2.h"
#endif
-#include "servers/spatial_sound/spatial_sound_server_sw.h"
-#include "servers/spatial_sound_2d/spatial_sound_2d_server_sw.h"
#include "drivers/unix/ip_unix.h"
#include "servers/physics_2d/physics_2d_server_sw.h"
#include "servers/physics_2d/physics_2d_server_wrap_mt.h"
-
#include "main/input_default.h"
+#include "key_mapping_win.h"
-#include <windows.h>
-#include "key_mapping_win.h"
+#include <windows.h>
#include <windowsx.h>
#include <io.h>
-
#include <fcntl.h>
#include <stdio.h>
+
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
-class joystick_windows;
+class JoypadWindows;
class OS_Windows : public OS {
enum {
@@ -95,7 +88,7 @@ class OS_Windows : public OS {
int old_x,old_y;
Point2i center;
unsigned int last_id;
-#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED) || defined(GLES2_ENABLED)
+#if defined(OPENGL_ENABLED)
ContextGL_Win *gl_context;
#endif
VisualServer *visual_server;
@@ -118,11 +111,6 @@ class OS_Windows : public OS {
WNDPROC user_proc;
- AudioServerSW *audio_server;
- SampleManagerMallocSW *sample_manager;
- SpatialSoundServerSW *spatial_sound_server;
- SpatialSound2DServerSW *spatial_sound_2d_server;
-
MouseMode mouse_mode;
bool alt_mem;
bool gr_mem;
@@ -135,7 +123,7 @@ class OS_Windows : public OS {
CursorShape cursor_shape;
InputDefault *input;
- joystick_windows *joystick;
+ JoypadWindows *joypad;
#ifdef RTAUDIO_ENABLED
AudioDriverRtAudio driver_rtaudio;
@@ -295,7 +283,7 @@ public:
virtual String get_joy_guid(int p_device) const;
virtual void set_use_vsync(bool p_enable);
- virtual bool is_vsnc_enabled() const;
+ virtual bool is_vsync_enabled() const;
OS_Windows(HINSTANCE _hInstance);
~OS_Windows();
diff --git a/platform/windows/packet_peer_udp_winsock.cpp b/platform/windows/packet_peer_udp_winsock.cpp
index 73c6116aa3..5baa01c289 100644
--- a/platform/windows/packet_peer_udp_winsock.cpp
+++ b/platform/windows/packet_peer_udp_winsock.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 */
@@ -53,12 +53,14 @@ Error PacketPeerUDPWinsock::get_packet(const uint8_t **r_buffer,int &r_buffer_si
uint32_t size;
uint8_t type;
rb.read(&type, 1, true);
- if (type == IP_Address::TYPE_IPV4) {
- rb.read((uint8_t*)&packet_ip.field8,4,true);
- packet_ip.type = IP_Address::TYPE_IPV4;
+ if (type == IP::TYPE_IPV4) {
+ uint8_t ip[4];
+ rb.read(ip,4,true);
+ packet_ip.set_ipv4(ip);
} else {
- rb.read((uint8_t*)&packet_ip.field8,16,true);
- packet_ip.type = IP_Address::TYPE_IPV6;
+ uint8_t ip[16];
+ rb.read(ip,16,true);
+ packet_ip.set_ipv6(ip);
};
rb.read((uint8_t*)&packet_port,4,true);
rb.read((uint8_t*)&size,4,true);
@@ -71,10 +73,10 @@ Error PacketPeerUDPWinsock::get_packet(const uint8_t **r_buffer,int &r_buffer_si
}
Error PacketPeerUDPWinsock::put_packet(const uint8_t *p_buffer,int p_buffer_size){
- int sock = _get_socket(peer_addr.type);
+ int sock = _get_socket();
ERR_FAIL_COND_V( sock == -1, FAILED );
struct sockaddr_storage addr;
- size_t addr_size = _set_sockaddr(&addr, peer_addr, peer_port);
+ size_t addr_size = _set_sockaddr(&addr, peer_addr, peer_port, ip_type);
_set_blocking(true);
@@ -112,23 +114,15 @@ void PacketPeerUDPWinsock::_set_blocking(bool p_blocking) {
};
}
-Error PacketPeerUDPWinsock::listen(int p_port, IP_Address::AddrType p_type, int p_recv_buffer_size) {
+Error PacketPeerUDPWinsock::listen(int p_port, int p_recv_buffer_size) {
close();
- int sock = _get_socket(p_type);
+ int sock = _get_socket();
if (sock == -1 )
return ERR_CANT_CREATE;
- if(p_type == IP_Address::TYPE_IPV6) {
- // Use IPv6 only socket
- int yes = 1;
- if(setsockopt(sockfd, IPPROTO_IPV6, IPV6_V6ONLY, (const char*)&yes, sizeof(yes)) != 0) {
- WARN_PRINT("Unable to unset IPv4 address mapping over IPv6");
- }
- }
-
struct sockaddr_storage addr = {0};
- size_t addr_size = _set_listen_sockaddr(&addr, p_port, p_type, NULL);
+ size_t addr_size = _set_listen_sockaddr(&addr, p_port, ip_type, NULL);
if (bind(sock, (struct sockaddr*)&addr, addr_size) == -1 ) {
close();
@@ -170,7 +164,7 @@ Error PacketPeerUDPWinsock::_poll(bool p_wait) {
uint32_t port = 0;
if (from.ss_family == AF_INET) {
- uint8_t type = (uint8_t)IP_Address::TYPE_IPV4;
+ uint8_t type = (uint8_t)IP::TYPE_IPV4;
rb.write(&type, 1);
struct sockaddr_in* sin_from = (struct sockaddr_in*)&from;
rb.write((uint8_t*)&sin_from->sin_addr, 4);
@@ -178,7 +172,7 @@ Error PacketPeerUDPWinsock::_poll(bool p_wait) {
} else if (from.ss_family == AF_INET6) {
- uint8_t type = (uint8_t)IP_Address::TYPE_IPV6;
+ uint8_t type = (uint8_t)IP::TYPE_IPV6;
rb.write(&type, 1);
struct sockaddr_in6* s6_from = (struct sockaddr_in6*)&from;
@@ -188,7 +182,7 @@ Error PacketPeerUDPWinsock::_poll(bool p_wait) {
} else {
// WARN_PRINT("Ignoring packet with unknown address family");
- uint8_t type = (uint8_t)IP_Address::TYPE_NONE;
+ uint8_t type = (uint8_t)IP::TYPE_NONE;
rb.write(&type, 1);
};
@@ -242,18 +236,18 @@ int PacketPeerUDPWinsock::get_packet_port() const{
return packet_port;
}
-int PacketPeerUDPWinsock::_get_socket(IP_Address::AddrType p_type) {
+int PacketPeerUDPWinsock::_get_socket() {
if (sockfd != -1)
return sockfd;
- sockfd = _socket_create(p_type, SOCK_DGRAM, IPPROTO_UDP);
+ sockfd = _socket_create(ip_type, SOCK_DGRAM, IPPROTO_UDP);
return sockfd;
}
-void PacketPeerUDPWinsock::set_send_address(const IP_Address& p_address,int p_port) {
+void PacketPeerUDPWinsock::set_dest_address(const IP_Address& p_address,int p_port) {
peer_addr=p_address;
peer_port=p_port;
@@ -277,6 +271,7 @@ PacketPeerUDPWinsock::PacketPeerUDPWinsock() {
packet_port=0;
queue_count=0;
peer_port=0;
+ ip_type = IP::TYPE_ANY;
}
PacketPeerUDPWinsock::~PacketPeerUDPWinsock() {
diff --git a/platform/windows/packet_peer_udp_winsock.h b/platform/windows/packet_peer_udp_winsock.h
index 9837ef6621..18e6bd8f3d 100644
--- a/platform/windows/packet_peer_udp_winsock.h
+++ b/platform/windows/packet_peer_udp_winsock.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 */
@@ -50,7 +50,7 @@ class PacketPeerUDPWinsock : public PacketPeerUDP {
IP_Address peer_addr;
int peer_port;
- _FORCE_INLINE_ int _get_socket(IP_Address::AddrType p_type);
+ _FORCE_INLINE_ int _get_socket();
static PacketPeerUDP* _create();
@@ -67,7 +67,7 @@ public:
virtual int get_max_packet_size() const;
- virtual Error listen(int p_port, IP_Address::AddrType p_address_type, int p_recv_buffer_size=65536);
+ virtual Error listen(int p_port, int p_recv_buffer_size=65536);
virtual void close();
virtual Error wait();
virtual bool is_listening() const;
@@ -75,7 +75,7 @@ public:
virtual IP_Address get_packet_address() const;
virtual int get_packet_port() const;
- virtual void set_send_address(const IP_Address& p_address,int p_port);
+ virtual void set_dest_address(const IP_Address& p_address,int p_port);
static void make_default();
PacketPeerUDPWinsock();
diff --git a/platform/windows/platform_config.h b/platform/windows/platform_config.h
index 31512a1054..0e16753156 100644
--- a/platform/windows/platform_config.h
+++ b/platform/windows/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 */
@@ -30,4 +30,4 @@
//#else
//#include <alloca.h>
//#endif
-#define GLES2_INCLUDE_H "GL/glew.h"
+#define GLES3_INCLUDE_H "glad/glad.h"
diff --git a/platform/windows/stream_peer_winsock.cpp b/platform/windows/stream_peer_winsock.cpp
index 44c17c73e5..9d3e3623da 100644
--- a/platform/windows/stream_peer_winsock.cpp
+++ b/platform/windows/stream_peer_winsock.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 */
@@ -88,7 +88,7 @@ Error StreamPeerWinsock::_poll_connection(bool p_block) const {
};
struct sockaddr_storage their_addr;
- size_t addr_size = _set_sockaddr(&their_addr, peer_host, peer_port);
+ size_t addr_size = _set_sockaddr(&their_addr, peer_host, peer_port, sock_type);
if (::connect(sockfd, (struct sockaddr *)&their_addr,addr_size) == SOCKET_ERROR) {
@@ -98,7 +98,12 @@ Error StreamPeerWinsock::_poll_connection(bool p_block) const {
return OK;
};
- return OK;
+ if (err == WSAEINPROGRESS || err == WSAEALREADY) {
+ return OK;
+ }
+
+ status = STATUS_ERROR;
+ return ERR_CONNECTION_ERROR;
} else {
status = STATUS_CONNECTED;
@@ -131,20 +136,18 @@ Error StreamPeerWinsock::write(const uint8_t* p_data,int p_bytes, int &r_sent, b
int data_to_send = p_bytes;
const uint8_t *offset = p_data;
if (sockfd == -1) return FAILED;
- errno = 0;
int total_sent = 0;
while (data_to_send) {
int sent_amount = send(sockfd, (const char*)offset, data_to_send, 0);
- //printf("Sent TCP data of %d bytes, errno %d\n", sent_amount, errno);
if (sent_amount == -1) {
if (WSAGetLastError() != WSAEWOULDBLOCK) {
perror("shit?");
- disconnect();
+ disconnect_from_host();
ERR_PRINT("Server disconnected!\n");
return FAILED;
};
@@ -170,7 +173,7 @@ Error StreamPeerWinsock::write(const uint8_t* p_data,int p_bytes, int &r_sent, b
Error StreamPeerWinsock::read(uint8_t* p_buffer, int p_bytes,int &r_received, bool p_block) {
- if (!is_connected()) {
+ if (!is_connected_to_host()) {
return FAILED;
};
@@ -190,7 +193,6 @@ Error StreamPeerWinsock::read(uint8_t* p_buffer, int p_bytes,int &r_received, bo
int to_read = p_bytes;
int total_read = 0;
- errno = 0;
while (to_read) {
@@ -201,7 +203,7 @@ Error StreamPeerWinsock::read(uint8_t* p_buffer, int p_bytes,int &r_received, bo
if (WSAGetLastError() != WSAEWOULDBLOCK) {
perror("shit?");
- disconnect();
+ disconnect_from_host();
ERR_PRINT("Server disconnected!\n");
return FAILED;
};
@@ -213,7 +215,7 @@ Error StreamPeerWinsock::read(uint8_t* p_buffer, int p_bytes,int &r_received, bo
};
_block(sockfd, true, false);
} else if (read == 0) {
- disconnect();
+ disconnect_from_host();
return ERR_FILE_EOF;
} else {
@@ -259,7 +261,7 @@ StreamPeerTCP::Status StreamPeerWinsock::get_status() const {
};
-bool StreamPeerWinsock::is_connected() const {
+bool StreamPeerWinsock::is_connected_to_host() const {
if (status == STATUS_NONE || status == STATUS_ERROR) {
@@ -272,11 +274,12 @@ bool StreamPeerWinsock::is_connected() const {
return (sockfd!=INVALID_SOCKET);
};
-void StreamPeerWinsock::disconnect() {
+void StreamPeerWinsock::disconnect_from_host() {
if (sockfd != INVALID_SOCKET)
closesocket(sockfd);
sockfd=INVALID_SOCKET;
+ sock_type = IP::TYPE_NONE;
status = STATUS_NONE;
@@ -284,22 +287,25 @@ void StreamPeerWinsock::disconnect() {
peer_port = 0;
};
-void StreamPeerWinsock::set_socket(int p_sockfd, IP_Address p_host, int p_port) {
+void StreamPeerWinsock::set_socket(int p_sockfd, IP_Address p_host, int p_port, IP::Type p_ip_type) {
+ ip_type = p_ip_type;
sockfd = p_sockfd;
+ sock_type = p_ip_type;
status = STATUS_CONNECTING;
peer_host = p_host;
peer_port = p_port;
};
-Error StreamPeerWinsock::connect(const IP_Address& p_host, uint16_t p_port) {
+Error StreamPeerWinsock::connect_to_host(const IP_Address& p_host, uint16_t p_port) {
- ERR_FAIL_COND_V( p_host.type == IP_Address::TYPE_NONE, ERR_INVALID_PARAMETER);
+ ERR_FAIL_COND_V( p_host == IP_Address(), ERR_INVALID_PARAMETER);
- sockfd = _socket_create(p_host.type, SOCK_STREAM, IPPROTO_TCP);
+ sock_type = p_host.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6;
+ sockfd = _socket_create(sock_type, SOCK_STREAM, IPPROTO_TCP);
if (sockfd == INVALID_SOCKET) {
ERR_PRINT("Socket creation failed!");
- disconnect();
+ disconnect_from_host();
//perror("socket");
return FAILED;
};
@@ -307,18 +313,18 @@ Error StreamPeerWinsock::connect(const IP_Address& p_host, uint16_t p_port) {
unsigned long par = 1;
if (ioctlsocket(sockfd, FIONBIO, &par)) {
perror("setting non-block mode");
- disconnect();
+ disconnect_from_host();
return FAILED;
};
struct sockaddr_storage their_addr;
- size_t addr_size = _set_sockaddr(&their_addr, p_host, p_port);
+ size_t addr_size = _set_sockaddr(&their_addr, p_host, p_port, sock_type);
if (::connect(sockfd, (struct sockaddr *)&their_addr,addr_size) == SOCKET_ERROR) {
if (WSAGetLastError() != WSAEWOULDBLOCK) {
ERR_PRINT("Connection to remote host failed!");
- disconnect();
+ disconnect_from_host();
return FAILED;
};
status = STATUS_CONNECTING;
@@ -333,7 +339,7 @@ Error StreamPeerWinsock::connect(const IP_Address& p_host, uint16_t p_port) {
};
void StreamPeerWinsock::set_nodelay(bool p_enabled) {
- ERR_FAIL_COND(!is_connected());
+ ERR_FAIL_COND(!is_connected_to_host());
int flag=p_enabled?1:0;
setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char*)&flag, sizeof(int));
}
@@ -359,14 +365,16 @@ uint16_t StreamPeerWinsock::get_connected_port() const {
StreamPeerWinsock::StreamPeerWinsock() {
+ sock_type = IP::TYPE_NONE;
sockfd = INVALID_SOCKET;
status = STATUS_NONE;
peer_port = 0;
+ ip_type = IP::TYPE_ANY;
};
StreamPeerWinsock::~StreamPeerWinsock() {
- disconnect();
+ disconnect_from_host();
};
diff --git a/platform/windows/stream_peer_winsock.h b/platform/windows/stream_peer_winsock.h
index bbff661490..59e4dc0d09 100644
--- a/platform/windows/stream_peer_winsock.h
+++ b/platform/windows/stream_peer_winsock.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 */
@@ -41,6 +41,7 @@ class StreamPeerWinsock : public StreamPeerTCP {
protected:
mutable Status status;
+ IP::Type sock_type;
int sockfd;
@@ -58,7 +59,7 @@ protected:
public:
- virtual Error connect(const IP_Address& p_host, uint16_t p_port);
+ virtual Error connect_to_host(const IP_Address& p_host, uint16_t p_port);
virtual Error put_data(const uint8_t* p_data,int p_bytes);
virtual Error put_partial_data(const uint8_t* p_data,int p_bytes, int &r_sent);
@@ -68,14 +69,14 @@ public:
virtual int get_available_bytes() const;
- void set_socket(int p_sockfd, IP_Address p_host, int p_port);
+ void set_socket(int p_sockfd, IP_Address p_host, int p_port, IP::Type p_ip_type);
virtual IP_Address get_connected_host() const;
virtual uint16_t get_connected_port() const;
- virtual bool is_connected() const;
+ virtual bool is_connected_to_host() const;
virtual Status get_status() const;
- virtual void disconnect();
+ virtual void disconnect_from_host();
static void make_default();
static void cleanup();
diff --git a/platform/windows/tcp_server_winsock.cpp b/platform/windows/tcp_server_winsock.cpp
index 38a6b04100..1c3682adfa 100644
--- a/platform/windows/tcp_server_winsock.cpp
+++ b/platform/windows/tcp_server_winsock.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 */
@@ -63,20 +63,12 @@ void TCPServerWinsock::cleanup() {
};
-Error TCPServerWinsock::listen(uint16_t p_port, IP_Address::AddrType p_type,const List<String> *p_accepted_hosts) {
+Error TCPServerWinsock::listen(uint16_t p_port,const List<String> *p_accepted_hosts) {
int sockfd;
- sockfd = _socket_create(p_type, SOCK_STREAM, IPPROTO_TCP);
+ sockfd = _socket_create(ip_type, SOCK_STREAM, IPPROTO_TCP);
ERR_FAIL_COND_V(sockfd == INVALID_SOCKET, FAILED);
- if(p_type == IP_Address::TYPE_IPV6) {
- // Use IPv6 only socket
- int yes = 1;
- if(setsockopt(sockfd, IPPROTO_IPV6, IPV6_V6ONLY, (const char*)&yes, sizeof(yes)) != 0) {
- WARN_PRINT("Unable to unset IPv4 address mapping over IPv6");
- }
- }
-
unsigned long par = 1;
if (ioctlsocket(sockfd, FIONBIO, &par)) {
perror("setting non-block mode");
@@ -85,7 +77,7 @@ Error TCPServerWinsock::listen(uint16_t p_port, IP_Address::AddrType p_type,cons
};
struct sockaddr_storage my_addr;
- size_t addr_size = _set_listen_sockaddr(&my_addr, p_port, p_type, p_accepted_hosts);
+ size_t addr_size = _set_listen_sockaddr(&my_addr, p_port, ip_type, p_accepted_hosts);
int reuse=1;
if(setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char *)&reuse, sizeof(reuse)) < 0) {
@@ -158,7 +150,7 @@ Ref<StreamPeerTCP> TCPServerWinsock::take_connection() {
int port;
_set_ip_addr_port(ip, port, &their_addr);
- conn->set_socket(fd, ip, port);
+ conn->set_socket(fd, ip, port, ip_type);
return conn;
};
@@ -176,6 +168,7 @@ void TCPServerWinsock::stop() {
TCPServerWinsock::TCPServerWinsock() {
listen_sockfd = INVALID_SOCKET;
+ ip_type = IP::TYPE_ANY;
};
TCPServerWinsock::~TCPServerWinsock() {
diff --git a/platform/windows/tcp_server_winsock.h b/platform/windows/tcp_server_winsock.h
index 115fdb4234..5c544436a7 100644
--- a/platform/windows/tcp_server_winsock.h
+++ b/platform/windows/tcp_server_winsock.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 */
@@ -39,7 +39,7 @@ class TCPServerWinsock : public TCP_Server {
public:
- virtual Error listen(uint16_t p_port, IP_Address::AddrType p_type,const List<String> *p_accepted_hosts=NULL);
+ virtual Error listen(uint16_t p_port,const List<String> *p_accepted_hosts=NULL);
virtual bool is_connection_available() const;
virtual Ref<StreamPeerTCP> take_connection();
diff --git a/platform/winrt/SCsub b/platform/winrt/SCsub
deleted file mode 100644
index 91a179084d..0000000000
--- a/platform/winrt/SCsub
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/env python
-
-Import('env')
-
-files = [
- 'thread_winrt.cpp',
- '#platform/windows/tcp_server_winsock.cpp',
- '#platform/windows/packet_peer_udp_winsock.cpp',
- '#platform/windows/stream_peer_winsock.cpp',
- '#platform/windows/key_mapping_win.cpp',
- 'joystick_winrt.cpp',
- 'gl_context_egl.cpp',
- 'app.cpp',
- 'os_winrt.cpp',
-]
-
-if "build_angle" in env and env["build_angle"]:
- cmd = env.AlwaysBuild(env.ANGLE('libANGLE.lib', None))
-
-prog = env.Program('#bin/godot', files)
-
-if "build_angle" in env and env["build_angle"]:
- env.Depends(prog, [cmd])
diff --git a/platform/winrt/detect.py b/platform/winrt/detect.py
deleted file mode 100644
index a7bc62f685..0000000000
--- a/platform/winrt/detect.py
+++ /dev/null
@@ -1,166 +0,0 @@
-import os
-
-import sys
-import string
-import methods
-
-
-def is_active():
- return True
-
-def get_name():
- return "WinRT"
-
-def can_build():
- if (os.name=="nt"):
- #building natively on windows!
- if (os.getenv("VSINSTALLDIR")):
-
- if (os.getenv("ANGLE_SRC_PATH") == None):
- return False
-
- return True
- return False
-
-def get_opts():
- return []
-
-def get_flags():
-
- return [
- ('tools', 'no'),
- ('builtin_zlib', 'yes'),
- ('openssl', 'builtin'),
- ('xaudio2', 'yes'),
- ]
-
-
-def configure(env):
-
- if(env["bits"] != "default"):
- print "Error: bits argument is disabled for MSVC"
- print ("Bits argument is not supported for MSVC compilation. Architecture depends on the Native/Cross Compile Tools Prompt/Developer Console (or Visual Studio settings)"
- +" that is being used to run SCons. As a consequence, bits argument is disabled. Run scons again without bits argument (example: scons p=winrt) and SCons will attempt to detect what MSVC compiler"
- +" will be executed and inform you.")
- sys.exit()
-
- arch = ""
- env['ENV'] = os.environ;
-
- # ANGLE
- angle_root = os.getenv("ANGLE_SRC_PATH")
- env.Append(CPPPATH=[angle_root + '/include'])
- jobs = str(env.GetOption("num_jobs"))
- angle_build_cmd = "msbuild.exe " + angle_root + "/winrt/10/src/angle.sln /nologo /v:m /m:" + jobs + " /p:Configuration=Release /p:Platform="
-
- if os.path.isfile(str(os.getenv("ANGLE_SRC_PATH")) + "/winrt/10/src/angle.sln"):
- env["build_angle"] = True
-
- if os.getenv('Platform') == "ARM":
-
- print "Compiled program architecture will be an ARM executable. (forcing bits=32)."
-
- arch="arm"
- env["bits"]="32"
- env.Append(LINKFLAGS=['/MACHINE:ARM'])
- env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store/arm'])
-
- angle_build_cmd += "ARM"
-
- env.Append(LIBPATH=[angle_root + '/winrt/10/src/Release_ARM/lib'])
-
- else:
-
- compiler_version_str = methods.detect_visual_c_compiler_version(env['ENV'])
-
- if(compiler_version_str == "amd64" or compiler_version_str == "x86_amd64"):
- env["bits"]="64"
- print "Compiled program architecture will be a x64 executable (forcing bits=64)."
- elif (compiler_version_str=="x86" or compiler_version_str == "amd64_x86"):
- env["bits"]="32"
- print "Compiled program architecture will be a x86 executable. (forcing bits=32)."
- else:
- print "Failed to detect MSVC compiler architecture version... Defaulting to 32bit executable settings (forcing bits=32). Compilation attempt will continue, but SCons can not detect for what architecture this build is compiled for. You should check your settings/compilation setup."
- env["bits"]="32"
-
- if (env["bits"] == "32"):
- arch = "x86"
-
- angle_build_cmd += "Win32"
-
- env.Append(CPPFLAGS=['/DPNG_ABORT=abort'])
- env.Append(LINKFLAGS=['/MACHINE:X86'])
- env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store'])
- env.Append(LIBPATH=[angle_root + '/winrt/10/src/Release_Win32/lib'])
-
- else:
- arch = "x64"
-
- angle_build_cmd += "x64"
-
- env.Append(LINKFLAGS=['/MACHINE:X64'])
- env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store/amd64'])
- env.Append(LIBPATH=[angle_root + '/winrt/10/src/Release_x64/lib'])
-
- env.Append(CPPPATH=['#platform/winrt','#drivers/windows'])
- env.Append(LINKFLAGS=['/MANIFEST:NO', '/NXCOMPAT', '/DYNAMICBASE', '/WINMD', '/APPCONTAINER', '/ERRORREPORT:PROMPT', '/NOLOGO', '/TLBID:1', '/NODEFAULTLIB:"kernel32.lib"', '/NODEFAULTLIB:"ole32.lib"'])
- env.Append(CPPFLAGS=['/D','__WRL_NO_DEFAULT_LIB__','/D','WIN32'])
- env.Append(CPPFLAGS=['/FU', os.environ['VCINSTALLDIR'] + 'lib/store/references/platform.winmd'])
- env.Append(CPPFLAGS=['/AI', os.environ['VCINSTALLDIR'] + 'lib/store/references'])
-
- env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store/references'])
-
- if (env["target"]=="release"):
-
- env.Append(CPPFLAGS=['/O2', '/GL'])
- env.Append(CPPFLAGS=['/MD'])
- env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS', '/LTCG'])
-
- elif (env["target"]=="release_debug"):
-
- env.Append(CCFLAGS=['/O2','/Zi','/DDEBUG_ENABLED'])
- env.Append(CPPFLAGS=['/MD'])
- env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
-
- elif (env["target"]=="debug"):
-
- env.Append(CCFLAGS=['/Zi','/DDEBUG_ENABLED','/DDEBUG_MEMORY_ENABLED'])
- env.Append(CPPFLAGS=['/MDd'])
- env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
- env.Append(LINKFLAGS=['/DEBUG'])
-
-
- env.Append(CCFLAGS=string.split('/FS /MP /GS /wd"4453" /wd"28204" /wd"4291" /Zc:wchar_t /Gm- /fp:precise /D "_UNICODE" /D "UNICODE" /D "WINAPI_FAMILY=WINAPI_FAMILY_APP" /errorReport:prompt /WX- /Zc:forScope /Gd /EHsc /nologo'))
- env.Append(CXXFLAGS=string.split('/ZW /FS'))
- env.Append(CCFLAGS=['/AI', os.environ['VCINSTALLDIR']+'\\vcpackages', '/AI', os.environ['WINDOWSSDKDIR']+'\\References\\CommonConfiguration\\Neutral'])
-
-
- env["PROGSUFFIX"]="."+arch+env["PROGSUFFIX"]
- env["OBJSUFFIX"]="."+arch+env["OBJSUFFIX"]
- env["LIBSUFFIX"]="."+arch+env["LIBSUFFIX"]
-
- env.Append(CCFLAGS=['/DWINRT_ENABLED'])
- env.Append(CCFLAGS=['/DWINDOWS_ENABLED'])
- env.Append(CCFLAGS=['/DTYPED_METHOD_BIND'])
-
- env.Append(CCFLAGS=['/DGLES2_ENABLED','/DGL_GLEXT_PROTOTYPES','/DEGL_EGLEXT_PROTOTYPES','/DANGLE_ENABLED'])
-
- LIBS = [
- 'WindowsApp',
- 'mincore',
- 'libANGLE',
- 'libEGL',
- 'libGLESv2',
- ]
- env.Append(LINKFLAGS=[p+".lib" for p in LIBS])
-
- # Incremental linking fix
- env['BUILDERS']['ProgramOriginal'] = env['BUILDERS']['Program']
- env['BUILDERS']['Program'] = methods.precious_program
-
- env.Append( BUILDERS = { 'ANGLE' : env.Builder(action = angle_build_cmd) } )
-
- 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 = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } )
- env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
diff --git a/platform/x11/SCsub b/platform/x11/SCsub
index e20bd44f8d..4ae8ac07f7 100644
--- a/platform/x11/SCsub
+++ b/platform/x11/SCsub
@@ -3,11 +3,11 @@
Import('env')
-common_x11=[\
- "context_gl_x11.cpp",\
- "os_x11.cpp",\
- "key_mapping_x11.cpp",\
- "joystick_linux.cpp",\
+common_x11 = [\
+ "context_gl_x11.cpp",\
+ "os_x11.cpp",\
+ "key_mapping_x11.cpp",\
+ "joypad_linux.cpp",\
]
-env.Program('#bin/godot',['godot_x11.cpp']+common_x11)
+env.Program('#bin/godot', ['godot_x11.cpp'] + common_x11)
diff --git a/platform/x11/context_gl_x11.cpp b/platform/x11/context_gl_x11.cpp
index cd325dfc99..39b704d2c4 100644
--- a/platform/x11/context_gl_x11.cpp
+++ b/platform/x11/context_gl_x11.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 */
@@ -76,12 +76,19 @@ static GLWrapperFuncPtr wrapper_get_proc_address(const char* p_function) {
}*/
+static bool ctxErrorOccurred = false;
+static int ctxErrorHandler( Display *dpy, XErrorEvent *ev )
+{
+ ctxErrorOccurred = true;
+ return 0;
+}
+
Error ContextGL_X11::initialize() {
GLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB = NULL;
-// const char *extensions = glXQueryExtensionsString(x11_display, DefaultScreen(x11_display));
+ //const char *extensions = glXQueryExtensionsString(x11_display, DefaultScreen(x11_display));
glXCreateContextAttribsARB = (GLXCREATECONTEXTATTRIBSARBPROC)glXGetProcAddress((const GLubyte*)"glXCreateContextAttribsARB");
@@ -133,20 +140,31 @@ Error ContextGL_X11::initialize() {
//};
+ int (*oldHandler)(Display*, XErrorEvent*) =
+ XSetErrorHandler(&ctxErrorHandler);
+
+
if (!opengl_3_context) {
//oldstyle context:
p->glx_context = glXCreateContext(x11_display, vi, 0, GL_TRUE);
} else {
static int context_attribs[] = {
GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
- GLX_CONTEXT_MINOR_VERSION_ARB, 0,
+ GLX_CONTEXT_MINOR_VERSION_ARB, 3,
+ GLX_CONTEXT_FLAGS_ARB , GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB/*|GLX_CONTEXT_DEBUG_BIT_ARB*/,
None
};
p->glx_context = glXCreateContextAttribsARB(x11_display, fbc[0], NULL, true, context_attribs);
- ERR_FAIL_COND_V(!p->glx_context,ERR_UNCONFIGURED);
+ ERR_EXPLAIN("Could not obtain an OpenGL 3.3 context!");
+ ERR_FAIL_COND_V(ctxErrorOccurred || !p->glx_context,ERR_UNCONFIGURED);
}
+ XSync( x11_display, False );
+ XSetErrorHandler( oldHandler );
+
+ print_line("ALL IS GOOD");
+
glXMakeCurrent(x11_display, x11_window, p->glx_context);
/*
diff --git a/platform/x11/context_gl_x11.h b/platform/x11/context_gl_x11.h
index 4474542c0b..efea700224 100644
--- a/platform/x11/context_gl_x11.h
+++ b/platform/x11/context_gl_x11.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 */
@@ -48,7 +48,7 @@ class ContextGL_X11 : public ContextGL {
ContextGL_X11_Private *p;
OS::VideoMode default_video_mode;
-// ::Colormap x11_colormap;
+ //::Colormap x11_colormap;
::Display *x11_display;
::Window& x11_window;
bool double_buffer;
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index e90af2c697..b5f6359d21 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -5,236 +5,241 @@ import platform
def is_active():
- return True
+ return True
+
def get_name():
- return "X11"
+ return "X11"
def can_build():
- if (os.name!="posix"):
- return False
+ if (os.name != "posix"):
+ return False
- if sys.platform == "darwin":
- return False # no x11 on mac for now
+ if sys.platform == "darwin":
+ return False # no x11 on mac for now
- errorval=os.system("pkg-config --version > /dev/null")
+ errorval = os.system("pkg-config --version > /dev/null")
- if (errorval):
- print("pkg-config not found.. x11 disabled.")
- return False
+ if (errorval):
+ print("pkg-config not found.. x11 disabled.")
+ return False
- x11_error=os.system("pkg-config x11 --modversion > /dev/null ")
- if (x11_error):
- print("X11 not found.. x11 disabled.")
- return False
+ x11_error = os.system("pkg-config x11 --modversion > /dev/null ")
+ if (x11_error):
+ print("X11 not found.. x11 disabled.")
+ return False
- ssl_error=os.system("pkg-config openssl --modversion > /dev/null ")
- if (ssl_error):
- print("OpenSSL not found.. x11 disabled.")
- return False
+ ssl_error = os.system("pkg-config openssl --modversion > /dev/null ")
+ if (ssl_error):
+ print("OpenSSL not found.. x11 disabled.")
+ return False
- x11_error=os.system("pkg-config xcursor --modversion > /dev/null ")
- if (x11_error):
- print("xcursor not found.. x11 disabled.")
- return False
+ x11_error = os.system("pkg-config xcursor --modversion > /dev/null ")
+ if (x11_error):
+ print("xcursor not found.. x11 disabled.")
+ return False
- x11_error=os.system("pkg-config xinerama --modversion > /dev/null ")
- if (x11_error):
- print("xinerama not found.. x11 disabled.")
- return False
+ x11_error = os.system("pkg-config xinerama --modversion > /dev/null ")
+ if (x11_error):
+ print("xinerama not found.. x11 disabled.")
+ return False
- x11_error=os.system("pkg-config xrandr --modversion > /dev/null ")
- if (x11_error):
- print("xrandr not found.. x11 disabled.")
- return False
+ x11_error = os.system("pkg-config xrandr --modversion > /dev/null ")
+ if (x11_error):
+ print("xrandr not found.. x11 disabled.")
+ return False
+ return True # X11 enabled
- return True # X11 enabled
def get_opts():
- return [
- ('use_llvm','Use llvm compiler','no'),
- ('use_static_cpp','link stdc++ statically','no'),
- ('use_sanitizer','Use llvm compiler sanitize address','no'),
- ('use_leak_sanitizer','Use llvm compiler sanitize memory leaks','no'),
- ('pulseaudio','Detect & Use pulseaudio','yes'),
- ('udev','Use udev for gamepad connection callbacks','no'),
- ('debug_release', 'Add debug symbols to release version','no'),
- ]
+ return [
+ ('use_llvm', 'Use llvm compiler', 'no'),
+ ('use_static_cpp', 'link stdc++ statically', 'no'),
+ ('use_sanitizer', 'Use llvm compiler sanitize address', 'no'),
+ ('use_leak_sanitizer', 'Use llvm compiler sanitize memory leaks', 'no'),
+ ('pulseaudio', 'Detect & Use pulseaudio', 'yes'),
+ ('udev', 'Use udev for gamepad connection callbacks', 'no'),
+ ('debug_release', 'Add debug symbols to release version', 'no'),
+ ]
-def get_flags():
- return [
- ("openssl", "system"),
- ('freetype', 'system'),
- ('libpng', 'system'),
- ]
+def get_flags():
+ return [
+ ('builtin_freetype', 'no'),
+ ('builtin_libpng', 'no'),
+ ('builtin_openssl', 'no'),
+ ('builtin_zlib', 'no'),
+ ]
def configure(env):
- is64=sys.maxsize > 2**32
-
- if (env["bits"]=="default"):
- if (is64):
- env["bits"]="64"
- else:
- env["bits"]="32"
-
- env.Append(CPPPATH=['#platform/x11'])
- if (env["use_llvm"]=="yes"):
- if 'clang++' not in env['CXX']:
- env["CC"]="clang"
- env["CXX"]="clang++"
- env["LD"]="clang++"
- env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
- env.extra_suffix=".llvm"
-
- if (env["use_sanitizer"]=="yes"):
- env.Append(CXXFLAGS=['-fsanitize=address','-fno-omit-frame-pointer'])
- env.Append(LINKFLAGS=['-fsanitize=address'])
- env.extra_suffix+="s"
-
- if (env["use_leak_sanitizer"]=="yes"):
- env.Append(CXXFLAGS=['-fsanitize=address','-fno-omit-frame-pointer'])
- env.Append(LINKFLAGS=['-fsanitize=address'])
- env.extra_suffix+="s"
-
-
- #if (env["tools"]=="no"):
- # #no tools suffix
- # env['OBJSUFFIX'] = ".nt"+env['OBJSUFFIX']
- # env['LIBSUFFIX'] = ".nt"+env['LIBSUFFIX']
-
-
- if (env["target"]=="release"):
-
- if (env["debug_release"]=="yes"):
- env.Append(CCFLAGS=['-g2'])
- else:
- env.Append(CCFLAGS=['-O3','-ffast-math'])
-
- elif (env["target"]=="release_debug"):
-
- env.Append(CCFLAGS=['-O2','-ffast-math','-DDEBUG_ENABLED'])
- if (env["debug_release"]=="yes"):
- env.Append(CCFLAGS=['-g2'])
-
- elif (env["target"]=="debug"):
-
- env.Append(CCFLAGS=['-g2', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
-
- env.ParseConfig('pkg-config x11 --cflags --libs')
- env.ParseConfig('pkg-config xinerama --cflags --libs')
- env.ParseConfig('pkg-config xcursor --cflags --libs')
- env.ParseConfig('pkg-config xrandr --cflags --libs')
-
- if (env["openssl"] == "system"):
- env.ParseConfig('pkg-config openssl --cflags --libs')
-
- if (env["libwebp"] == "system"):
- env.ParseConfig('pkg-config libwebp --cflags --libs')
-
- if (env["freetype"] == "system"):
- env["libpng"] = "system" # Freetype links against libpng
- env.ParseConfig('pkg-config freetype2 --cflags --libs')
-
- if (env["libpng"] == "system"):
- env.ParseConfig('pkg-config libpng --cflags --libs')
-
- if (env["enet"] == "system"):
- env.ParseConfig('pkg-config libenet --cflags --libs')
-
- if (env["squish"] == "system" and env["tools"] == "yes"):
- env.ParseConfig('pkg-config libsquish --cflags --libs')
-
- # Sound and video libraries
- # Keep the order as it triggers chained dependencies (ogg needed by others, etc.)
-
- if (env["libtheora"] == "system"):
- env["libogg"] = "system" # Needed to link against system libtheora
- env["libvorbis"] = "system" # Needed to link against system libtheora
- env.ParseConfig('pkg-config theora theoradec --cflags --libs')
-
- if (env["libvpx"] == "system"):
- env.ParseConfig('pkg-config vpx --cflags --libs')
-
- if (env["libvorbis"] == "system"):
- env["libogg"] = "system" # Needed to link against system libvorbis
- env.ParseConfig('pkg-config vorbis vorbisfile --cflags --libs')
-
- if (env["opus"] == "system"):
- env["libogg"] = "system" # Needed to link against system opus
- env.ParseConfig('pkg-config opus opusfile --cflags --libs')
-
- if (env["libogg"] == "system"):
- env.ParseConfig('pkg-config ogg --cflags --libs')
-
+ is64 = sys.maxsize > 2**32
- env.Append(CPPFLAGS=['-DOPENGL_ENABLED'])
+ if (env["bits"] == "default"):
+ if (is64):
+ env["bits"] = "64"
+ else:
+ env["bits"] = "32"
- if (env["glew"] == "system"):
- env.ParseConfig('pkg-config glew --cflags --libs')
+ env.Append(CPPPATH=['#platform/x11'])
+ if (env["use_llvm"] == "yes"):
+ if 'clang++' not in env['CXX']:
+ env["CC"] = "clang"
+ env["CXX"] = "clang++"
+ env["LD"] = "clang++"
+ env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
+ env.extra_suffix = ".llvm"
- if os.system("pkg-config --exists alsa")==0:
- print("Enabling ALSA")
- env.Append(CPPFLAGS=["-DALSA_ENABLED"])
- env.ParseConfig('pkg-config alsa --cflags --libs')
- else:
- print("ALSA libraries not found, disabling driver")
+ if (env["use_sanitizer"] == "yes"):
+ env.Append(CXXFLAGS=['-fsanitize=address', '-fno-omit-frame-pointer'])
+ env.Append(LINKFLAGS=['-fsanitize=address'])
+ env.extra_suffix += "s"
- if (platform.system() == "Linux"):
- env.Append(CPPFLAGS=["-DJOYDEV_ENABLED"])
- if (env["udev"]=="yes"):
- # pkg-config returns 0 when the lib exists...
- found_udev = not os.system("pkg-config --exists libudev")
+ if (env["use_leak_sanitizer"] == "yes"):
+ env.Append(CXXFLAGS=['-fsanitize=address', '-fno-omit-frame-pointer'])
+ env.Append(LINKFLAGS=['-fsanitize=address'])
+ env.extra_suffix += "s"
+
+ # if (env["tools"]=="no"):
+ # #no tools suffix
+ # env['OBJSUFFIX'] = ".nt"+env['OBJSUFFIX']
+ # env['LIBSUFFIX'] = ".nt"+env['LIBSUFFIX']
+
+ if (env["target"] == "release"):
- if (found_udev):
- print("Enabling udev support")
- env.Append(CPPFLAGS=["-DUDEV_ENABLED"])
- env.ParseConfig('pkg-config libudev --cflags --libs')
- else:
- print("libudev development libraries not found, disabling udev support")
+ if (env["debug_release"] == "yes"):
+ env.Append(CCFLAGS=['-g2'])
+ else:
+ env.Append(CCFLAGS=['-O3', '-ffast-math'])
+
+ elif (env["target"] == "release_debug"):
- if (env["pulseaudio"]=="yes"):
- if not os.system("pkg-config --exists libpulse-simple"):
- print("Enabling PulseAudio")
- env.Append(CPPFLAGS=["-DPULSEAUDIO_ENABLED"])
- env.ParseConfig('pkg-config --cflags --libs libpulse-simple')
- else:
- print("PulseAudio development libraries not found, disabling driver")
+ env.Append(CCFLAGS=['-O2', '-ffast-math', '-DDEBUG_ENABLED'])
+ if (env["debug_release"] == "yes"):
+ env.Append(CCFLAGS=['-g2'])
- env.Append(CPPFLAGS=['-DX11_ENABLED','-DUNIX_ENABLED','-DGLES2_ENABLED','-DGLES_OVER_GL'])
- env.Append(LIBS=['GL', 'pthread', 'z'])
- if (platform.system() == "Linux"):
- env.Append(LIBS='dl')
- #env.Append(CPPFLAGS=['-DMPC_FIXED_POINT'])
+ elif (env["target"] == "debug"):
+
+ env.Append(CCFLAGS=['-g2', '-Wall', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
+
+ env.ParseConfig('pkg-config x11 --cflags --libs')
+ env.ParseConfig('pkg-config xinerama --cflags --libs')
+ env.ParseConfig('pkg-config xcursor --cflags --libs')
+ env.ParseConfig('pkg-config xrandr --cflags --libs')
-#host compiler is default..
+ if (env['builtin_openssl'] == 'no'):
+ env.ParseConfig('pkg-config openssl --cflags --libs')
+
+ if (env['builtin_libwebp'] == 'no'):
+ env.ParseConfig('pkg-config libwebp --cflags --libs')
+
+ # freetype depends on libpng and zlib, so bundling one of them while keeping others
+ # as shared libraries leads to weird issues
+ if (env['builtin_freetype'] == 'yes' or env['builtin_libpng'] == 'yes' or env['builtin_zlib'] == 'yes'):
+ env['builtin_freetype'] = 'yes'
+ env['builtin_libpng'] = 'yes'
+ env['builtin_zlib'] = 'yes'
+
+ if (env['builtin_freetype'] == 'no'):
+ env.ParseConfig('pkg-config freetype2 --cflags --libs')
+
+ if (env['builtin_libpng'] == 'no'):
+ env.ParseConfig('pkg-config libpng --cflags --libs')
+
+ if (env['builtin_enet'] == 'no'):
+ env.ParseConfig('pkg-config libenet --cflags --libs')
+
+ if (env['builtin_squish'] == 'no' and env["tools"] == "yes"):
+ env.ParseConfig('pkg-config libsquish --cflags --libs')
+
+ # Sound and video libraries
+ # Keep the order as it triggers chained dependencies (ogg needed by others, etc.)
+
+ if (env['builtin_libtheora'] == 'no'):
+ env['builtin_libogg'] = 'no' # Needed to link against system libtheora
+ env['builtin_libvorbis'] = 'no' # Needed to link against system libtheora
+ env.ParseConfig('pkg-config theora theoradec --cflags --libs')
+
+ if (env['builtin_libvpx'] == 'no'):
+ env.ParseConfig('pkg-config vpx --cflags --libs')
+
+ if (env['builtin_libvorbis'] == 'no'):
+ env['builtin_libogg'] = 'no' # Needed to link against system libvorbis
+ env.ParseConfig('pkg-config vorbis vorbisfile --cflags --libs')
+
+ if (env['builtin_opus'] == 'no'):
+ env['builtin_libogg'] = 'no' # Needed to link against system opus
+ env.ParseConfig('pkg-config opus opusfile --cflags --libs')
+
+ if (env['builtin_libogg'] == 'no'):
+ env.ParseConfig('pkg-config ogg --cflags --libs')
+
+ env.Append(CPPFLAGS=['-DOPENGL_ENABLED'])
+
+ if os.system("pkg-config --exists alsa") == 0:
+ print("Enabling ALSA")
+ env.Append(CPPFLAGS=["-DALSA_ENABLED"])
+ env.ParseConfig('pkg-config alsa --cflags --libs')
+ else:
+ print("ALSA libraries not found, disabling driver")
+
+ if (platform.system() == "Linux"):
+ env.Append(CPPFLAGS=["-DJOYDEV_ENABLED"])
+ if (env["udev"] == "yes"):
+ # pkg-config returns 0 when the lib exists...
+ found_udev = not os.system("pkg-config --exists libudev")
- if (is64 and env["bits"]=="32"):
- env.Append(CPPFLAGS=['-m32'])
- env.Append(LINKFLAGS=['-m32','-L/usr/lib/i386-linux-gnu'])
- elif (not is64 and env["bits"]=="64"):
- env.Append(CPPFLAGS=['-m64'])
- env.Append(LINKFLAGS=['-m64','-L/usr/lib/i686-linux-gnu'])
+ if (found_udev):
+ print("Enabling udev support")
+ env.Append(CPPFLAGS=["-DUDEV_ENABLED"])
+ env.ParseConfig('pkg-config libudev --cflags --libs')
+ else:
+ print("libudev development libraries not found, disabling udev support")
+ if (env["pulseaudio"] == "yes"):
+ if not os.system("pkg-config --exists libpulse-simple"):
+ print("Enabling PulseAudio")
+ env.Append(CPPFLAGS=["-DPULSEAUDIO_ENABLED"])
+ env.ParseConfig('pkg-config --cflags --libs libpulse-simple')
+ else:
+ print("PulseAudio development libraries not found, disabling driver")
- import methods
+ if (env['builtin_zlib'] == 'no'):
+ env.ParseConfig('pkg-config zlib --cflags --libs')
- 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.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } )
+ env.Append(CPPFLAGS=['-DX11_ENABLED', '-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DGLES_OVER_GL'])
+ env.Append(LIBS=['GL', 'pthread'])
- if (env["use_static_cpp"]=="yes"):
- env.Append(LINKFLAGS=['-static-libstdc++'])
+ if (platform.system() == "Linux"):
+ env.Append(LIBS=['dl'])
+ # env.Append(CPPFLAGS=['-DMPC_FIXED_POINT'])
- list_of_x86 = ['x86_64', 'x86', 'i386', 'i586']
- if any(platform.machine() in s for s in list_of_x86):
- env["x86_libtheora_opt_gcc"]=True
+# host compiler is default..
+ if (is64 and env["bits"] == "32"):
+ env.Append(CPPFLAGS=['-m32'])
+ env.Append(LINKFLAGS=['-m32', '-L/usr/lib/i386-linux-gnu'])
+ elif (not is64 and env["bits"] == "64"):
+ env.Append(CPPFLAGS=['-m64'])
+ env.Append(LINKFLAGS=['-m64', '-L/usr/lib/i686-linux-gnu'])
+
+ import methods
+
+ # FIXME: Commented out when moving to gles3
+ #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.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } )
+
+ if (env["use_static_cpp"] == "yes"):
+ env.Append(LINKFLAGS=['-static-libstdc++'])
+
+ list_of_x86 = ['x86_64', 'x86', 'i386', 'i586']
+ if any(platform.machine() in s for s in list_of_x86):
+ env["x86_libtheora_opt_gcc"] = True
diff --git a/platform/x11/export/export.cpp b/platform/x11/export/export.cpp
index c6675ace72..c1af323453 100644
--- a/platform/x11/export/export.cpp
+++ b/platform/x11/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 */
diff --git a/platform/x11/export/export.h b/platform/x11/export/export.h
index 9dc13d7459..5beaba2cfb 100644
--- a/platform/x11/export/export.h
+++ b/platform/x11/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/x11/godot_x11.cpp b/platform/x11/godot_x11.cpp
index c500f939c4..f85ba17020 100644
--- a/platform/x11/godot_x11.cpp
+++ b/platform/x11/godot_x11.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/x11/joystick_linux.cpp b/platform/x11/joypad_linux.cpp
index 3b854a8d46..362999661e 100644
--- a/platform/x11/joystick_linux.cpp
+++ b/platform/x11/joypad_linux.cpp
@@ -1,11 +1,11 @@
/*************************************************************************/
-/* joystick_linux.cpp */
+/* joypad_linux.cpp */
/*************************************************************************/
/* This file is part of: */
/* 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 */
@@ -27,10 +27,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-//author: Andreas Haas <hondres, liugam3@gmail.com>
#ifdef JOYDEV_ENABLED
-#include "joystick_linux.h"
+#include "joypad_linux.h"
#include <linux/input.h>
#include <unistd.h>
@@ -49,7 +48,7 @@
static const char* ignore_str = "/dev/input/js";
#endif
-joystick_linux::Joystick::Joystick() {
+JoypadLinux::Joypad::Joypad() {
fd = -1;
dpad = 0;
devpath = "";
@@ -58,7 +57,7 @@ joystick_linux::Joystick::Joystick() {
}
}
-joystick_linux::Joystick::~Joystick() {
+JoypadLinux::Joypad::~Joypad() {
for (int i = 0; i < MAX_ABS; i++) {
if (abs_info[i]) {
@@ -67,7 +66,7 @@ joystick_linux::Joystick::~Joystick() {
}
}
-void joystick_linux::Joystick::reset() {
+void JoypadLinux::Joypad::reset() {
dpad = 0;
fd = -1;
@@ -80,7 +79,7 @@ void joystick_linux::Joystick::reset() {
}
}
-joystick_linux::joystick_linux(InputDefault *in)
+JoypadLinux::JoypadLinux(InputDefault *in)
{
exit_udev = false;
input = in;
@@ -88,37 +87,37 @@ joystick_linux::joystick_linux(InputDefault *in)
joy_thread = Thread::create(joy_thread_func, this);
}
-joystick_linux::~joystick_linux() {
+JoypadLinux::~JoypadLinux() {
exit_udev = true;
Thread::wait_to_finish(joy_thread);
memdelete(joy_thread);
memdelete(joy_mutex);
- close_joystick();
+ close_joypad();
}
-void joystick_linux::joy_thread_func(void *p_user) {
+void JoypadLinux::joy_thread_func(void *p_user) {
if (p_user) {
- joystick_linux* joy = (joystick_linux*) p_user;
- joy->run_joystick_thread();
+ JoypadLinux* joy = (JoypadLinux*) p_user;
+ joy->run_joypad_thread();
}
return;
}
-void joystick_linux::run_joystick_thread() {
+void JoypadLinux::run_joypad_thread() {
#ifdef UDEV_ENABLED
udev *_udev = udev_new();
ERR_FAIL_COND(!_udev);
- enumerate_joysticks(_udev);
- monitor_joysticks(_udev);
+ enumerate_joypads(_udev);
+ monitor_joypads(_udev);
udev_unref(_udev);
#else
- monitor_joysticks();
+ monitor_joypads();
#endif
}
#ifdef UDEV_ENABLED
-void joystick_linux::enumerate_joysticks(udev *p_udev) {
+void JoypadLinux::enumerate_joypads(udev *p_udev) {
udev_enumerate *enumerate;
udev_list_entry *devices, *dev_list_entry;
@@ -126,7 +125,7 @@ void joystick_linux::enumerate_joysticks(udev *p_udev) {
enumerate = udev_enumerate_new(p_udev);
udev_enumerate_add_match_subsystem(enumerate,"input");
- udev_enumerate_add_match_property(enumerate, "ID_INPUT_JOYSTICK", "1");
+ udev_enumerate_add_match_property(enumerate, "ID_INPUT_JOYPAD", "1");
udev_enumerate_scan_devices(enumerate);
devices = udev_enumerate_get_list_entry(enumerate);
@@ -141,7 +140,7 @@ void joystick_linux::enumerate_joysticks(udev *p_udev) {
String devnode_str = devnode;
if (devnode_str.find(ignore_str) == -1) {
joy_mutex->lock();
- open_joystick(devnode);
+ open_joypad(devnode);
joy_mutex->unlock();
}
}
@@ -150,7 +149,7 @@ void joystick_linux::enumerate_joysticks(udev *p_udev) {
udev_enumerate_unref(enumerate);
}
-void joystick_linux::monitor_joysticks(udev *p_udev) {
+void JoypadLinux::monitor_joypads(udev *p_udev) {
udev_device *dev = NULL;
udev_monitor *mon = udev_monitor_new_from_netlink(p_udev, "udev");
@@ -188,9 +187,9 @@ void joystick_linux::monitor_joysticks(udev *p_udev) {
if (devnode_str.find(ignore_str) == -1) {
if (action == "add")
- open_joystick(devnode);
+ open_joypad(devnode);
else if (String(action) == "remove")
- close_joystick(get_joy_from_path(devnode));
+ close_joypad(get_joy_from_path(devnode));
}
}
@@ -204,7 +203,7 @@ void joystick_linux::monitor_joysticks(udev *p_udev) {
}
#endif
-void joystick_linux::monitor_joysticks() {
+void JoypadLinux::monitor_joypads() {
while (!exit_udev) {
joy_mutex->lock();
@@ -212,7 +211,7 @@ void joystick_linux::monitor_joysticks() {
char fname[64];
sprintf(fname, "/dev/input/event%d", i);
if (attached_devices.find(fname) == -1) {
- open_joystick(fname);
+ open_joypad(fname);
}
}
joy_mutex->unlock();
@@ -220,37 +219,37 @@ void joystick_linux::monitor_joysticks() {
}
}
-int joystick_linux::get_free_joy_slot() const {
+int JoypadLinux::get_free_joy_slot() const {
- for (int i = 0; i < JOYSTICKS_MAX; i++) {
+ for (int i = 0; i < JOYPADS_MAX; i++) {
- if (joysticks[i].fd == -1) return i;
+ if (joypads[i].fd == -1) return i;
}
return -1;
}
-int joystick_linux::get_joy_from_path(String p_path) const {
+int JoypadLinux::get_joy_from_path(String p_path) const {
- for (int i = 0; i < JOYSTICKS_MAX; i++) {
+ for (int i = 0; i < JOYPADS_MAX; i++) {
- if (joysticks[i].devpath == p_path) {
+ if (joypads[i].devpath == p_path) {
return i;
}
}
return -2;
}
-void joystick_linux::close_joystick(int p_id) {
+void JoypadLinux::close_joypad(int p_id) {
if (p_id == -1) {
- for (int i=0; i<JOYSTICKS_MAX; i++) {
+ for (int i=0; i<JOYPADS_MAX; i++) {
- close_joystick(i);
+ close_joypad(i);
};
return;
}
else if (p_id < 0) return;
- Joystick &joy = joysticks[p_id];
+ Joypad &joy = joypads[p_id];
if (joy.fd != -1) {
@@ -273,9 +272,9 @@ static String _hex_str(uint8_t p_byte) {
return ret;
}
-void joystick_linux::setup_joystick_properties(int p_id) {
+void JoypadLinux::setup_joypad_properties(int p_id) {
- Joystick* joy = &joysticks[p_id];
+ Joypad* joy = &joypads[p_id];
unsigned long keybit[NBITS(KEY_MAX)] = { 0 };
unsigned long absbit[NBITS(ABS_MAX)] = { 0 };
@@ -328,7 +327,7 @@ void joystick_linux::setup_joystick_properties(int p_id) {
}
}
-void joystick_linux::open_joystick(const char *p_path) {
+void JoypadLinux::open_joypad(const char *p_path) {
int joy_num = get_free_joy_slot();
int fd = open(p_path, O_RDWR | O_NONBLOCK);
@@ -349,7 +348,7 @@ void joystick_linux::open_joystick(const char *p_path) {
}
//check if the device supports basic gamepad events, prevents certain keyboards from
- //being detected as joysticks
+ //being detected as joypads
if (!(test_bit(EV_KEY, evbit) && test_bit(EV_ABS, evbit) &&
(test_bit(ABS_X, absbit) || test_bit(ABS_Y, absbit) || test_bit(ABS_HAT0X, absbit) ||
test_bit(ABS_GAS, absbit) || test_bit(ABS_RUDDER, absbit)) &&
@@ -372,12 +371,12 @@ void joystick_linux::open_joystick(const char *p_path) {
return;
}
- joysticks[joy_num].reset();
+ joypads[joy_num].reset();
- Joystick &joy = joysticks[joy_num];
+ Joypad &joy = joypads[joy_num];
joy.fd = fd;
joy.devpath = String(p_path);
- setup_joystick_properties(joy_num);
+ setup_joypad_properties(joy_num);
sprintf(uid, "%04x%04x", __bswap_16(inpid.bustype), 0);
if (inpid.vendor && inpid.product && inpid.version) {
@@ -401,14 +400,14 @@ void joystick_linux::open_joystick(const char *p_path) {
}
}
-void joystick_linux::joystick_vibration_start(int p_id, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp)
+void JoypadLinux::joypad_vibration_start(int p_id, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp)
{
- Joystick& joy = joysticks[p_id];
+ Joypad& joy = joypads[p_id];
if (!joy.force_feedback || joy.fd == -1 || p_weak_magnitude < 0.f || p_weak_magnitude > 1.f || p_strong_magnitude < 0.f || p_strong_magnitude > 1.f) {
return;
}
if (joy.ff_effect_id != -1) {
- joystick_vibration_stop(p_id, p_timestamp);
+ joypad_vibration_stop(p_id, p_timestamp);
}
struct ff_effect effect;
@@ -433,9 +432,9 @@ void joystick_linux::joystick_vibration_start(int p_id, float p_weak_magnitude,
joy.ff_effect_timestamp = p_timestamp;
}
-void joystick_linux::joystick_vibration_stop(int p_id, uint64_t p_timestamp)
+void JoypadLinux::joypad_vibration_stop(int p_id, uint64_t p_timestamp)
{
- Joystick& joy = joysticks[p_id];
+ Joypad& joy = joypads[p_id];
if (!joy.force_feedback || joy.fd == -1 || joy.ff_effect_id == -1) {
return;
}
@@ -448,7 +447,7 @@ void joystick_linux::joystick_vibration_stop(int p_id, uint64_t p_timestamp)
joy.ff_effect_timestamp = p_timestamp;
}
-InputDefault::JoyAxis joystick_linux::axis_correct(const input_absinfo *p_abs, int p_value) const {
+InputDefault::JoyAxis JoypadLinux::axis_correct(const input_absinfo *p_abs, int p_value) const {
int min = p_abs->minimum;
int max = p_abs->maximum;
@@ -468,17 +467,17 @@ InputDefault::JoyAxis joystick_linux::axis_correct(const input_absinfo *p_abs, i
return jx;
}
-uint32_t joystick_linux::process_joysticks(uint32_t p_event_id) {
+uint32_t JoypadLinux::process_joypads(uint32_t p_event_id) {
if (joy_mutex->try_lock() != OK) {
return p_event_id;
}
- for (int i=0; i<JOYSTICKS_MAX; i++) {
+ for (int i=0; i<JOYPADS_MAX; i++) {
- if (joysticks[i].fd == -1) continue;
+ if (joypads[i].fd == -1) continue;
input_event events[32];
- Joystick* joy = &joysticks[i];
+ Joypad* joy = &joypads[i];
int len;
@@ -539,7 +538,7 @@ uint32_t joystick_linux::process_joysticks(uint32_t p_event_id) {
}
}
if (len == 0 || (len < 0 && errno != EAGAIN)) {
- close_joystick(i);
+ close_joypad(i);
};
if (joy->force_feedback) {
@@ -548,9 +547,9 @@ uint32_t joystick_linux::process_joysticks(uint32_t p_event_id) {
Vector2 strength = input->get_joy_vibration_strength(i);
float duration = input->get_joy_vibration_duration(i);
if (strength.x == 0 && strength.y == 0) {
- joystick_vibration_stop(i, timestamp);
+ joypad_vibration_stop(i, timestamp);
} else {
- joystick_vibration_start(i, strength.x, strength.y, duration, timestamp);
+ joypad_vibration_start(i, strength.x, strength.y, duration, timestamp);
}
}
}
diff --git a/platform/x11/joystick_linux.h b/platform/x11/joypad_linux.h
index 7ea2664ebb..18ad199f6b 100644
--- a/platform/x11/joystick_linux.h
+++ b/platform/x11/joypad_linux.h
@@ -1,11 +1,11 @@
/*************************************************************************/
-/* joystick_linux.h */
+/* joypad_linux.h */
/*************************************************************************/
/* This file is part of: */
/* 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 */
@@ -28,8 +28,9 @@
/*************************************************************************/
//author: Andreas Haas <hondres, liugam3@gmail.com>
-#ifndef JOYSTICK_LINUX_H
-#define JOYSTICK_LINUX_H
+#ifndef JOYPAD_LINUX_H
+#define JOYPAD_LINUX_H
+
#ifdef JOYDEV_ENABLED
#include "main/input_default.h"
#include "os/thread.h"
@@ -37,21 +38,21 @@
struct input_absinfo;
-class joystick_linux
+class JoypadLinux
{
public:
- joystick_linux(InputDefault *in);
- ~joystick_linux();
- uint32_t process_joysticks(uint32_t p_event_id);
+ JoypadLinux(InputDefault *in);
+ ~JoypadLinux();
+ uint32_t process_joypads(uint32_t p_event_id);
private:
enum {
- JOYSTICKS_MAX = 16,
+ JOYPADS_MAX = 16,
MAX_ABS = 63,
MAX_KEY = 767, // Hack because <linux/input.h> can't be included here
};
- struct Joystick {
+ struct Joypad {
InputDefault::JoyAxis curr_axis[MAX_ABS];
int key_map[MAX_KEY];
int abs_map[MAX_ABS];
@@ -65,8 +66,8 @@ private:
int ff_effect_id;
uint64_t ff_effect_timestamp;
- Joystick();
- ~Joystick();
+ Joypad();
+ ~Joypad();
void reset();
};
@@ -74,7 +75,7 @@ private:
Mutex *joy_mutex;
Thread *joy_thread;
InputDefault *input;
- Joystick joysticks[JOYSTICKS_MAX];
+ Joypad joypads[JOYPADS_MAX];
Vector<String> attached_devices;
static void joy_thread_func(void *p_user);
@@ -82,21 +83,21 @@ private:
int get_joy_from_path(String path) const;
int get_free_joy_slot() const;
- void setup_joystick_properties(int p_id);
- void close_joystick(int p_id = -1);
+ void setup_joypad_properties(int p_id);
+ void close_joypad(int p_id = -1);
#ifdef UDEV_ENABLED
- void enumerate_joysticks(struct udev *_udev);
- void monitor_joysticks(struct udev *_udev);
+ void enumerate_joypads(struct udev *_udev);
+ void monitor_joypads(struct udev *_udev);
#endif
- void monitor_joysticks();
- void run_joystick_thread();
- void open_joystick(const char* path);
+ void monitor_joypads();
+ void run_joypad_thread();
+ void open_joypad(const char* path);
- void joystick_vibration_start(int p_id, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp);
- void joystick_vibration_stop(int p_id, uint64_t p_timestamp);
+ void joypad_vibration_start(int p_id, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp);
+ void joypad_vibration_stop(int p_id, uint64_t p_timestamp);
InputDefault::JoyAxis axis_correct(const input_absinfo *abs, int value) const;
};
#endif
-#endif // JOYSTICK_LINUX_H
+#endif // JOYPAD_LINUX_H
diff --git a/platform/x11/key_mapping_x11.cpp b/platform/x11/key_mapping_x11.cpp
index 6443d14897..d25fe40c4d 100644
--- a/platform/x11/key_mapping_x11.cpp
+++ b/platform/x11/key_mapping_x11.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 */
@@ -90,8 +90,8 @@ static _XTranslatePair _xkeysym_to_keycode[]={
{ XK_Begin, KEY_CLEAR },
{ XK_Insert, KEY_INSERT },
{ XK_Delete, KEY_DELETE },
-// { XK_KP_Equal, KEY_EQUAL },
-// { XK_KP_Separator, KEY_COMMA },
+ //{ XK_KP_Equal, KEY_EQUAL },
+ //{ XK_KP_Separator, KEY_COMMA },
{ XK_KP_Decimal, KEY_KP_PERIOD },
{ XK_KP_Delete, KEY_KP_PERIOD },
{ XK_KP_Enter, KEY_KP_ENTER },
diff --git a/platform/x11/key_mapping_x11.h b/platform/x11/key_mapping_x11.h
index e3aede8388..9749b2ec2a 100644
--- a/platform/x11/key_mapping_x11.h
+++ b/platform/x11/key_mapping_x11.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/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 5f1ab5b4aa..8baeb8bc90 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.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 */
@@ -27,7 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "servers/visual/visual_server_raster.h"
-#include "drivers/gles2/rasterizer_gles2.h"
+#include "drivers/gles3/rasterizer_gles3.h"
#include "os_x11.h"
#include "key_mapping_x11.h"
#include <stdio.h>
@@ -74,7 +74,7 @@ int OS_X11::get_video_driver_count() const {
}
const char * OS_X11::get_video_driver_name(int p_driver) const {
- return "GLES2";
+ return "GLES3";
}
OS::VideoMode OS_X11::get_default_video_mode() const {
@@ -82,14 +82,14 @@ OS::VideoMode OS_X11::get_default_video_mode() const {
}
int OS_X11::get_audio_driver_count() const {
- return AudioDriverManagerSW::get_driver_count();
+ return AudioDriverManager::get_driver_count();
}
const char *OS_X11::get_audio_driver_name(int p_driver) const {
- AudioDriverSW* driver = AudioDriverManagerSW::get_driver(p_driver);
+ AudioDriver* driver = AudioDriverManager::get_driver(p_driver);
ERR_FAIL_COND_V( !driver, "" );
- return AudioDriverManagerSW::get_driver(p_driver)->get_name();
+ return AudioDriverManager::get_driver(p_driver)->get_name();
}
void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audio_driver) {
@@ -203,19 +203,22 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
//print_line("def videomode "+itos(current_videomode.width)+","+itos(current_videomode.height));
#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED)
- context_gl = memnew( ContextGL_X11( x11_display, x11_window,current_videomode, false ) );
+
+ context_gl = memnew( ContextGL_X11( x11_display, x11_window,current_videomode, true ) );
context_gl->initialize();
- rasterizer = memnew( RasterizerGLES2 );
+ RasterizerGLES3::register_config();
-#endif
- visual_server = memnew( VisualServerRaster(rasterizer) );
+ RasterizerGLES3::make_current();
+#endif
+ visual_server = memnew( VisualServerRaster );
+#if 0
if (get_render_thread_mode()!=RENDER_THREAD_UNSAFE) {
visual_server =memnew(VisualServerWrapMT(visual_server,get_render_thread_mode()==RENDER_SEPARATE_THREAD));
}
-
+#endif
// borderless fullscreen window mode
if (current_videomode.fullscreen) {
// needed for lxde/openbox, possibly others
@@ -266,21 +269,21 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
XFree(xsh);
}
- AudioDriverManagerSW::get_driver(p_audio_driver)->set_singleton();
+ AudioDriverManager::get_driver(p_audio_driver)->set_singleton();
audio_driver_index=p_audio_driver;
- if (AudioDriverManagerSW::get_driver(p_audio_driver)->init()!=OK) {
+ if (AudioDriverManager::get_driver(p_audio_driver)->init()!=OK) {
bool success=false;
audio_driver_index=-1;
- for(int i=0;i<AudioDriverManagerSW::get_driver_count();i++) {
+ for(int i=0;i<AudioDriverManager::get_driver_count();i++) {
if (i==p_audio_driver)
continue;
- AudioDriverManagerSW::get_driver(i)->set_singleton();
- if (AudioDriverManagerSW::get_driver(i)->init()==OK) {
+ AudioDriverManager::get_driver(i)->set_singleton();
+ if (AudioDriverManager::get_driver(i)->init()==OK) {
success=true;
- print_line("Audio Driver Failed: "+String(AudioDriverManagerSW::get_driver(p_audio_driver)->get_name()));
- print_line("Using alternate audio driver: "+String(AudioDriverManagerSW::get_driver(i)->get_name()));
+ print_line("Audio Driver Failed: "+String(AudioDriverManager::get_driver(p_audio_driver)->get_name()));
+ print_line("Using alternate audio driver: "+String(AudioDriverManager::get_driver(i)->get_name()));
audio_driver_index=i;
break;
}
@@ -291,13 +294,6 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
}
- sample_manager = memnew( SampleManagerMallocSW );
- audio_server = memnew( AudioServerSW(sample_manager) );
- audio_server->init();
- spatial_sound_server = memnew( SpatialSoundServerSW );
- spatial_sound_server->init();
- spatial_sound_2d_server = memnew( SpatialSound2DServerSW );
- spatial_sound_2d_server->init();
ERR_FAIL_COND(!visual_server);
@@ -455,7 +451,7 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
input = memnew( InputDefault );
#ifdef JOYDEV_ENABLED
- joystick = memnew( joystick_linux(input));
+ joypad = memnew( JoypadLinux(input));
#endif
_ensure_data_dir();
}
@@ -466,28 +462,22 @@ void OS_X11::finalize() {
memdelete(main_loop);
main_loop=NULL;
- spatial_sound_server->finish();
- memdelete(spatial_sound_server);
- spatial_sound_2d_server->finish();
- memdelete(spatial_sound_2d_server);
- //if (debugger_connection_console) {
-// memdelete(debugger_connection_console);
-//}
+ /*
+ if (debugger_connection_console) {
+ memdelete(debugger_connection_console);
+ }
+ */
#ifdef JOYDEV_ENABLED
- memdelete(joystick);
+ memdelete(joypad);
#endif
memdelete(input);
- memdelete(sample_manager);
-
- audio_server->finish();
- memdelete(audio_server);
visual_server->finish();
memdelete(visual_server);
- memdelete(rasterizer);
+ //memdelete(rasterizer);
physics_server->finish();
memdelete(physics_server);
@@ -556,11 +546,10 @@ void OS_X11::set_mouse_mode(MouseMode p_mode) {
}
}
- if (XGrabPointer(x11_display, x11_window, True,
- ButtonPressMask | ButtonReleaseMask |
- PointerMotionMask, GrabModeAsync, GrabModeAsync,
- x11_window, None, CurrentTime) !=
- GrabSuccess) {
+ if (XGrabPointer(
+ x11_display, x11_window, True,
+ ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
+ GrabModeAsync, GrabModeAsync, x11_window, None, CurrentTime) != GrabSuccess) {
ERR_PRINT("NO GRAB");
}
@@ -1301,10 +1290,10 @@ void OS_X11::process_xevents() {
minimized = false;
main_loop->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN);
if (mouse_mode==MOUSE_MODE_CAPTURED) {
- XGrabPointer(x11_display, x11_window, True,
- ButtonPressMask | ButtonReleaseMask |
- PointerMotionMask, GrabModeAsync, GrabModeAsync,
- x11_window, None, CurrentTime);
+ XGrabPointer(
+ x11_display, x11_window, True,
+ ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
+ GrabModeAsync, GrabModeAsync, x11_window, None, CurrentTime);
}
break;
@@ -1464,8 +1453,8 @@ void OS_X11::process_xevents() {
input->set_mouse_pos(pos);
motion_event.mouse_motion.global_x=pos.x;
motion_event.mouse_motion.global_y=pos.y;
- motion_event.mouse_motion.speed_x=input->get_mouse_speed().x;
- motion_event.mouse_motion.speed_y=input->get_mouse_speed().y;
+ motion_event.mouse_motion.speed_x=input->get_last_mouse_speed().x;
+ motion_event.mouse_motion.speed_y=input->get_last_mouse_speed().y;
motion_event.mouse_motion.relative_x=rel.x;
motion_event.mouse_motion.relative_y=rel.y;
@@ -1878,7 +1867,7 @@ void OS_X11::set_icon(const Image& p_icon) {
if (!p_icon.empty()) {
Image img=p_icon;
- img.convert(Image::FORMAT_RGBA);
+ img.convert(Image::FORMAT_RGBA8);
int w = img.get_width();
int h = img.get_height();
@@ -1891,7 +1880,7 @@ void OS_X11::set_icon(const Image& p_icon) {
pd[0]=w;
pd[1]=h;
- DVector<uint8_t>::Read r = img.get_data().read();
+ PoolVector<uint8_t>::Read r = img.get_data().read();
long * wr = &pd[2];
uint8_t const * pr = r.ptr();
@@ -1920,16 +1909,16 @@ void OS_X11::run() {
main_loop->init();
-// uint64_t last_ticks=get_ticks_usec();
+ //uint64_t last_ticks=get_ticks_usec();
-// int frames=0;
-// uint64_t frame=0;
+ //int frames=0;
+ //uint64_t frame=0;
while (!force_quit) {
process_xevents(); // get rid of pending events
#ifdef JOYDEV_ENABLED
- event_id = joystick->process_joysticks(event_id);
+ event_id = joypad->process_joypads(event_id);
#endif
if (Main::iteration()==true)
break;
@@ -1951,7 +1940,7 @@ void OS_X11::set_use_vsync(bool p_enable) {
return context_gl->set_use_vsync(p_enable);
}
-bool OS_X11::is_vsnc_enabled() const {
+bool OS_X11::is_vsync_enabled() const {
if (context_gl)
return context_gl->is_using_vsync();
@@ -1979,17 +1968,22 @@ void OS_X11::set_context(int p_context) {
OS_X11::OS_X11() {
#ifdef RTAUDIO_ENABLED
- AudioDriverManagerSW::add_driver(&driver_rtaudio);
+ AudioDriverManager::add_driver(&driver_rtaudio);
#endif
#ifdef PULSEAUDIO_ENABLED
- AudioDriverManagerSW::add_driver(&driver_pulseaudio);
+ AudioDriverManager::add_driver(&driver_pulseaudio);
#endif
#ifdef ALSA_ENABLED
- AudioDriverManagerSW::add_driver(&driver_alsa);
+ AudioDriverManager::add_driver(&driver_alsa);
#endif
+ if(AudioDriverManager::get_driver_count() == 0){
+ WARN_PRINT("No sound driver found... Defaulting to dummy driver");
+ AudioDriverManager::add_driver(&driver_dummy);
+ }
+
minimized = false;
xim_style=0L;
mouse_mode=MOUSE_MODE_VISIBLE;
diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h
index b27f71406a..3245df32c6 100644
--- a/platform/x11/os_x11.h
+++ b/platform/x11/os_x11.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 */
@@ -34,20 +34,18 @@
#include "drivers/unix/os_unix.h"
#include "context_gl_x11.h"
#include "servers/visual_server.h"
-#include "servers/visual/visual_server_wrap_mt.h"
+//#include "servers/visual/visual_server_wrap_mt.h"
#include "servers/visual/rasterizer.h"
#include "servers/physics_server.h"
-#include "servers/audio/audio_server_sw.h"
-#include "servers/audio/sample_manager_sw.h"
-#include "servers/spatial_sound/spatial_sound_server_sw.h"
-#include "servers/spatial_sound_2d/spatial_sound_2d_server_sw.h"
+#include "servers/audio_server.h"
#include "drivers/rtaudio/audio_driver_rtaudio.h"
#include "drivers/alsa/audio_driver_alsa.h"
#include "drivers/pulseaudio/audio_driver_pulseaudio.h"
+#include "servers/audio/audio_driver_dummy.h"
#include "servers/physics_2d/physics_2d_server_sw.h"
#include "servers/physics_2d/physics_2d_server_wrap_mt.h"
#include "main/input_default.h"
-#include "joystick_linux.h"
+#include "joypad_linux.h"
#include <X11/keysym.h>
#include <X11/Xlib.h>
@@ -99,7 +97,7 @@ class OS_X11 : public OS_Unix {
#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED)
ContextGL_X11 *context_gl;
#endif
- Rasterizer *rasterizer;
+ //Rasterizer *rasterizer;
VisualServer *visual_server;
VideoMode current_videomode;
List<String> args;
@@ -134,11 +132,6 @@ class OS_X11 : public OS_Unix {
virtual void delete_main_loop();
IP_Unix *ip_unix;
- AudioServerSW *audio_server;
- SampleManagerMallocSW *sample_manager;
- SpatialSoundServerSW *spatial_sound_server;
- SpatialSound2DServerSW *spatial_sound_2d_server;
-
bool force_quit;
bool minimized;
@@ -154,7 +147,7 @@ class OS_X11 : public OS_Unix {
InputDefault *input;
#ifdef JOYDEV_ENABLED
- joystick_linux *joystick;
+ JoypadLinux *joypad;
#endif
#ifdef RTAUDIO_ENABLED
@@ -168,6 +161,7 @@ class OS_X11 : public OS_Unix {
#ifdef PULSEAUDIO_ENABLED
AudioDriverPulseAudio driver_pulseaudio;
#endif
+ AudioDriverDummy driver_dummy;
Atom net_wm_icon;
@@ -264,7 +258,7 @@ public:
virtual void set_context(int p_context);
virtual void set_use_vsync(bool p_enable);
- virtual bool is_vsnc_enabled() const;
+ virtual bool is_vsync_enabled() const;
void run();
diff --git a/platform/x11/platform_config.h b/platform/x11/platform_config.h
index 015953157d..342270b74a 100644
--- a/platform/x11/platform_config.h
+++ b/platform/x11/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 */
@@ -34,4 +34,4 @@
#define PTHREAD_BSD_SET_NAME
#endif
-#define GLES2_INCLUDE_H "GL/glew.h"
+#define GLES3_INCLUDE_H "glad/glad.h"