summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
Diffstat (limited to 'platform')
-rw-r--r--platform/android/AndroidManifest.xml.template2
-rw-r--r--platform/android/SCsub6
-rw-r--r--platform/android/android_native_app_glue.h31
-rw-r--r--platform/android/build.gradle.template12
-rw-r--r--platform/android/detect.py6
-rw-r--r--platform/android/export/export.cpp379
-rw-r--r--platform/android/export/export.h30
-rw-r--r--platform/android/globals/global_defaults.cpp29
-rw-r--r--platform/android/globals/global_defaults.h32
-rw-r--r--platform/android/godot_android.cpp31
-rw-r--r--platform/android/java/res/drawable/icon.pngbin12574 -> 12525 bytes
-rw-r--r--platform/android/java/res/layout/downloading_expansion.xml2
-rw-r--r--platform/android/java/res/values-fa/strings.xml1
-rw-r--r--platform/android/java/src/com/android/vending/licensing/LicenseChecker.java6
-rw-r--r--platform/android/java/src/com/google/android/vending/expansion/downloader/Constants.java6
-rw-r--r--platform/android/java/src/com/google/android/vending/expansion/downloader/Helpers.java5
-rw-r--r--platform/android/java/src/com/google/android/vending/expansion/downloader/impl/CustomNotificationFactory.java2
-rw-r--r--platform/android/java/src/com/google/android/vending/expansion/downloader/impl/DownloadNotification.java45
-rw-r--r--platform/android/java/src/com/google/android/vending/expansion/downloader/impl/V14CustomNotification.java10
-rw-r--r--platform/android/java/src/com/google/android/vending/expansion/downloader/impl/V3CustomNotification.java116
-rw-r--r--platform/android/java/src/org/godotengine/godot/Dictionary.java2
-rw-r--r--platform/android/java/src/org/godotengine/godot/Godot.java15
-rw-r--r--platform/android/java/src/org/godotengine/godot/GodotDownloaderAlarmReceiver.java28
-rw-r--r--platform/android/java/src/org/godotengine/godot/GodotDownloaderService.java28
-rw-r--r--platform/android/java/src/org/godotengine/godot/GodotLib.java1
-rw-r--r--platform/android/java/src/org/godotengine/godot/GodotPaymentV3.java28
-rw-r--r--platform/android/java/src/org/godotengine/godot/input/GodotEditText.java28
-rw-r--r--platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java28
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/ConsumeTask.java28
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/GenericConsumeTask.java28
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/HandlePurchaseTask.java28
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/PaymentsCache.java28
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java28
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/PurchaseTask.java28
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/ReleaseAllConsumablesTask.java28
-rw-r--r--platform/android/java/src/org/godotengine/godot/payments/ValidateTask.java28
-rw-r--r--platform/android/java/src/org/godotengine/godot/utils/Crypt.java28
-rw-r--r--platform/android/java/src/org/godotengine/godot/utils/CustomSSLSocketFactory.java30
-rw-r--r--platform/android/java/src/org/godotengine/godot/utils/HttpRequester.java28
-rw-r--r--platform/android/java/src/org/godotengine/godot/utils/RequestParams.java28
-rw-r--r--platform/android/java_bind.cpp5
-rw-r--r--platform/android/java_bind.h10
-rw-r--r--platform/android/java_class_wrapper.cpp28
-rw-r--r--platform/android/java_class_wrapper.h28
-rw-r--r--platform/android/java_glue.cpp11
-rw-r--r--platform/android/java_glue.h1
-rw-r--r--platform/android/os_android.cpp5
-rw-r--r--platform/android/os_android.h1
-rw-r--r--platform/bb10/bbutil.h28
-rw-r--r--platform/bb10/export/export.cpp150
-rw-r--r--platform/bb10/export/export.h30
-rw-r--r--platform/haiku/context_gl_haiku.cpp28
-rw-r--r--platform/haiku/context_gl_haiku.h28
-rw-r--r--platform/haiku/detect.py7
-rw-r--r--platform/haiku/godot_haiku.cpp28
-rw-r--r--platform/haiku/haiku_application.cpp28
-rw-r--r--platform/haiku/haiku_application.h28
-rw-r--r--platform/haiku/haiku_direct_window.cpp28
-rw-r--r--platform/haiku/haiku_direct_window.h28
-rw-r--r--platform/haiku/haiku_gl_view.cpp28
-rw-r--r--platform/haiku/haiku_gl_view.h28
-rw-r--r--platform/haiku/key_mapping_haiku.cpp28
-rw-r--r--platform/haiku/key_mapping_haiku.h28
-rw-r--r--platform/haiku/os_haiku.cpp28
-rw-r--r--platform/haiku/os_haiku.h28
-rw-r--r--platform/haiku/platform_config.h28
-rw-r--r--platform/iphone/Appirater.h29
-rwxr-xr-xplatform/iphone/globals/global_defaults.cpp29
-rw-r--r--platform/iphone/globals/global_defaults.h32
-rw-r--r--platform/iphone/ios.h28
-rw-r--r--platform/iphone/ios.mm28
-rw-r--r--platform/iphone/main.m28
-rw-r--r--platform/iphone/platform_refcount.h28
-rw-r--r--platform/iphone/rasterizer_iphone.cpp26
-rw-r--r--platform/javascript/audio_server_javascript.cpp28
-rw-r--r--platform/javascript/audio_server_javascript.h28
-rw-r--r--platform/javascript/detect.py3
-rw-r--r--platform/javascript/dom_keys.h30
-rw-r--r--platform/osx/detect.py19
-rw-r--r--platform/osx/dir_access_osx.h46
-rw-r--r--platform/osx/dir_access_osx.mm309
-rw-r--r--platform/osx/export/export.cpp37
-rw-r--r--platform/osx/export/export.h30
-rw-r--r--platform/osx/os_osx.h19
-rw-r--r--platform/osx/os_osx.mm185
-rw-r--r--platform/osx/platform_config.h3
-rw-r--r--platform/server/platform_config.h1
-rw-r--r--platform/windows/context_gl_win.cpp17
-rw-r--r--platform/windows/context_gl_win.h8
-rw-r--r--platform/windows/detect.py14
-rw-r--r--platform/windows/export/export.cpp28
-rw-r--r--platform/windows/export/export.h31
-rw-r--r--platform/windows/godot.icobin370070 -> 370070 bytes
-rw-r--r--platform/windows/os_windows.cpp138
-rw-r--r--platform/windows/os_windows.h8
-rw-r--r--platform/windows/packet_peer_udp_winsock.cpp28
-rw-r--r--platform/windows/packet_peer_udp_winsock.h28
-rw-r--r--platform/windows/platform_config.h2
-rw-r--r--platform/winrt/gl_context_egl.cpp28
-rw-r--r--platform/winrt/gl_context_egl.h28
-rw-r--r--platform/winrt/os_winrt.cpp2
-rw-r--r--platform/winrt/os_winrt.h2
-rw-r--r--platform/winrt/platform_config.h29
-rw-r--r--platform/winrt/thread_winrt.cpp28
-rw-r--r--platform/winrt/thread_winrt.h28
-rw-r--r--platform/x11/context_gl_x11.cpp38
-rw-r--r--platform/x11/context_gl_x11.h4
-rw-r--r--platform/x11/detect.py18
-rw-r--r--platform/x11/export/export.cpp28
-rw-r--r--platform/x11/export/export.h31
-rw-r--r--platform/x11/joystick_linux.cpp74
-rw-r--r--platform/x11/joystick_linux.h7
-rw-r--r--platform/x11/os_x11.cpp254
-rw-r--r--platform/x11/os_x11.h37
-rw-r--r--platform/x11/platform_config.h2
115 files changed, 2928 insertions, 921 deletions
diff --git a/platform/android/AndroidManifest.xml.template b/platform/android/AndroidManifest.xml.template
index 37dee4a9a5..852a821c65 100644
--- a/platform/android/AndroidManifest.xml.template
+++ b/platform/android/AndroidManifest.xml.template
@@ -200,6 +200,6 @@ $$ADD_PERMISSION_CHUNKS$$
<uses-permission android:name="godot.custom.18"/>
<uses-permission android:name="godot.custom.19"/>
-<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19"/>
+<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="23"/>
</manifest>
diff --git a/platform/android/SCsub b/platform/android/SCsub
index fab8458b26..c8feac8690 100644
--- a/platform/android/SCsub
+++ b/platform/android/SCsub
@@ -65,17 +65,17 @@ for x in env.android_java_dirs:
gradle_res_dirs_text=""
for x in env.android_res_dirs:
- gradle_res_dirs_text+=",'"+x+"'"
+ gradle_res_dirs_text+=",'"+x.replace("\\","/")+"'"
gradle_aidl_dirs_text=""
for x in env.android_aidl_dirs:
- gradle_aidl_dirs_text+=",'"+x+"'"
+ gradle_aidl_dirs_text+=",'"+x.replace("\\","/")+"'"
gradle_jni_dirs_text=""
for x in env.android_jni_dirs:
- gradle_jni_dirs_text+=",'"+x+"'"
+ gradle_jni_dirs_text+=",'"+x.replace("\\","/")+"'"
gradle_asset_dirs_text=""
diff --git a/platform/android/android_native_app_glue.h b/platform/android/android_native_app_glue.h
index 3e7a4ea7a0..36278d4c66 100644
--- a/platform/android/android_native_app_glue.h
+++ b/platform/android/android_native_app_glue.h
@@ -1,32 +1,5 @@
-/*************************************************************************/
-/* android_native_app_glue.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-/* Copyright (C) 2010 The Android Open Source Project
+/*
+ * Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/platform/android/build.gradle.template b/platform/android/build.gradle.template
index 9461cd2e99..b0630d9a3a 100644
--- a/platform/android/build.gradle.template
+++ b/platform/android/build.gradle.template
@@ -3,7 +3,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.2.0'
+ classpath 'com.android.tools.build:gradle:1.3.1'
}
}
@@ -17,7 +17,7 @@ allprojects {
}
dependencies {
-
+ compile 'com.android.support:support-v4:23.+' // can be removed if minSdkVersion 16 and modify DownloadNotification.java & V14CustomNotification.java
$$GRADLE_DEPENDENCIES$$
}
@@ -25,10 +25,12 @@ android {
lintOptions {
abortOnError false
+ disable 'MissingTranslation'
}
- compileSdkVersion 19
- buildToolsVersion "19.1"
+ compileSdkVersion 23
+ buildToolsVersion "23.0.3"
+ useLibrary 'org.apache.http.legacy'
packagingOptions {
exclude 'META-INF/LICENSE'
@@ -36,7 +38,7 @@ android {
}
defaultConfig {
minSdkVersion 14
- targetSdkVersion 19
+ targetSdkVersion 23
}
sourceSets {
main {
diff --git a/platform/android/detect.py b/platform/android/detect.py
index 11b14eb989..ba6b73a89f 100644
--- a/platform/android/detect.py
+++ b/platform/android/detect.py
@@ -168,11 +168,11 @@ def configure(env):
env['neon_enabled']=False
if env['android_arch']=='x86':
- env['CCFLAGS'] = string.split('-DNO_STATVFS -MMD -MP -MF -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')
+ env['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['CCFLAGS'] = string.split('-DNO_STATVFS -MMD -MP -MF -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')
+ env['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['CCFLAGS'] = string.split('-DNO_STATVFS -MMD -MP -MF -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')
+ env['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__'])
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index bd63cadc57..b8c44a4fc8 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* export.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#include "version.h"
#include "export.h"
#include "tools/editor/editor_settings.h"
@@ -9,6 +37,7 @@
#include "os/file_access.h"
#include "os/os.h"
#include "platform/android/logo.h"
+#include <string.h>
static const char* android_perms[]={
@@ -231,6 +260,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
void _fix_manifest(Vector<uint8_t>& p_manifest, bool p_give_internet);
void _fix_resources(Vector<uint8_t>& p_manifest);
static Error save_apk_file(void *p_userdata,const String& p_path, const Vector<uint8_t>& p_data,int p_file,int p_total);
+ static bool _should_compress_asset(const String& p_path, const Vector<uint8_t>& p_data);
protected:
@@ -1001,7 +1031,7 @@ Error EditorExportPlatformAndroid::save_apk_file(void *p_userdata,const String&
NULL,
0,
NULL,
- Z_DEFLATED,
+ _should_compress_asset(p_path,p_data) ? Z_DEFLATED : 0,
Z_DEFAULT_COMPRESSION);
@@ -1012,13 +1042,58 @@ Error EditorExportPlatformAndroid::save_apk_file(void *p_userdata,const String&
}
+bool EditorExportPlatformAndroid::_should_compress_asset(const String& p_path, const Vector<uint8_t>& p_data) {
+
+ /*
+ * By not compressing files with little or not benefit in doing so,
+ * a performance gain is expected at runtime. Moreover, if the APK is
+ * zip-aligned, assets stored as they are can be efficiently read by
+ * Android by memory-mapping them.
+ */
+
+ // -- Unconditional uncompress to mimic AAPT plus some other
+
+ static const char* unconditional_compress_ext[] = {
+ // From https://github.com/android/platform_frameworks_base/blob/master/tools/aapt/Package.cpp
+ // These formats are already compressed, or don't compress well:
+ ".jpg", ".jpeg", ".png", ".gif",
+ ".wav", ".mp2", ".mp3", ".ogg", ".aac",
+ ".mpg", ".mpeg", ".mid", ".midi", ".smf", ".jet",
+ ".rtttl", ".imy", ".xmf", ".mp4", ".m4a",
+ ".m4v", ".3gp", ".3gpp", ".3g2", ".3gpp2",
+ ".amr", ".awb", ".wma", ".wmv",
+ // Godot-specific:
+ ".webp", // Same reasoning as .png
+ ".cfb", // Don't let small config files slow-down startup
+ // Trailer for easier processing
+ NULL
+ };
+
+ for (const char** ext=unconditional_compress_ext; *ext; ++ext) {
+ if (p_path.to_lower().ends_with(String(*ext))) {
+ return false;
+ }
+ }
+
+ // -- Compressed resource?
+
+ if (p_data.size() >= 4 && p_data[0]=='R' && p_data[1]=='S' && p_data[2]=='C' && p_data[3]=='C') {
+ // Already compressed
+ return false;
+ }
+
+ // --- TODO: Decide on texture resources according to their image compression setting
+
+ return true;
+}
+
Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_debug, int p_flags) {
String src_apk;
- EditorProgress ep("export","Exporting for Android",104);
+ EditorProgress ep("export","Exporting for Android",105);
if (p_debug)
src_apk=custom_debug_package;
@@ -1058,7 +1133,8 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
zlib_filefunc_def io2=io;
FileAccess *dst_f=NULL;
io2.opaque=&dst_f;
- zipFile apk=zipOpen2(p_path.utf8().get_data(),APPEND_STATUS_CREATE,NULL,&io2);
+ String unaligned_path=EditorSettings::get_singleton()->get_settings_path()+"/tmp/tmpexport-unaligned.apk";
+ zipFile unaligned_apk=zipOpen2(unaligned_path.utf8().get_data(),APPEND_STATUS_CREATE,NULL,&io2);
while(ret==UNZ_OK) {
@@ -1137,7 +1213,11 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
print_line("ADDING: "+file);
if (!skip) {
- zipOpenNewFileInZip(apk,
+
+ // Respect decision on compression made by AAPT for the export template
+ const bool uncompressed = info.compression_method == 0;
+
+ zipOpenNewFileInZip(unaligned_apk,
file.utf8().get_data(),
NULL,
NULL,
@@ -1145,11 +1225,11 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
NULL,
0,
NULL,
- Z_DEFLATED,
+ uncompressed ? 0 : Z_DEFLATED,
Z_DEFAULT_COMPRESSION);
- zipWriteInFileInZip(apk,data.ptr(),data.size());
- zipCloseFileInZip(apk);
+ zipWriteInFileInZip(unaligned_apk,data.ptr(),data.size());
+ zipCloseFileInZip(unaligned_apk);
}
ret = unzGoToNextFile(pkg);
@@ -1206,7 +1286,7 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
APKExportData ed;
ed.ep=&ep;
- ed.apk=apk;
+ ed.apk=unaligned_apk;
err = export_project_files(save_apk_file,&ed,false);
}
@@ -1235,7 +1315,7 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
print_line(itos(i)+" param: "+cl[i]);
}
- zipOpenNewFileInZip(apk,
+ zipOpenNewFileInZip(unaligned_apk,
"assets/_cl_",
NULL,
NULL,
@@ -1243,15 +1323,15 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
NULL,
0,
NULL,
- Z_DEFLATED,
+ 0, // No compress (little size gain and potentially slower startup)
Z_DEFAULT_COMPRESSION);
- zipWriteInFileInZip(apk,clf.ptr(),clf.size());
- zipCloseFileInZip(apk);
+ zipWriteInFileInZip(unaligned_apk,clf.ptr(),clf.size());
+ zipCloseFileInZip(unaligned_apk);
}
- zipClose(apk,NULL);
+ zipClose(unaligned_apk,NULL);
unzClose(pkg);
if (err) {
@@ -1308,7 +1388,7 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
args.push_back(keystore);
args.push_back("-storepass");
args.push_back(password);
- args.push_back(p_path);
+ args.push_back(unaligned_path);
args.push_back(user);
int retval;
int err = OS::get_singleton()->execute(jarsigner,args,true,NULL,NULL,&retval);
@@ -1321,16 +1401,102 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
args.clear();
args.push_back("-verify");
- args.push_back(p_path);
+ args.push_back(unaligned_path);
args.push_back("-verbose");
err = OS::get_singleton()->execute(jarsigner,args,true,NULL,NULL,&retval);
if (retval) {
- EditorNode::add_io_error("'jarsigner' verificaiton of APK failed. Make sure to use jarsigner from Java 6.");
+ EditorNode::add_io_error("'jarsigner' verification of APK failed. Make sure to use jarsigner from Java 6.");
return ERR_CANT_CREATE;
}
}
+
+
+
+ // Let's zip-align (must be done after signing)
+
+ static const int ZIP_ALIGNMENT = 4;
+
+ ep.step("Aligning APK..",105);
+
+ unzFile tmp_unaligned = unzOpen2(unaligned_path.utf8().get_data(), &io);
+ if (!tmp_unaligned) {
+
+ EditorNode::add_io_error("Could not find temp unaligned APK.");
+ return ERR_FILE_NOT_FOUND;
+ }
+
+ ERR_FAIL_COND_V(!tmp_unaligned, ERR_CANT_OPEN);
+ ret = unzGoToFirstFile(tmp_unaligned);
+
+ io2=io;
+ dst_f=NULL;
+ io2.opaque=&dst_f;
+ zipFile final_apk=zipOpen2(p_path.utf8().get_data(),APPEND_STATUS_CREATE,NULL,&io2);
+
+ // Take files from the unaligned APK and write them out to the aligned one
+ // in raw mode, i.e. not uncompressing and recompressing, aligning them as needed,
+ // following what is done in https://github.com/android/platform_build/blob/master/tools/zipalign/ZipAlign.cpp
+ int bias = 0;
+ while(ret==UNZ_OK) {
+
+ unz_file_info info;
+ memset(&info, 0, sizeof(info));
+
+ char fname[16384];
+ char extra[16384];
+ ret = unzGetCurrentFileInfo(tmp_unaligned,&info,fname,16384,extra,16384-ZIP_ALIGNMENT,NULL,0);
+
+ String file=fname;
+
+ Vector<uint8_t> data;
+ data.resize(info.compressed_size);
+
+ // read
+ int method, level;
+ unzOpenCurrentFile2(tmp_unaligned, &method, &level, 1); // raw read
+ long file_offset = unzGetCurrentFileZStreamPos64(tmp_unaligned);
+ unzReadCurrentFile(tmp_unaligned,data.ptr(),data.size());
+ unzCloseCurrentFile(tmp_unaligned);
+
+ // align
+ int padding = 0;
+ if (!info.compression_method) {
+ // Uncompressed file => Align
+ long new_offset = file_offset + bias;
+ padding = (ZIP_ALIGNMENT - (new_offset % ZIP_ALIGNMENT)) % ZIP_ALIGNMENT;
+ }
+
+ memset(extra + info.size_file_extra, 0, padding);
+
+ // write
+ zipOpenNewFileInZip2(final_apk,
+ file.utf8().get_data(),
+ NULL,
+ extra,
+ info.size_file_extra + padding,
+ NULL,
+ 0,
+ NULL,
+ method,
+ level,
+ 1); // raw write
+ zipWriteInFileInZip(final_apk,data.ptr(),data.size());
+ zipCloseFileInZipRaw(final_apk,info.uncompressed_size,info.crc);
+
+ bias += padding;
+
+ ret = unzGoToNextFile(tmp_unaligned);
+ }
+
+ zipClose(final_apk,NULL);
+ unzClose(tmp_unaligned);
+
+ if (err) {
+ return err;
+ }
+
return OK;
}
@@ -1377,120 +1543,125 @@ void EditorExportPlatformAndroid::_device_poll_thread(void *ud) {
while(!ea->quit_request) {
String adb=EditorSettings::get_singleton()->get("android/adb");
- if (!FileAccess::exists(adb)) {
- OS::get_singleton()->delay_usec(3000000);
- continue; //adb not configured
- }
-
- String devices;
- List<String> args;
- args.push_back("devices");
- int ec;
- Error err = OS::get_singleton()->execute(adb,args,true,NULL,&devices,&ec);
- Vector<String> ds = devices.split("\n");
- Vector<String> ldevices;
- for(int i=1;i<ds.size();i++) {
-
- String d = ds[i];
- int dpos = d.find("device");
- if (dpos==-1)
- continue;
- d=d.substr(0,dpos).strip_edges();
-// print_line("found devuce: "+d);
- ldevices.push_back(d);
- }
+ if (FileAccess::exists(adb)) {
+
+ String devices;
+ List<String> args;
+ args.push_back("devices");
+ int ec;
+ Error err = OS::get_singleton()->execute(adb,args,true,NULL,&devices,&ec);
+ Vector<String> ds = devices.split("\n");
+ Vector<String> ldevices;
+ for(int i=1;i<ds.size();i++) {
+
+ String d = ds[i];
+ int dpos = d.find("device");
+ if (dpos==-1)
+ continue;
+ d=d.substr(0,dpos).strip_edges();
+ // print_line("found devuce: "+d);
+ ldevices.push_back(d);
+ }
- ea->device_lock->lock();
+ ea->device_lock->lock();
- bool different=false;
+ bool different=false;
- if (devices.size()!=ldevices.size()) {
+ if (devices.size()!=ldevices.size()) {
- different=true;
- } else {
+ different=true;
+ } else {
- for(int i=0;i<ea->devices.size();i++) {
+ for(int i=0;i<ea->devices.size();i++) {
- if (ea->devices[i].id!=ldevices[i]) {
- different=true;
- break;
+ if (ea->devices[i].id!=ldevices[i]) {
+ different=true;
+ break;
+ }
}
}
- }
- if (different) {
+ if (different) {
- Vector<Device> ndevices;
+ Vector<Device> ndevices;
- for(int i=0;i<ldevices.size();i++) {
+ for(int i=0;i<ldevices.size();i++) {
- Device d;
- d.id=ldevices[i];
- for(int j=0;j<ea->devices.size();j++) {
- if (ea->devices[j].id==ldevices[i]) {
- d.description=ea->devices[j].description;
- d.name=ea->devices[j].name;
+ Device d;
+ d.id=ldevices[i];
+ for(int j=0;j<ea->devices.size();j++) {
+ if (ea->devices[j].id==ldevices[i]) {
+ d.description=ea->devices[j].description;
+ d.name=ea->devices[j].name;
+ }
}
- }
- if (d.description=="") {
- //in the oven, request!
- args.clear();
- args.push_back("-s");
- args.push_back(d.id);
- args.push_back("shell");
- args.push_back("cat");
- args.push_back("/system/build.prop");
- int ec;
- String dp;
-
- Error err = OS::get_singleton()->execute(adb,args,true,NULL,&dp,&ec);
- print_line("RV: "+itos(ec));
- Vector<String> props = dp.split("\n");
- String vendor;
- String device;
- d.description+"Device ID: "+d.id+"\n";
- for(int j=0;j<props.size();j++) {
-
- String p = props[j];
- if (p.begins_with("ro.product.model=")) {
- device=p.get_slice("=",1).strip_edges();
- } else if (p.begins_with("ro.product.brand=")) {
- vendor=p.get_slice("=",1).strip_edges().capitalize();
- } else if (p.begins_with("ro.build.display.id=")) {
- d.description+="Build: "+p.get_slice("=",1).strip_edges()+"\n";
- } else if (p.begins_with("ro.build.version.release=")) {
- d.description+="Release: "+p.get_slice("=",1).strip_edges()+"\n";
- } else if (p.begins_with("ro.product.cpu.abi=")) {
- d.description+="CPU: "+p.get_slice("=",1).strip_edges()+"\n";
- } else if (p.begins_with("ro.product.manufacturer=")) {
- d.description+="Manufacturer: "+p.get_slice("=",1).strip_edges()+"\n";
- } else if (p.begins_with("ro.board.platform=")) {
- d.description+="Chipset: "+p.get_slice("=",1).strip_edges()+"\n";
- } else if (p.begins_with("ro.opengles.version=")) {
- uint32_t opengl = p.get_slice("=",1).to_int();
- d.description+="OpenGL: "+itos(opengl>>16)+"."+itos((opengl>>8)&0xFF)+"."+itos((opengl)&0xFF)+"\n";
+ if (d.description=="") {
+ //in the oven, request!
+ args.clear();
+ args.push_back("-s");
+ args.push_back(d.id);
+ args.push_back("shell");
+ args.push_back("cat");
+ args.push_back("/system/build.prop");
+ int ec;
+ String dp;
+
+ Error err = OS::get_singleton()->execute(adb,args,true,NULL,&dp,&ec);
+ print_line("RV: "+itos(ec));
+ Vector<String> props = dp.split("\n");
+ String vendor;
+ String device;
+ d.description+"Device ID: "+d.id+"\n";
+ for(int j=0;j<props.size();j++) {
+
+ String p = props[j];
+ if (p.begins_with("ro.product.model=")) {
+ device=p.get_slice("=",1).strip_edges();
+ } else if (p.begins_with("ro.product.brand=")) {
+ vendor=p.get_slice("=",1).strip_edges().capitalize();
+ } else if (p.begins_with("ro.build.display.id=")) {
+ d.description+="Build: "+p.get_slice("=",1).strip_edges()+"\n";
+ } else if (p.begins_with("ro.build.version.release=")) {
+ d.description+="Release: "+p.get_slice("=",1).strip_edges()+"\n";
+ } else if (p.begins_with("ro.product.cpu.abi=")) {
+ d.description+="CPU: "+p.get_slice("=",1).strip_edges()+"\n";
+ } else if (p.begins_with("ro.product.manufacturer=")) {
+ d.description+="Manufacturer: "+p.get_slice("=",1).strip_edges()+"\n";
+ } else if (p.begins_with("ro.board.platform=")) {
+ d.description+="Chipset: "+p.get_slice("=",1).strip_edges()+"\n";
+ } else if (p.begins_with("ro.opengles.version=")) {
+ uint32_t opengl = p.get_slice("=",1).to_int();
+ d.description+="OpenGL: "+itos(opengl>>16)+"."+itos((opengl>>8)&0xFF)+"."+itos((opengl)&0xFF)+"\n";
+ }
}
+
+ d.name=vendor+" "+device;
+ // print_line("name: "+d.name);
+ // print_line("description: "+d.description);
+
}
- d.name=vendor+" "+device;
-// print_line("name: "+d.name);
-// print_line("description: "+d.description);
+ ndevices.push_back(d);
}
- ndevices.push_back(d);
-
+ ea->devices=ndevices;
+ ea->devices_changed=true;
}
- ea->devices=ndevices;
- ea->devices_changed=true;
+ ea->device_lock->unlock();
}
- ea->device_lock->unlock();
+ uint64_t wait = 3000000;
+ uint64_t time = OS::get_singleton()->get_ticks_usec();
+ while(OS::get_singleton()->get_ticks_usec() - time < wait ) {
+ OS::get_singleton()->delay_usec(1000);
+ if (ea->quit_request)
+ break;
+ }
- OS::get_singleton()->delay_usec(3000000);
}
if (EditorSettings::get_singleton()->get("android/shutdown_adb_on_exit")) {
diff --git a/platform/android/export/export.h b/platform/android/export/export.h
index 88581802b8..a9421e692e 100644
--- a/platform/android/export/export.h
+++ b/platform/android/export/export.h
@@ -1,3 +1,29 @@
-
-
+/*************************************************************************/
+/* export.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
void register_android_exporter();
diff --git a/platform/android/globals/global_defaults.cpp b/platform/android/globals/global_defaults.cpp
index 824a4e3606..9a4252bde0 100644
--- a/platform/android/globals/global_defaults.cpp
+++ b/platform/android/globals/global_defaults.cpp
@@ -1,4 +1,31 @@
-
+/*************************************************************************/
+/* global_defaults.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#include "global_defaults.h"
#include "globals.h"
diff --git a/platform/android/globals/global_defaults.h b/platform/android/globals/global_defaults.h
index 64eb26c482..6f240572d8 100644
--- a/platform/android/globals/global_defaults.h
+++ b/platform/android/globals/global_defaults.h
@@ -1,3 +1,29 @@
-
-
-void register_android_global_defaults(); \ No newline at end of file
+/*************************************************************************/
+/* global_defaults.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+void register_android_global_defaults();
diff --git a/platform/android/godot_android.cpp b/platform/android/godot_android.cpp
index f9feb3481f..edb051575f 100644
--- a/platform/android/godot_android.cpp
+++ b/platform/android/godot_android.cpp
@@ -313,6 +313,7 @@ struct engine {
ASensorManager* sensorManager;
const ASensor* accelerometerSensor;
+ const ASensor* magnetometerSensor;
ASensorEventQueue* sensorEventQueue;
bool display_active;
@@ -736,15 +737,28 @@ static void engine_handle_cmd(struct android_app* app, int32_t cmd) {
engine->accelerometerSensor, (1000L/60)*1000);
}
+ // Also start monitoring the magnetometer.
+ if (engine->magnetometerSensor != NULL) {
+ ASensorEventQueue_enableSensor(engine->sensorEventQueue,
+ engine->magnetometerSensor);
+ // We'd like to get 60 events per second (in us).
+ ASensorEventQueue_setEventRate(engine->sensorEventQueue,
+ engine->magnetometerSensor, (1000L/60)*1000);
+
+ }
engine->animating = 1;
break;
case APP_CMD_LOST_FOCUS:
- // When our app loses focus, we stop monitoring the accelerometer.
+ // When our app loses focus, we stop monitoring the sensors.
// This is to avoid consuming battery while not being used.
if (engine->accelerometerSensor != NULL) {
ASensorEventQueue_disableSensor(engine->sensorEventQueue,
engine->accelerometerSensor);
}
+ if (engine->magnetometerSensor != NULL) {
+ ASensorEventQueue_disableSensor(engine->sensorEventQueue,
+ engine->magnetometerSensor);
+ }
// Also stop animating.
engine->animating = 0;
engine_draw_frame(engine);
@@ -768,10 +782,12 @@ void android_main(struct android_app* state) {
FileAccessAndroid::asset_manager=state->activity->assetManager;
- // Prepare to monitor accelerometer
+ // Prepare to monitor sensors
engine.sensorManager = ASensorManager_getInstance();
engine.accelerometerSensor = ASensorManager_getDefaultSensor(engine.sensorManager,
- ASENSOR_TYPE_ACCELEROMETER);
+ ASENSOR_TYPE_ACCELEROMETER);
+ engine.magnetometerSensor = ASensorManager_getDefaultSensor(engine.sensorManager,
+ ASENSOR_TYPE_MAGNETIC_FIELD);
engine.sensorEventQueue = ASensorManager_createEventQueue(engine.sensorManager,
state->looper, LOOPER_ID_USER, NULL, NULL);
@@ -812,16 +828,21 @@ void android_main(struct android_app* state) {
// If a sensor has data, process it now.
// LOGI("events\n");
if (ident == LOOPER_ID_USER) {
- if (engine.accelerometerSensor != NULL) {
+ if (engine.accelerometerSensor != NULL || engine.magnetometerSensor != NULL) {
ASensorEvent event;
while (ASensorEventQueue_getEvents(engine.sensorEventQueue,
&event, 1) > 0) {
if (engine.os) {
+ if (event.acceleration != NULL) {
engine.os->process_accelerometer(Vector3(event.acceleration.x, event.acceleration.y,
event.acceleration.z));
-
+ }
+ if (event.magnetic != NULL) {
+ engine.os->process_magnetometer(Vector3(event.magnetic.x, event.magnetic.y,
+ event.magnetic.z));
+ }
}
}
diff --git a/platform/android/java/res/drawable/icon.png b/platform/android/java/res/drawable/icon.png
index 013632ddf1..e334f5fa78 100644
--- a/platform/android/java/res/drawable/icon.png
+++ b/platform/android/java/res/drawable/icon.png
Binary files differ
diff --git a/platform/android/java/res/layout/downloading_expansion.xml b/platform/android/java/res/layout/downloading_expansion.xml
index 553155dcd3..d678d94eac 100644
--- a/platform/android/java/res/layout/downloading_expansion.xml
+++ b/platform/android/java/res/layout/downloading_expansion.xml
@@ -80,7 +80,7 @@
</RelativeLayout>
<LinearLayout
- android:id="@+id/downloaderDashboard"
+ android:id="@+id/downloadButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
diff --git a/platform/android/java/res/values-fa/strings.xml b/platform/android/java/res/values-fa/strings.xml
index 450f9fe212..f1e29013c4 100644
--- a/platform/android/java/res/values-fa/strings.xml
+++ b/platform/android/java/res/values-fa/strings.xml
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="godot_project_name_string">godot-project-name-fa</string>
- <string name="testuf8">سلام</string>
<string name="text_paused_cellular">آیا می خواهید بر روی اتصال داده همراه دانلود را شروع کنید؟ بر اساس نوع سطح داده شما این ممکن است برای شما هزینه مالی داشته باشد.</string>
<string name="text_paused_cellular_2">اگر نمی خواهید بر روی اتصال داده همراه دانلود را شروع کنید ، دانلود به صورت خودکار در زمان دسترسی به وای-فای شروع می شود.</string>
<string name="text_button_resume_cellular">ادامه دانلود</string>
diff --git a/platform/android/java/src/com/android/vending/licensing/LicenseChecker.java b/platform/android/java/src/com/android/vending/licensing/LicenseChecker.java
index 0b1c4b6cca..531cb22f8c 100644
--- a/platform/android/java/src/com/android/vending/licensing/LicenseChecker.java
+++ b/platform/android/java/src/com/android/vending/licensing/LicenseChecker.java
@@ -146,11 +146,11 @@ public class LicenseChecker implements ServiceConnection {
if (mService == null) {
Log.i(TAG, "Binding to licensing service.");
try {
+ Intent serviceIntent = new Intent(new String(Base64.decode("Y29tLmFuZHJvaWQudmVuZGluZy5saWNlbnNpbmcuSUxpY2Vuc2luZ1NlcnZpY2U=")));
+ serviceIntent.setPackage("com.android.vending");
boolean bindResult = mContext
.bindService(
- new Intent(
- new String(
- Base64.decode("Y29tLmFuZHJvaWQudmVuZGluZy5saWNlbnNpbmcuSUxpY2Vuc2luZ1NlcnZpY2U="))),
+ serviceIntent,
this, // ServiceConnection.
Context.BIND_AUTO_CREATE);
diff --git a/platform/android/java/src/com/google/android/vending/expansion/downloader/Constants.java b/platform/android/java/src/com/google/android/vending/expansion/downloader/Constants.java
index ff2c6f535a..2af33b96b9 100644
--- a/platform/android/java/src/com/google/android/vending/expansion/downloader/Constants.java
+++ b/platform/android/java/src/com/google/android/vending/expansion/downloader/Constants.java
@@ -33,6 +33,10 @@ public class Constants {
public static final String EXP_PATH = File.separator + "Android"
+ File.separator + "obb" + File.separator;
+ // save to private app's data on Android 6.0 to skip requesting permission.
+ public static final String EXP_PATH_API23 = File.separator + "Android"
+ + File.separator + "data" + File.separator;
+
/** The intent that gets sent when the service must wake up for a retry */
public static final String ACTION_RETRY = "android.intent.action.DOWNLOAD_WAKEUP";
@@ -70,7 +74,7 @@ public class Constants {
* The number of times that the download manager will retry its network
* operations when no progress is happening before it gives up.
*/
- public static final int MAX_RETRIES = 5;
+ public static final int MAX_RETRIES = 10;
/**
* The minimum amount of time that the download manager accepts for
diff --git a/platform/android/java/src/com/google/android/vending/expansion/downloader/Helpers.java b/platform/android/java/src/com/google/android/vending/expansion/downloader/Helpers.java
index b4c28d36e7..ae3fe957cb 100644
--- a/platform/android/java/src/com/google/android/vending/expansion/downloader/Helpers.java
+++ b/platform/android/java/src/com/google/android/vending/expansion/downloader/Helpers.java
@@ -19,6 +19,7 @@ package com.google.android.vending.expansion.downloader;
import com.godot.game.R;
import android.content.Context;
+import android.os.Build;
import android.os.Environment;
import android.os.StatFs;
import android.os.SystemClock;
@@ -220,8 +221,8 @@ public class Helpers {
static public String getSaveFilePath(Context c) {
File root = Environment.getExternalStorageDirectory();
- String path = root.toString() + Constants.EXP_PATH + c.getPackageName();
- return path;
+ String path = Build.VERSION.SDK_INT >= 23 ? Constants.EXP_PATH_API23 : Constants.EXP_PATH;
+ return root.toString() + path + c.getPackageName();
}
/**
diff --git a/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/CustomNotificationFactory.java b/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/CustomNotificationFactory.java
index 9a0ca02122..e2673a9dd7 100644
--- a/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/CustomNotificationFactory.java
+++ b/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/CustomNotificationFactory.java
@@ -25,6 +25,6 @@ public class CustomNotificationFactory {
if (android.os.Build.VERSION.SDK_INT > 13)
return new V14CustomNotification();
else
- return new V3CustomNotification();
+ throw new RuntimeException();
}
}
diff --git a/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/DownloadNotification.java b/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/DownloadNotification.java
index d82b658bc3..73e6f83bec 100644
--- a/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/DownloadNotification.java
+++ b/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/DownloadNotification.java
@@ -27,6 +27,7 @@ import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.os.Messenger;
+import android.support.v4.app.NotificationCompat;
/**
* This class handles displaying the notification associated with the download
@@ -48,8 +49,9 @@ public class DownloadNotification implements IDownloaderClient {
private IDownloaderClient mClientProxy;
final ICustomNotification mCustomNotification;
- private Notification mNotification;
- private Notification mCurrentNotification;
+ // NotificationCompat.Builder is used to support API < 16. This can be changed to Notification.Builder if minimum API >= 16.
+ private NotificationCompat.Builder mNotificationBuilder;
+ private NotificationCompat.Builder mCurrentNotificationBuilder;
private CharSequence mLabel;
private String mCurrentText;
private PendingIntent mContentIntent;
@@ -132,17 +134,14 @@ public class DownloadNotification implements IDownloaderClient {
}
mCurrentText = mContext.getString(stringDownloadID);
mCurrentTitle = mLabel.toString();
- mCurrentNotification.tickerText = mLabel + ": " + mCurrentText;
- mCurrentNotification.icon = iconResource;
- mCurrentNotification.setLatestEventInfo(mContext, mCurrentTitle, mCurrentText,
- mContentIntent);
- if (ongoingEvent) {
- mCurrentNotification.flags |= Notification.FLAG_ONGOING_EVENT;
- } else {
- mCurrentNotification.flags &= ~Notification.FLAG_ONGOING_EVENT;
- mCurrentNotification.flags |= Notification.FLAG_AUTO_CANCEL;
- }
- mNotificationManager.notify(NOTIFICATION_ID, mCurrentNotification);
+ mCurrentNotificationBuilder.setTicker(mLabel + ": " + mCurrentText);
+ mCurrentNotificationBuilder.setSmallIcon(iconResource);
+ mCurrentNotificationBuilder.setContentTitle(mCurrentTitle);
+ mCurrentNotificationBuilder.setContentText(mCurrentText);
+ mCurrentNotificationBuilder.setContentIntent(mContentIntent);
+ mCurrentNotificationBuilder.setOngoing(ongoingEvent);
+ mCurrentNotificationBuilder.setAutoCancel(!ongoingEvent);
+ mNotificationManager.notify(NOTIFICATION_ID, mCurrentNotificationBuilder.build());
}
}
@@ -154,10 +153,12 @@ public class DownloadNotification implements IDownloaderClient {
}
if (progress.mOverallTotal <= 0) {
// we just show the text
- mNotification.tickerText = mCurrentTitle;
- mNotification.icon = android.R.drawable.stat_sys_download;
- mNotification.setLatestEventInfo(mContext, mLabel, mCurrentText, mContentIntent);
- mCurrentNotification = mNotification;
+ mNotificationBuilder.setTicker(mCurrentTitle);
+ mNotificationBuilder.setSmallIcon(android.R.drawable.stat_sys_download);
+ mNotificationBuilder.setContentTitle(mCurrentTitle);
+ mNotificationBuilder.setContentText(mCurrentText);
+ mNotificationBuilder.setContentIntent(mContentIntent);
+ mCurrentNotificationBuilder = mNotificationBuilder;
} else {
mCustomNotification.setCurrentBytes(progress.mOverallProgress);
mCustomNotification.setTotalBytes(progress.mOverallTotal);
@@ -166,9 +167,9 @@ public class DownloadNotification implements IDownloaderClient {
mCustomNotification.setTicker(mLabel + ": " + mCurrentText);
mCustomNotification.setTitle(mLabel);
mCustomNotification.setTimeRemaining(progress.mTimeRemaining);
- mCurrentNotification = mCustomNotification.updateNotification(mContext);
+ mCurrentNotificationBuilder = mCustomNotification.updateNotification(mContext);
}
- mNotificationManager.notify(NOTIFICATION_ID, mCurrentNotification);
+ mNotificationManager.notify(NOTIFICATION_ID, mCurrentNotificationBuilder.build());
}
public interface ICustomNotification {
@@ -186,7 +187,7 @@ public class DownloadNotification implements IDownloaderClient {
void setTimeRemaining(long timeRemaining);
- Notification updateNotification(Context c);
+ NotificationCompat.Builder updateNotification(Context c);
}
/**
@@ -219,8 +220,8 @@ public class DownloadNotification implements IDownloaderClient {
mContext.getSystemService(Context.NOTIFICATION_SERVICE);
mCustomNotification = CustomNotificationFactory
.createCustomNotification();
- mNotification = new Notification();
- mCurrentNotification = mNotification;
+ mNotificationBuilder = new NotificationCompat.Builder(ctx);
+ mCurrentNotificationBuilder = mNotificationBuilder;
}
diff --git a/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/V14CustomNotification.java b/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/V14CustomNotification.java
index 2e049a4d47..390bde96e9 100644
--- a/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/V14CustomNotification.java
+++ b/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/V14CustomNotification.java
@@ -22,6 +22,7 @@ import com.google.android.vending.expansion.downloader.Helpers;
import android.app.Notification;
import android.app.PendingIntent;
import android.content.Context;
+import android.support.v4.app.NotificationCompat;
public class V14CustomNotification implements DownloadNotification.ICustomNotification {
@@ -53,13 +54,14 @@ public class V14CustomNotification implements DownloadNotification.ICustomNotifi
mCurrentKB = currentBytes;
}
- void setProgress(Notification.Builder builder) {
+ void setProgress(NotificationCompat.Builder builder) {
}
@Override
- public Notification updateNotification(Context c) {
- Notification.Builder builder = new Notification.Builder(c);
+ public NotificationCompat.Builder updateNotification(Context c) {
+ // NotificationCompat.Builder is used to support API < 16. This can be changed to Notification.Builder if minimum API >= 16.
+ NotificationCompat.Builder builder = new NotificationCompat.Builder(c);
builder.setContentTitle(mTitle);
if (mTotalKB > 0 && -1 != mCurrentKB) {
builder.setProgress((int) (mTotalKB >> 8), (int) (mCurrentKB >> 8), false);
@@ -80,7 +82,7 @@ public class V14CustomNotification implements DownloadNotification.ICustomNotifi
builder.setContentIntent(mPendingIntent);
builder.setOnlyAlertOnce(true);
- return builder.getNotification();
+ return builder;
}
@Override
diff --git a/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/V3CustomNotification.java b/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/V3CustomNotification.java
deleted file mode 100644
index 94e21de7ca..0000000000
--- a/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/V3CustomNotification.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.vending.expansion.downloader.impl;
-
-import com.godot.game.R;
-import com.google.android.vending.expansion.downloader.Helpers;
-
-import android.app.Notification;
-import android.app.PendingIntent;
-import android.content.Context;
-import android.graphics.BitmapFactory;
-import android.view.View;
-import android.widget.RemoteViews;
-
-public class V3CustomNotification implements DownloadNotification.ICustomNotification {
-
- CharSequence mTitle;
- CharSequence mTicker;
- int mIcon;
- long mTotalBytes = -1;
- long mCurrentBytes = -1;
- long mTimeRemaining;
- PendingIntent mPendingIntent;
- Notification mNotification = new Notification();
-
- @Override
- public void setIcon(int icon) {
- mIcon = icon;
- }
-
- @Override
- public void setTitle(CharSequence title) {
- mTitle = title;
- }
-
- @Override
- public void setTotalBytes(long totalBytes) {
- mTotalBytes = totalBytes;
- }
-
- @Override
- public void setCurrentBytes(long currentBytes) {
- mCurrentBytes = currentBytes;
- }
-
- @Override
- public Notification updateNotification(Context c) {
- Notification n = mNotification;
-
- n.icon = mIcon;
-
- n.flags |= Notification.FLAG_ONGOING_EVENT;
-
- if (android.os.Build.VERSION.SDK_INT > 10) {
- n.flags |= Notification.FLAG_ONLY_ALERT_ONCE; // only matters for
- // Honeycomb
- }
-
- // Build the RemoteView object
- RemoteViews expandedView = new RemoteViews(
- c.getPackageName(),
- R.layout.status_bar_ongoing_event_progress_bar);
-
- expandedView.setTextViewText(R.id.title, mTitle);
- // look at strings
- expandedView.setViewVisibility(R.id.description, View.VISIBLE);
- expandedView.setTextViewText(R.id.description,
- Helpers.getDownloadProgressString(mCurrentBytes, mTotalBytes));
- expandedView.setViewVisibility(R.id.progress_bar_frame, View.VISIBLE);
- expandedView.setProgressBar(R.id.progress_bar,
- (int) (mTotalBytes >> 8),
- (int) (mCurrentBytes >> 8),
- mTotalBytes <= 0);
- expandedView.setViewVisibility(R.id.time_remaining, View.VISIBLE);
- expandedView.setTextViewText(
- R.id.time_remaining,
- c.getString(R.string.time_remaining_notification,
- Helpers.getTimeRemaining(mTimeRemaining)));
- expandedView.setTextViewText(R.id.progress_text,
- Helpers.getDownloadProgressPercent(mCurrentBytes, mTotalBytes));
- expandedView.setImageViewResource(R.id.appIcon, mIcon);
- n.contentView = expandedView;
- n.contentIntent = mPendingIntent;
- return n;
- }
-
- @Override
- public void setPendingIntent(PendingIntent contentIntent) {
- mPendingIntent = contentIntent;
- }
-
- @Override
- public void setTicker(CharSequence ticker) {
- mTicker = ticker;
- }
-
- @Override
- public void setTimeRemaining(long timeRemaining) {
- mTimeRemaining = timeRemaining;
- }
-
-}
diff --git a/platform/android/java/src/org/godotengine/godot/Dictionary.java b/platform/android/java/src/org/godotengine/godot/Dictionary.java
index 34051c4bb8..e003c245bb 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-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2016 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 1f208f8fb6..73d54b6afa 100644
--- a/platform/android/java/src/org/godotengine/godot/Godot.java
+++ b/platform/android/java/src/org/godotengine/godot/Godot.java
@@ -206,6 +206,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
private SensorManager mSensorManager;
private Sensor mAccelerometer;
+ private Sensor mMagnetometer;
public FrameLayout layout;
public RelativeLayout adLayout;
@@ -374,6 +375,8 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_GAME);
+ mMagnetometer = mSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);
+ mSensorManager.registerListener(this, mMagnetometer, SensorManager.SENSOR_DELAY_GAME);
result_callback = null;
@@ -464,7 +467,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
// Build the full path to the app's expansion files
try {
- expansion_pack_path = Environment.getExternalStorageDirectory().toString() + "/Android/obb/"+this.getPackageName();
+ expansion_pack_path = Helpers.getSaveFilePath(getApplicationContext());
expansion_pack_path+="/"+"main."+getPackageManager().getPackageInfo(getPackageName(), 0).versionCode+"."+this.getPackageName()+".obb";
} catch (Exception e) {
e.printStackTrace();
@@ -588,6 +591,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
mView.onResume();
mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_NORMAL);
+ mSensorManager.registerListener(this, mMagnetometer, SensorManager.SENSOR_DELAY_NORMAL);
GodotLib.focusin();
if(use_immersive && Build.VERSION.SDK_INT >= 19.0){ // check if the application runs on an android 4.4+
Window window = getWindow();
@@ -646,7 +650,14 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
float x = adjustedValues[0];
float y = adjustedValues[1];
float z = adjustedValues[2];
- GodotLib.accelerometer(x,y,z);
+
+ int typeOfSensor = event.sensor.getType();
+ if (typeOfSensor == event.sensor.TYPE_ACCELEROMETER) {
+ GodotLib.accelerometer(x,y,z);
+ }
+ if (typeOfSensor == event.sensor.TYPE_MAGNETIC_FIELD) {
+ GodotLib.magnetometer(x,y,z);
+ }
}
@Override public final void onAccuracyChanged(Sensor sensor, int accuracy) {
diff --git a/platform/android/java/src/org/godotengine/godot/GodotDownloaderAlarmReceiver.java b/platform/android/java/src/org/godotengine/godot/GodotDownloaderAlarmReceiver.java
index b602f4757c..ea6c070fae 100644
--- a/platform/android/java/src/org/godotengine/godot/GodotDownloaderAlarmReceiver.java
+++ b/platform/android/java/src/org/godotengine/godot/GodotDownloaderAlarmReceiver.java
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* GodotDownloaderAlarmReceiver.java */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
package org.godotengine.godot;
import com.google.android.vending.expansion.downloader.DownloaderClientMarshaller;
diff --git a/platform/android/java/src/org/godotengine/godot/GodotDownloaderService.java b/platform/android/java/src/org/godotengine/godot/GodotDownloaderService.java
index 6735d387f3..4ea3f13021 100644
--- a/platform/android/java/src/org/godotengine/godot/GodotDownloaderService.java
+++ b/platform/android/java/src/org/godotengine/godot/GodotDownloaderService.java
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* GodotDownloaderService.java */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
package org.godotengine.godot;
import android.content.Context;
diff --git a/platform/android/java/src/org/godotengine/godot/GodotLib.java b/platform/android/java/src/org/godotengine/godot/GodotLib.java
index 7c5ac33c85..df181ae1bb 100644
--- a/platform/android/java/src/org/godotengine/godot/GodotLib.java
+++ b/platform/android/java/src/org/godotengine/godot/GodotLib.java
@@ -51,6 +51,7 @@ public class GodotLib {
public static native void step();
public static native void touch(int what,int pointer,int howmany, int[] arr);
public static native void accelerometer(float x, float y, float z);
+ public static native void magnetometer(float x, float y, float z);
public static native void key(int p_scancode, int p_unicode_char, boolean p_pressed);
public static native void joybutton(int p_device, int p_but, boolean p_pressed);
public static native void joyaxis(int p_device, int p_axis, float p_value);
diff --git a/platform/android/java/src/org/godotengine/godot/GodotPaymentV3.java b/platform/android/java/src/org/godotengine/godot/GodotPaymentV3.java
index 6bec49410d..fde752acc9 100644
--- a/platform/android/java/src/org/godotengine/godot/GodotPaymentV3.java
+++ b/platform/android/java/src/org/godotengine/godot/GodotPaymentV3.java
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* GodotPaymentV3.java */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
package org.godotengine.godot;
import org.godotengine.godot.Dictionary;
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 c8ffa74ecd..aa92eeae0f 100644
--- a/platform/android/java/src/org/godotengine/godot/input/GodotEditText.java
+++ b/platform/android/java/src/org/godotengine/godot/input/GodotEditText.java
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* GodotEditText.java */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
package org.godotengine.godot.input;
import android.content.Context;
import android.util.AttributeSet;
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 64d8826b44..13c8c8b3ec 100644
--- a/platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java
+++ b/platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* GodotTextInputWrapper.java */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
package org.godotengine.godot.input;
import android.content.Context;
import android.text.Editable;
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 61ccb97161..16b669fbe8 100644
--- a/platform/android/java/src/org/godotengine/godot/payments/ConsumeTask.java
+++ b/platform/android/java/src/org/godotengine/godot/payments/ConsumeTask.java
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* ConsumeTask.java */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
package org.godotengine.godot.payments;
import com.android.vending.billing.IInAppBillingService;
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 293e903284..175d401c87 100644
--- a/platform/android/java/src/org/godotengine/godot/payments/GenericConsumeTask.java
+++ b/platform/android/java/src/org/godotengine/godot/payments/GenericConsumeTask.java
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* GenericConsumeTask.java */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
package org.godotengine.godot.payments;
import com.android.vending.billing.IInAppBillingService;
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 d120551e4a..e63230c4f8 100644
--- a/platform/android/java/src/org/godotengine/godot/payments/HandlePurchaseTask.java
+++ b/platform/android/java/src/org/godotengine/godot/payments/HandlePurchaseTask.java
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* HandlePurchaseTask.java */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
package org.godotengine.godot.payments;
import org.json.JSONException;
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 5f3d931593..0635385f53 100644
--- a/platform/android/java/src/org/godotengine/godot/payments/PaymentsCache.java
+++ b/platform/android/java/src/org/godotengine/godot/payments/PaymentsCache.java
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* PaymentsCache.java */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
package org.godotengine.godot.payments;
import android.content.Context;
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 effb58aa35..eb33b37ecc 100644
--- a/platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java
+++ b/platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* PaymentsManager.java */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
package org.godotengine.godot.payments;
import java.util.ArrayList;
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 8b048d8065..9e92d8b5a5 100644
--- a/platform/android/java/src/org/godotengine/godot/payments/PurchaseTask.java
+++ b/platform/android/java/src/org/godotengine/godot/payments/PurchaseTask.java
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* PurchaseTask.java */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
package org.godotengine.godot.payments;
import org.json.JSONException;
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 7bb5131b49..2dc7dcf6b1 100644
--- a/platform/android/java/src/org/godotengine/godot/payments/ReleaseAllConsumablesTask.java
+++ b/platform/android/java/src/org/godotengine/godot/payments/ReleaseAllConsumablesTask.java
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* ReleaseAllConsumablesTask.java */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
package org.godotengine.godot.payments;
import java.util.ArrayList;
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 2fcf7483b4..f3532f311f 100644
--- a/platform/android/java/src/org/godotengine/godot/payments/ValidateTask.java
+++ b/platform/android/java/src/org/godotengine/godot/payments/ValidateTask.java
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* ValidateTask.java */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
package org.godotengine.godot.payments;
import org.json.JSONException;
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 2fb81cef8c..ef7793c1e6 100644
--- a/platform/android/java/src/org/godotengine/godot/utils/Crypt.java
+++ b/platform/android/java/src/org/godotengine/godot/utils/Crypt.java
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* Crypt.java */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
package org.godotengine.godot.utils;
import java.security.MessageDigest;
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 2db88fcc9b..f2b0e8786e 100644
--- a/platform/android/java/src/org/godotengine/godot/utils/CustomSSLSocketFactory.java
+++ b/platform/android/java/src/org/godotengine/godot/utils/CustomSSLSocketFactory.java
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* CustomSSLSocketFactory.java */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
package org.godotengine.godot.utils;
import java.io.IOException;
import java.net.Socket;
@@ -51,4 +79,4 @@ public class CustomSSLSocketFactory extends SSLSocketFactory {
public Socket createSocket() throws IOException {
return sslContext.getSocketFactory().createSocket();
}
-} \ No newline at end of file
+}
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 14346702cc..5687b3c1e1 100644
--- a/platform/android/java/src/org/godotengine/godot/utils/HttpRequester.java
+++ b/platform/android/java/src/org/godotengine/godot/utils/HttpRequester.java
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* HttpRequester.java */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
package org.godotengine.godot.utils;
import java.io.BufferedReader;
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 36753e368c..d66dfe9531 100644
--- a/platform/android/java/src/org/godotengine/godot/utils/RequestParams.java
+++ b/platform/android/java/src/org/godotengine/godot/utils/RequestParams.java
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* RequestParams.java */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
package org.godotengine.godot.utils;
import java.util.ArrayList;
diff --git a/platform/android/java_bind.cpp b/platform/android/java_bind.cpp
deleted file mode 100644
index 33ecfcffb6..0000000000
--- a/platform/android/java_bind.cpp
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "java_bind.h"
-
-JavaBind::JavaBind()
-{
-}
diff --git a/platform/android/java_bind.h b/platform/android/java_bind.h
deleted file mode 100644
index ca6b4650d3..0000000000
--- a/platform/android/java_bind.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef JAVA_BIND_H
-#define JAVA_BIND_H
-
-class JavaBind
-{
-public:
- JavaBind();
-};
-
-#endif // JAVA_BIND_H
diff --git a/platform/android/java_class_wrapper.cpp b/platform/android/java_class_wrapper.cpp
index 283ea81152..4fda13fec0 100644
--- a/platform/android/java_class_wrapper.cpp
+++ b/platform/android/java_class_wrapper.cpp
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* java_class_wrapper.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#include "java_class_wrapper.h"
#include "thread_jandroid.h"
diff --git a/platform/android/java_class_wrapper.h b/platform/android/java_class_wrapper.h
index d5d8bd5be8..012e7854fe 100644
--- a/platform/android/java_class_wrapper.h
+++ b/platform/android/java_class_wrapper.h
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* java_class_wrapper.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#ifndef JAVA_CLASS_WRAPPER_H
#define JAVA_CLASS_WRAPPER_H
diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp
index b5beb8fa2c..1ea7cd7ebb 100644
--- a/platform/android/java_glue.cpp
+++ b/platform/android/java_glue.cpp
@@ -650,6 +650,7 @@ static bool resized_reload=false;
static bool quit_request=false;
static Size2 new_size;
static Vector3 accelerometer;
+static Vector3 magnetometer;
static HashMap<String,JNISingleton*> jni_singletons;
static jobject godot_io;
@@ -1088,6 +1089,8 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv * env, jo
os_android->process_accelerometer(accelerometer);
+ os_android->process_magnetometer(magnetometer);
+
if (os_android->main_loop_iterate()==true) {
jclass cls = env->FindClass("org/godotengine/godot/Godot");
@@ -1488,6 +1491,14 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_accelerometer(JNIEnv
}
+JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_magnetometer(JNIEnv * env, jobject obj, jfloat x, jfloat y, jfloat z) {
+
+ input_mutex->lock();
+ magnetometer=Vector3(x,y,z);
+ input_mutex->unlock();
+
+}
+
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_focusin(JNIEnv * env, jobject obj){
if (!suspend_mutex)
diff --git a/platform/android/java_glue.h b/platform/android/java_glue.h
index 1d65d21251..f7916efe2c 100644
--- a/platform/android/java_glue.h
+++ b/platform/android/java_glue.h
@@ -49,6 +49,7 @@ extern "C" {
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyconnectionchanged(JNIEnv * env, jobject obj, jint p_device, jboolean p_connected, jstring p_name);
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_audio(JNIEnv * env, jobject obj);
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_accelerometer(JNIEnv * env, jobject obj, jfloat x, jfloat y, jfloat z);
+ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_magnetometer(JNIEnv * env, jobject obj, jfloat x, jfloat y, jfloat z);
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_focusin(JNIEnv * env, jobject obj);
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_focusout(JNIEnv * env, jobject obj);
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_singleton(JNIEnv * env, jobject obj, jstring name,jobject p_object);
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index 2ef28333be..4e6dfb2db2 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -609,6 +609,11 @@ void OS_Android::process_accelerometer(const Vector3& p_accelerometer) {
input->set_accelerometer(p_accelerometer);
}
+void OS_Android::process_magnetometer(const Vector3& p_magnetometer) {
+
+ input->set_magnetometer(p_magnetometer);
+}
+
bool OS_Android::has_touchscreen_ui_hint() const {
return true;
diff --git a/platform/android/os_android.h b/platform/android/os_android.h
index ec1f4119b4..843b3c4788 100644
--- a/platform/android/os_android.h
+++ b/platform/android/os_android.h
@@ -239,6 +239,7 @@ public:
void process_accelerometer(const Vector3& p_accelerometer);
+ void process_magnetometer(const Vector3& p_magnetometer);
void process_touch(int p_what,int p_pointer, const Vector<TouchPos>& p_points);
void process_joy_event(JoystickEvent p_event);
void process_event(InputEvent p_event);
diff --git a/platform/bb10/bbutil.h b/platform/bb10/bbutil.h
index bc422cd9b9..c2a4c5a7f5 100644
--- a/platform/bb10/bbutil.h
+++ b/platform/bb10/bbutil.h
@@ -1,31 +1,3 @@
-/*************************************************************************/
-/* bbutil.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
#ifndef _UTILITY_H_INCLUDED
#define _UTILITY_H_INCLUDED
diff --git a/platform/bb10/export/export.cpp b/platform/bb10/export/export.cpp
index da3a958a56..7cb0aa3607 100644
--- a/platform/bb10/export/export.cpp
+++ b/platform/bb10/export/export.cpp
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* export.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#include "version.h"
#include "export.h"
#include "tools/editor/editor_settings.h"
@@ -532,95 +560,99 @@ void EditorExportPlatformBB10::_device_poll_thread(void *ud) {
if (windows)
bb_deploy+=".bat";
- if (!FileAccess::exists(bb_deploy)) {
- OS::get_singleton()->delay_usec(3000000);
- continue; //adb not configured
- }
+ if (FileAccess::exists(bb_deploy)) {
- Vector<Device> devices;
+ Vector<Device> devices;
- for (int i=0;i<MAX_DEVICES;i++) {
+ for (int i=0;i<MAX_DEVICES;i++) {
- String host = EditorSettings::get_singleton()->get("blackberry/device_"+itos(i+1)+"/host");
- if (host==String())
- continue;
- String pass = EditorSettings::get_singleton()->get("blackberry/device_"+itos(i+1)+"/password");
- if (pass==String())
- continue;
+ String host = EditorSettings::get_singleton()->get("blackberry/device_"+itos(i+1)+"/host");
+ if (host==String())
+ continue;
+ String pass = EditorSettings::get_singleton()->get("blackberry/device_"+itos(i+1)+"/password");
+ if (pass==String())
+ continue;
- List<String> args;
- args.push_back("-listDeviceInfo");
- args.push_back(host);
- args.push_back("-password");
- args.push_back(pass);
+ List<String> args;
+ args.push_back("-listDeviceInfo");
+ args.push_back(host);
+ args.push_back("-password");
+ args.push_back(pass);
- int ec;
- String dp;
+ int ec;
+ String dp;
- Error err = OS::get_singleton()->execute(bb_deploy,args,true,NULL,&dp,&ec);
+ Error err = OS::get_singleton()->execute(bb_deploy,args,true,NULL,&dp,&ec);
- if (err==OK && ec==0) {
+ if (err==OK && ec==0) {
- Device dev;
- dev.index=i;
- String descr;
- Vector<String> ls=dp.split("\n");
+ Device dev;
+ dev.index=i;
+ String descr;
+ Vector<String> ls=dp.split("\n");
- for(int i=0;i<ls.size();i++) {
+ for(int i=0;i<ls.size();i++) {
+
+ String l = ls[i].strip_edges();
+ if (l.begins_with("modelfullname::")) {
+ dev.name=l.get_slice("::",1);
+ descr+="Model: "+dev.name+"\n";
+ }
+ if (l.begins_with("modelnumber::")) {
+ String s = l.get_slice("::",1);
+ dev.name+=" ("+s+")";
+ descr+="Model Number: "+s+"\n";
+ }
+ if (l.begins_with("scmbundle::"))
+ descr+="OS Version: "+l.get_slice("::",1)+"\n";
+ if (l.begins_with("[n]debug_token_expiration::"))
+ descr+="Debug Token Expires:: "+l.get_slice("::",1)+"\n";
- String l = ls[i].strip_edges();
- if (l.begins_with("modelfullname::")) {
- dev.name=l.get_slice("::",1);
- descr+="Model: "+dev.name+"\n";
- }
- if (l.begins_with("modelnumber::")) {
- String s = l.get_slice("::",1);
- dev.name+=" ("+s+")";
- descr+="Model Number: "+s+"\n";
}
- if (l.begins_with("scmbundle::"))
- descr+="OS Version: "+l.get_slice("::",1)+"\n";
- if (l.begins_with("[n]debug_token_expiration::"))
- descr+="Debug Token Expires:: "+l.get_slice("::",1)+"\n";
+ dev.description=descr;
+ devices.push_back(dev);
}
- dev.description=descr;
- devices.push_back(dev);
}
- }
-
- bool changed=false;
+ bool changed=false;
- ea->device_lock->lock();
+ ea->device_lock->lock();
- if (ea->devices.size()!=devices.size()) {
- changed=true;
- } else {
+ if (ea->devices.size()!=devices.size()) {
+ changed=true;
+ } else {
- for(int i=0;i<ea->devices.size();i++) {
+ for(int i=0;i<ea->devices.size();i++) {
- if (ea->devices[i].index!=devices[i].index) {
- changed=true;
- break;
+ if (ea->devices[i].index!=devices[i].index) {
+ changed=true;
+ break;
+ }
}
}
- }
- if (changed) {
+ if (changed) {
- ea->devices=devices;
- ea->devices_changed=true;
- }
+ ea->devices=devices;
+ ea->devices_changed=true;
+ }
- ea->device_lock->unlock();
+ ea->device_lock->unlock();
+ }
- OS::get_singleton()->delay_usec(3000000);
+ uint64_t wait = 3000000;
+ uint64_t time = OS::get_singleton()->get_ticks_usec();
+ while(OS::get_singleton()->get_ticks_usec() - time < wait ) {
+ OS::get_singleton()->delay_usec(1000);
+ if (ea->quit_request)
+ break;
+ }
}
}
diff --git a/platform/bb10/export/export.h b/platform/bb10/export/export.h
index 06c7a681be..bd9cad5cb3 100644
--- a/platform/bb10/export/export.h
+++ b/platform/bb10/export/export.h
@@ -1,3 +1,29 @@
-
-
+/*************************************************************************/
+/* export.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
void register_bb10_exporter();
diff --git a/platform/haiku/context_gl_haiku.cpp b/platform/haiku/context_gl_haiku.cpp
index 330046162d..2fedd1532a 100644
--- a/platform/haiku/context_gl_haiku.cpp
+++ b/platform/haiku/context_gl_haiku.cpp
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* context_gl_haiku.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#include "context_gl_haiku.h"
#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED)
diff --git a/platform/haiku/context_gl_haiku.h b/platform/haiku/context_gl_haiku.h
index 63caec6fb3..91aae6b382 100644
--- a/platform/haiku/context_gl_haiku.h
+++ b/platform/haiku/context_gl_haiku.h
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* context_gl_haiku.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#ifndef CONTEXT_GL_HAIKU_H
#define CONTEXT_GL_HAIKU_H
diff --git a/platform/haiku/detect.py b/platform/haiku/detect.py
index 637b42dc03..6d1a96a8da 100644
--- a/platform/haiku/detect.py
+++ b/platform/haiku/detect.py
@@ -23,7 +23,8 @@ def get_opts():
def get_flags():
return [
- ('builtin_zlib', 'no')
+ ('builtin_zlib', 'no'),
+ #('glew', 'yes'), # TODO: investigate the GLEW situation on Haiku
]
def configure(env):
@@ -52,9 +53,9 @@ def configure(env):
#env.Append(CCFLAGS=['-DFREETYPE_ENABLED'])
env.Append(CPPFLAGS = ['-DPTHREAD_NO_RENAME']) # TODO: enable when we have pthread_setname_np
- env.Append(CPPFLAGS = ['-DGLEW_ENABLED', '-DOPENGL_ENABLED', '-DMEDIA_KIT_ENABLED'])
+ 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', 'GLEW'])
+ 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')})
diff --git a/platform/haiku/godot_haiku.cpp b/platform/haiku/godot_haiku.cpp
index fa5651d89a..71c9d30239 100644
--- a/platform/haiku/godot_haiku.cpp
+++ b/platform/haiku/godot_haiku.cpp
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* godot_haiku.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#include "main/main.h"
#include "os_haiku.h"
diff --git a/platform/haiku/haiku_application.cpp b/platform/haiku/haiku_application.cpp
index 180bd133fb..2b9604f563 100644
--- a/platform/haiku/haiku_application.cpp
+++ b/platform/haiku/haiku_application.cpp
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* haiku_application.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#include "haiku_application.h"
HaikuApplication::HaikuApplication()
diff --git a/platform/haiku/haiku_application.h b/platform/haiku/haiku_application.h
index a64b01c94d..74316b9b1f 100644
--- a/platform/haiku/haiku_application.h
+++ b/platform/haiku/haiku_application.h
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* haiku_application.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#ifndef HAIKU_APPLICATION_H
#define HAIKU_APPLICATION_H
diff --git a/platform/haiku/haiku_direct_window.cpp b/platform/haiku/haiku_direct_window.cpp
index 184d64f840..583453af1e 100644
--- a/platform/haiku/haiku_direct_window.cpp
+++ b/platform/haiku/haiku_direct_window.cpp
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* haiku_direct_window.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#include <UnicodeChar.h>
#include "main/main.h"
diff --git a/platform/haiku/haiku_direct_window.h b/platform/haiku/haiku_direct_window.h
index f0398df505..b4fdb6edb2 100644
--- a/platform/haiku/haiku_direct_window.h
+++ b/platform/haiku/haiku_direct_window.h
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* haiku_direct_window.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#ifndef HAIKU_DIRECT_WINDOW_H
#define HAIKU_DIRECT_WINDOW_H
diff --git a/platform/haiku/haiku_gl_view.cpp b/platform/haiku/haiku_gl_view.cpp
index 481d6098a7..da0957c81d 100644
--- a/platform/haiku/haiku_gl_view.cpp
+++ b/platform/haiku/haiku_gl_view.cpp
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* haiku_gl_view.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#include "main/main.h"
#include "haiku_gl_view.h"
diff --git a/platform/haiku/haiku_gl_view.h b/platform/haiku/haiku_gl_view.h
index f44b6d4325..05c288e83b 100644
--- a/platform/haiku/haiku_gl_view.h
+++ b/platform/haiku/haiku_gl_view.h
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* haiku_gl_view.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#ifndef HAIKU_GL_VIEW_H
#define HAIKU_GL_VIEW_H
diff --git a/platform/haiku/key_mapping_haiku.cpp b/platform/haiku/key_mapping_haiku.cpp
index f0622d3f1d..43981b8855 100644
--- a/platform/haiku/key_mapping_haiku.cpp
+++ b/platform/haiku/key_mapping_haiku.cpp
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* key_mapping_haiku.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#include <InterfaceDefs.h>
#include "key_mapping_haiku.h"
diff --git a/platform/haiku/key_mapping_haiku.h b/platform/haiku/key_mapping_haiku.h
index e2864678a8..1309ee034d 100644
--- a/platform/haiku/key_mapping_haiku.h
+++ b/platform/haiku/key_mapping_haiku.h
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* key_mapping_haiku.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#ifndef KEY_MAPPING_HAIKU_H
#define KEY_MAPPING_HAIKU_H
diff --git a/platform/haiku/os_haiku.cpp b/platform/haiku/os_haiku.cpp
index 308800cec0..f5674fb0eb 100644
--- a/platform/haiku/os_haiku.cpp
+++ b/platform/haiku/os_haiku.cpp
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* os_haiku.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#include <Screen.h>
#include "servers/visual/visual_server_raster.h"
diff --git a/platform/haiku/os_haiku.h b/platform/haiku/os_haiku.h
index e1b0b86cf4..e1d6b5b7b9 100644
--- a/platform/haiku/os_haiku.h
+++ b/platform/haiku/os_haiku.h
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* os_haiku.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#ifndef OS_HAIKU_H
#define OS_HAIKU_H
diff --git a/platform/haiku/platform_config.h b/platform/haiku/platform_config.h
index 691bdbdb9c..72dc0e5149 100644
--- a/platform/haiku/platform_config.h
+++ b/platform/haiku/platform_config.h
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* platform_config.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#include <alloca.h>
// for ifaddrs.h needed in drivers/unix/ip_unix.cpp
diff --git a/platform/iphone/Appirater.h b/platform/iphone/Appirater.h
index 9c7e3febf6..96dd30e7c7 100644
--- a/platform/iphone/Appirater.h
+++ b/platform/iphone/Appirater.h
@@ -1,31 +1,4 @@
-/*************************************************************************/
-/* Appirater.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2016 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 */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
+/*
This file is part of Appirater.
Copyright (c) 2010, Arash Payan
diff --git a/platform/iphone/globals/global_defaults.cpp b/platform/iphone/globals/global_defaults.cpp
index 18a51a5b4e..23261ceb02 100755
--- a/platform/iphone/globals/global_defaults.cpp
+++ b/platform/iphone/globals/global_defaults.cpp
@@ -1,4 +1,31 @@
-
+/*************************************************************************/
+/* global_defaults.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#include "global_defaults.h"
#include "globals.h"
diff --git a/platform/iphone/globals/global_defaults.h b/platform/iphone/globals/global_defaults.h
index 25f1ae687e..0f4bf64c9b 100644
--- a/platform/iphone/globals/global_defaults.h
+++ b/platform/iphone/globals/global_defaults.h
@@ -1,3 +1,29 @@
-
-
-void register_iphone_global_defaults(); \ No newline at end of file
+/*************************************************************************/
+/* global_defaults.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+void register_iphone_global_defaults();
diff --git a/platform/iphone/ios.h b/platform/iphone/ios.h
index 0e4661520b..8861417284 100644
--- a/platform/iphone/ios.h
+++ b/platform/iphone/ios.h
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* ios.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#ifndef IOS_H
#define IOS_H
diff --git a/platform/iphone/ios.mm b/platform/iphone/ios.mm
index deb63feacf..949d3bcb27 100644
--- a/platform/iphone/ios.mm
+++ b/platform/iphone/ios.mm
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* ios.mm */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#include "ios.h"
#import <UIKit/UIKit.h>
diff --git a/platform/iphone/main.m b/platform/iphone/main.m
index 055e6a63c8..ea46a69672 100644
--- a/platform/iphone/main.m
+++ b/platform/iphone/main.m
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* main.m */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#import <UIKit/UIKit.h>
#import "app_delegate.h"
#include <stdio.h>
diff --git a/platform/iphone/platform_refcount.h b/platform/iphone/platform_refcount.h
index 45391e651a..3bf8652b4a 100644
--- a/platform/iphone/platform_refcount.h
+++ b/platform/iphone/platform_refcount.h
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* platform_refcount.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#include "safe_refcount.h"
#ifdef IPHONE_ENABLED
diff --git a/platform/iphone/rasterizer_iphone.cpp b/platform/iphone/rasterizer_iphone.cpp
index f06f12547f..99e83343d0 100644
--- a/platform/iphone/rasterizer_iphone.cpp
+++ b/platform/iphone/rasterizer_iphone.cpp
@@ -2446,7 +2446,7 @@ void RasterizerIPhone::canvas_draw_rect(const Rect2& p_rect, bool p_region, cons
}
-void RasterizerIPhone::canvas_draw_style_box(const Rect2& p_rect, RID p_texture,const float *p_margin, bool p_draw_center) {
+void RasterizerIPhone::canvas_draw_style_box(const Rect2& p_rect, const Rect2& p_src_region, RID p_texture,const float *p_margin, bool p_draw_center) {
glColor4f(1, 1, 1, 1);
@@ -2458,52 +2458,56 @@ void RasterizerIPhone::canvas_draw_style_box(const Rect2& p_rect, RID p_texture,
glBindTexture( GL_TEXTURE_2D,texture->tex_id );
+ Rect2 region = p_src_region;
+ if (region.size.width <= 0 )
+ region.size.width = texture->width;
+ if (region.size.height <= 0)
+ region.size.height = texture->height;
/* CORNERS */
-
_draw_textured_quad( // top left
Rect2( p_rect.pos, Size2(p_margin[MARGIN_LEFT],p_margin[MARGIN_TOP])),
- Rect2( Point2(), Size2(p_margin[MARGIN_LEFT],p_margin[MARGIN_TOP])),
+ Rect2( region.pos, Size2(p_margin[MARGIN_LEFT],p_margin[MARGIN_TOP])),
Size2( texture->width, texture->height ) );
_draw_textured_quad( // top right
Rect2( Point2( p_rect.pos.x + p_rect.size.width - p_margin[MARGIN_RIGHT], p_rect.pos.y), Size2(p_margin[MARGIN_RIGHT],p_margin[MARGIN_TOP])),
- Rect2( Point2(texture->width-p_margin[MARGIN_RIGHT],0), Size2(p_margin[MARGIN_RIGHT],p_margin[MARGIN_TOP])),
+ Rect2( Point2(region.pos.x+region.size.width-p_margin[MARGIN_RIGHT], region.pos.y), Size2(p_margin[MARGIN_RIGHT],p_margin[MARGIN_TOP])),
Size2( texture->width, texture->height ) );
_draw_textured_quad( // bottom left
Rect2( Point2(p_rect.pos.x,p_rect.pos.y + p_rect.size.height - p_margin[MARGIN_BOTTOM]), Size2(p_margin[MARGIN_LEFT],p_margin[MARGIN_BOTTOM])),
- Rect2( Point2(0,texture->height-p_margin[MARGIN_BOTTOM]), Size2(p_margin[MARGIN_LEFT],p_margin[MARGIN_BOTTOM])),
+ Rect2( Point2(region.pos.x, region.pos.y+region.size.height-p_margin[MARGIN_BOTTOM]), Size2(p_margin[MARGIN_LEFT],p_margin[MARGIN_BOTTOM])),
Size2( texture->width, texture->height ) );
_draw_textured_quad( // bottom right
Rect2( Point2( p_rect.pos.x + p_rect.size.width - p_margin[MARGIN_RIGHT], p_rect.pos.y + p_rect.size.height - p_margin[MARGIN_BOTTOM]), Size2(p_margin[MARGIN_RIGHT],p_margin[MARGIN_BOTTOM])),
- Rect2( Point2(texture->width-p_margin[MARGIN_RIGHT],texture->height-p_margin[MARGIN_BOTTOM]), Size2(p_margin[MARGIN_RIGHT],p_margin[MARGIN_BOTTOM])),
+ Rect2( Point2(region.pos.x+region.size.width-p_margin[MARGIN_RIGHT], region.pos.y+region.size.height-p_margin[MARGIN_BOTTOM]), Size2(p_margin[MARGIN_RIGHT],p_margin[MARGIN_BOTTOM])),
Size2( texture->width, texture->height ) );
Rect2 rect_center( p_rect.pos+Point2( p_margin[MARGIN_LEFT], p_margin[MARGIN_TOP]), Size2( p_rect.size.width - p_margin[MARGIN_LEFT] - p_margin[MARGIN_RIGHT], p_rect.size.height - p_margin[MARGIN_TOP] - p_margin[MARGIN_BOTTOM] ));
- Rect2 src_center( Point2( p_margin[MARGIN_LEFT], p_margin[MARGIN_TOP]), Size2( texture->width - p_margin[MARGIN_LEFT] - p_margin[MARGIN_RIGHT], texture->height - p_margin[MARGIN_TOP] - p_margin[MARGIN_BOTTOM] ));
+ Rect2 src_center( Point2(region.pos.x+p_margin[MARGIN_LEFT], region.pos.y+p_margin[MARGIN_TOP]), Size2(region.size.width - p_margin[MARGIN_LEFT] - p_margin[MARGIN_RIGHT], region.size.height - p_margin[MARGIN_TOP] - p_margin[MARGIN_BOTTOM] ));
_draw_textured_quad( // top
Rect2( Point2(rect_center.pos.x,p_rect.pos.y),Size2(rect_center.size.width,p_margin[MARGIN_TOP])),
- Rect2( Point2(p_margin[MARGIN_LEFT],0), Size2(src_center.size.width,p_margin[MARGIN_TOP])),
+ Rect2( Point2(src_center.pos.x,region.pos.y), Size2(src_center.size.width,p_margin[MARGIN_TOP])),
Size2( texture->width, texture->height ) );
_draw_textured_quad( // bottom
Rect2( Point2(rect_center.pos.x,rect_center.pos.y+rect_center.size.height),Size2(rect_center.size.width,p_margin[MARGIN_BOTTOM])),
- Rect2( Point2(p_margin[MARGIN_LEFT],src_center.pos.y+src_center.size.height), Size2(src_center.size.width,p_margin[MARGIN_BOTTOM])),
+ Rect2( Point2(src_center.pos.x,src_center.pos.y+src_center.size.height), Size2(src_center.size.width,p_margin[MARGIN_BOTTOM])),
Size2( texture->width, texture->height ) );
_draw_textured_quad( // left
Rect2( Point2(p_rect.pos.x,rect_center.pos.y),Size2(p_margin[MARGIN_LEFT],rect_center.size.height)),
- Rect2( Point2(0,p_margin[MARGIN_TOP]), Size2(p_margin[MARGIN_LEFT],src_center.size.height)),
+ Rect2( Point2(region.pos.x,region.pos.y+p_margin[MARGIN_TOP]), Size2(p_margin[MARGIN_LEFT],src_center.size.height)),
Size2( texture->width, texture->height ) );
_draw_textured_quad( // right
Rect2( Point2(rect_center.pos.x+rect_center.size.width,rect_center.pos.y),Size2(p_margin[MARGIN_RIGHT],rect_center.size.height)),
- Rect2( Point2(src_center.pos.x+src_center.size.width,p_margin[MARGIN_TOP]), Size2(p_margin[MARGIN_RIGHT],src_center.size.height)),
+ Rect2( Point2(src_center.pos.x+src_center.size.width,region.pos.y+p_margin[MARGIN_TOP]), Size2(p_margin[MARGIN_RIGHT],src_center.size.height)),
Size2( texture->width, texture->height ) );
if (p_draw_center) {
diff --git a/platform/javascript/audio_server_javascript.cpp b/platform/javascript/audio_server_javascript.cpp
index fbd5d2e1c0..9f82f084e5 100644
--- a/platform/javascript/audio_server_javascript.cpp
+++ b/platform/javascript/audio_server_javascript.cpp
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* audio_server_javascript.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#include "audio_server_javascript.h"
#include "emscripten.h"
diff --git a/platform/javascript/audio_server_javascript.h b/platform/javascript/audio_server_javascript.h
index 1dc90c48ee..bb9a91f78a 100644
--- a/platform/javascript/audio_server_javascript.h
+++ b/platform/javascript/audio_server_javascript.h
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* audio_server_javascript.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#ifndef AUDIO_SERVER_JAVASCRIPT_H
#define AUDIO_SERVER_JAVASCRIPT_H
diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py
index ae33a43f0d..d76a20bea7 100644
--- a/platform/javascript/detect.py
+++ b/platform/javascript/detect.py
@@ -44,6 +44,9 @@ def get_flags():
def configure(env):
+ env['ENV'] = os.environ;
+ env.use_windows_spawn_fix('javascript')
+
env.Append(CPPPATH=['#platform/javascript'])
em_path=os.environ["EMSCRIPTEN_ROOT"]
diff --git a/platform/javascript/dom_keys.h b/platform/javascript/dom_keys.h
index 555c90a529..282b632e93 100644
--- a/platform/javascript/dom_keys.h
+++ b/platform/javascript/dom_keys.h
@@ -220,17 +220,17 @@
#define DOM_VK_WIN_OEM_CLEAR 0xFE
int dom2godot_scancode(int dom_keycode) {
-
+
if (DOM_VK_0 <= dom_keycode && dom_keycode <= DOM_VK_Z) {
// ASCII intersection
return dom_keycode;
}
-
+
if (DOM_VK_NUMPAD0 <= dom_keycode && dom_keycode <= DOM_VK_NUMPAD9) {
// Numpad numbers
return KEY_KP_0 + (dom_keycode - DOM_VK_NUMPAD0);
}
-
+
if (DOM_VK_F1 <= dom_keycode && dom_keycode <= DOM_VK_F16) {
// F1-F16
return KEY_F1 + (dom_keycode - DOM_VK_F1);
@@ -259,7 +259,7 @@ int dom2godot_scancode(int dom_keycode) {
case DOM_VK_PAUSE: return KEY_PAUSE;
case DOM_VK_CAPS_LOCK: return KEY_CAPSLOCK;
-
+
/*
case DOM_VK_KANA: return KEY_UNKNOWN;
case DOM_VK_HANGUL: return KEY_UNKNOWN;
@@ -269,7 +269,7 @@ int dom2godot_scancode(int dom_keycode) {
case DOM_VK_HANJA: return KEY_UNKNOWN;
case DOM_VK_KANJI: return KEY_UNKNOWN;
*/
-
+
case DOM_VK_ESCAPE: return KEY_ESCAPE;
/*
case DOM_VK_CONVERT: return KEY_UNKNOWN;
@@ -277,8 +277,8 @@ int dom2godot_scancode(int dom_keycode) {
case DOM_VK_ACCEPT: return KEY_UNKNOWN;
case DOM_VK_MODECHANGE: return KEY_UNKNOWN;
*/
-
- case DOM_VK_SPACE: return KEY_SPACE;
+
+ case DOM_VK_SPACE: return KEY_SPACE;
case DOM_VK_PAGE_UP: return KEY_PAGEUP;
case DOM_VK_PAGE_DOWN: return KEY_PAGEDOWN;
case DOM_VK_END: return KEY_END;
@@ -287,7 +287,7 @@ int dom2godot_scancode(int dom_keycode) {
case DOM_VK_UP: return KEY_UP;
case DOM_VK_RIGHT: return KEY_RIGHT;
case DOM_VK_DOWN: return KEY_DOWN;
-
+
//case DOM_VK_SELECT: return KEY_UNKNOWN;
case DOM_VK_PRINTSCREEN: // this is the usual printScreen key
@@ -297,7 +297,7 @@ int dom2godot_scancode(int dom_keycode) {
//case DOM_VK_EXECUTE: return KEY_UNKNOWN;
case DOM_VK_INSERT: return KEY_INSERT;
case DOM_VK_DELETE: return KEY_DELETE;
-
+
case DOM_VK_META:
case DOM_VK_WIN:
return KEY_META;
@@ -312,7 +312,7 @@ int dom2godot_scancode(int dom_keycode) {
case DOM_VK_SUBTRACT: return KEY_KP_SUBTRACT;
case DOM_VK_DECIMAL: return KEY_KP_PERIOD;
case DOM_VK_DIVIDE: return KEY_KP_DIVIDE;
-
+
/*
case DOM_VK_F17: return KEY_UNKNOWN;
case DOM_VK_F18: return KEY_UNKNOWN;
@@ -323,7 +323,7 @@ int dom2godot_scancode(int dom_keycode) {
case DOM_VK_F23: return KEY_UNKNOWN;
case DOM_VK_F24: return KEY_UNKNOWN;
*/
-
+
case DOM_VK_NUM_LOCK: return KEY_NUMLOCK;
case DOM_VK_SCROLL_LOCK: return KEY_SCROLLLOCK;
@@ -352,11 +352,11 @@ int dom2godot_scancode(int dom_keycode) {
case DOM_VK_OPEN_CURLY_BRACKET: return KEY_BRACELEFT;
case DOM_VK_CLOSE_CURLY_BRACKET: return KEY_BRACERIGHT;
case DOM_VK_TILDE: return KEY_ASCIITILDE;
-
+
case DOM_VK_VOLUME_MUTE: return KEY_VOLUMEMUTE;
case DOM_VK_VOLUME_DOWN: return KEY_VOLUMEDOWN;
case DOM_VK_VOLUME_UP: return KEY_VOLUMEUP;
-
+
case DOM_VK_COMMA: return KEY_COMMA;
case DOM_VK_PERIOD: return KEY_PERIOD;
case DOM_VK_SLASH: return KEY_SLASH;
@@ -365,9 +365,9 @@ int dom2godot_scancode(int dom_keycode) {
case DOM_VK_BACK_SLASH: return KEY_BACKSLASH;
case DOM_VK_CLOSE_BRACKET: return KEY_BRACKETRIGHT;
case DOM_VK_QUOTE: return KEY_APOSTROPHE;
-
+
// rest is OEM/unusual
-
+
default: return KEY_UNKNOWN;
};
}
diff --git a/platform/osx/detect.py b/platform/osx/detect.py
index 1f176dc22a..1982beb10e 100644
--- a/platform/osx/detect.py
+++ b/platform/osx/detect.py
@@ -28,10 +28,9 @@ def get_opts():
def get_flags():
return [
- ('opengl', 'no'),
('legacygl', 'yes'),
('builtin_zlib', 'no'),
- ('freetype','builtin'), #use builtin freetype
+ ('glew', 'yes'),
]
@@ -56,21 +55,18 @@ def configure(env):
env.Append(CCFLAGS=['-g3', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
- if (env["freetype"]!="no"):
- env.Append(CCFLAGS=['-DFREETYPE_ENABLED'])
- env.Append(CPPPATH=['#tools/freetype'])
- env.Append(CPPPATH=['#tools/freetype/freetype/include'])
-
-
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'])
- else:
+ 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)
@@ -91,11 +87,8 @@ def configure(env):
# env.Append(LIBPATH=['#platform/osx/lib'])
- #if env['opengl'] == 'yes':
- # env.Append(CPPFLAGS=['-DOPENGL_ENABLED','-DGLEW_ENABLED'])
-
env.Append(CPPFLAGS=["-DAPPLE_STYLE_KEYS"])
- env.Append(CPPFLAGS=['-DUNIX_ENABLED','-DGLES2_ENABLED','-DGLEW_ENABLED', '-DOSX_ENABLED'])
+ 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'])
diff --git a/platform/osx/dir_access_osx.h b/platform/osx/dir_access_osx.h
index 8b742b64fa..d20eee1e2e 100644
--- a/platform/osx/dir_access_osx.h
+++ b/platform/osx/dir_access_osx.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* dir_access_unix.h */
+/* dir_access_osx.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -37,52 +37,16 @@
#include <dirent.h>
#include "os/dir_access.h"
+#include "drivers/unix/dir_access_unix.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
-class DirAccessOSX : public DirAccess {
+class DirAccessOSX : public DirAccessUnix {
+protected:
- DIR *dir_stream;
-
- static DirAccess *create_fs();
-
- String current_dir;
- bool _cisdir;
- bool _cishidden;
-
-public:
-
- virtual bool list_dir_begin(); ///< This starts dir listing
- virtual String get_next();
- virtual bool current_is_dir() const;
- virtual bool current_is_hidden() const;
-
- virtual void list_dir_end(); ///<
-
- virtual int get_drive_count();
- virtual String get_drive(int p_drive);
-
- virtual Error change_dir(String p_dir); ///< can be relative or absolute, return false on success
- virtual String get_current_dir(); ///< return current dir location
- virtual Error make_dir(String p_dir);
-
- virtual bool file_exists(String p_file);
- virtual bool dir_exists(String p_dir);
-
- virtual uint64_t get_modified_time(String p_file);
-
-
-
- virtual Error rename(String p_from, String p_to);
- virtual Error remove(String p_name);
-
- virtual size_t get_space_left();
-
-
- DirAccessOSX();
- ~DirAccessOSX();
+ virtual String fix_unicode_name(const char* p_name) const;
};
diff --git a/platform/osx/dir_access_osx.mm b/platform/osx/dir_access_osx.mm
index 20dc1df8f4..5615858262 100644
--- a/platform/osx/dir_access_osx.mm
+++ b/platform/osx/dir_access_osx.mm
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* dir_access_unix.cpp */
+/* dir_access_osx.mm */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -30,324 +30,21 @@
#if defined(UNIX_ENABLED) || defined(LIBC_FILEIO_ENABLED)
-#ifndef ANDROID_ENABLED
-#include <sys/statvfs.h>
-#endif
-
-#include <stdio.h>
-#include "os/memory.h"
-#include "print_string.h"
#include <errno.h>
#include <Foundation/NSString.h>
-DirAccess *DirAccessOSX::create_fs() {
-
- return memnew( DirAccessOSX );
-}
-
-bool DirAccessOSX::list_dir_begin() {
-
- list_dir_end(); //close any previous dir opening!
-
-
-// char real_current_dir_name[2048]; //is this enough?!
- //getcwd(real_current_dir_name,2048);
- //chdir(curent_path.utf8().get_data());
- dir_stream = opendir(current_dir.utf8().get_data());
- //chdir(real_current_dir_name);
- if (!dir_stream)
- return true; //error!
-
- return false;
-}
-
-bool DirAccessOSX::file_exists(String p_file) {
-
- GLOBAL_LOCK_FUNCTION
-
-
- if (p_file.is_rel_path())
- p_file=current_dir+"/"+p_file;
- else
- p_file=fix_path(p_file);
-
- struct stat flags;
- bool success = (stat(p_file.utf8().get_data(),&flags)==0);
-
- if (success && S_ISDIR(flags.st_mode)) {
- success=false;
- }
-
- return success;
-
-}
-
-bool DirAccessOSX::dir_exists(String p_dir) {
-
- GLOBAL_LOCK_FUNCTION
-
-
- if (p_dir.is_rel_path())
- p_dir=get_current_dir().plus_file(p_dir);
- else
- p_dir=fix_path(p_dir);
-
- struct stat flags;
- bool success = (stat(p_dir.utf8().get_data(),&flags)==0);
-
- if (success && S_ISDIR(flags.st_mode))
- return true;
-
- return false;
-
-}
-
-uint64_t DirAccessOSX::get_modified_time(String p_file) {
-
- if (p_file.is_rel_path())
- p_file=current_dir+"/"+p_file;
- else
- p_file=fix_path(p_file);
-
- struct stat flags;
- bool success = (stat(p_file.utf8().get_data(),&flags)==0);
- if (success) {
- return flags.st_mtime;
- } else {
-
- ERR_FAIL_V(0);
- };
- return 0;
-};
-
-
-String DirAccessOSX::get_next() {
-
- if (!dir_stream)
- return "";
- dirent *entry;
-
- entry=readdir(dir_stream);
-
- if (entry==NULL) {
-
- list_dir_end();
- return "";
- }
-
- //typedef struct stat Stat;
- struct stat flags;
+String DirAccessOSX::fix_unicode_name(const char* p_name) const {
String fname;
- NSString* nsstr = [[NSString stringWithUTF8String: entry->d_name] precomposedStringWithCanonicalMapping];
+ NSString* nsstr = [[NSString stringWithUTF8String: p_name] precomposedStringWithCanonicalMapping];
fname.parse_utf8([nsstr UTF8String]);
- //[nsstr autorelease];
-
- String f=current_dir+"/"+fname;
-
- if (stat(f.utf8().get_data(),&flags)==0) {
-
- if (S_ISDIR(flags.st_mode)) {
-
- _cisdir=true;
-
- } else {
-
- _cisdir=false;
- }
-
- } else {
-
- _cisdir=false;
-
- }
-
- _cishidden=(fname!="." && fname!=".." && fname.begins_with("."));
-
-
-
return fname;
-
-}
-
-bool DirAccessOSX::current_is_dir() const {
-
- return _cisdir;
-}
-
-bool DirAccessOSX::current_is_hidden() const {
-
- return _cishidden;
-}
-
-
-void DirAccessOSX::list_dir_end() {
-
- if (dir_stream)
- closedir(dir_stream);
- dir_stream=0;
- _cisdir=false;
-}
-
-int DirAccessOSX::get_drive_count() {
-
- return 0;
-}
-String DirAccessOSX::get_drive(int p_drive) {
-
- return "";
-}
-
-Error DirAccessOSX::make_dir(String p_dir) {
-
- GLOBAL_LOCK_FUNCTION
-
- p_dir=fix_path(p_dir);
-
- char real_current_dir_name[2048];
- getcwd(real_current_dir_name,2048);
- chdir(current_dir.utf8().get_data()); //ascii since this may be unicode or wathever the host os wants
-
- bool success=(mkdir(p_dir.utf8().get_data(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH)==0);
- int err = errno;
-
- chdir(real_current_dir_name);
-
- if (success) {
- return OK;
- };
-
- if (err == EEXIST) {
- return ERR_ALREADY_EXISTS;
- };
-
- return ERR_CANT_CREATE;
}
-Error DirAccessOSX::change_dir(String p_dir) {
-
- GLOBAL_LOCK_FUNCTION
- p_dir=fix_path(p_dir);
-
-
- char real_current_dir_name[2048];
- getcwd(real_current_dir_name,2048);
- String prev_dir;
- if (prev_dir.parse_utf8(real_current_dir_name))
- prev_dir=real_current_dir_name; //no utf8, maybe latin?
-
- chdir(current_dir.utf8().get_data()); //ascii since this may be unicode or wathever the host os wants
- bool worked=(chdir(p_dir.utf8().get_data())==0); // we can only give this utf8
-#ifndef IPHONE_ENABLED
- String base = _get_root_path();
- if (base!="") {
-
- getcwd(real_current_dir_name,2048);
- String new_dir;
- new_dir.parse_utf8(real_current_dir_name);
- if (!new_dir.begins_with(base))
- worked=false;
- }
-#endif
- if (worked) {
-
- getcwd(real_current_dir_name,2048);
- if (current_dir.parse_utf8(real_current_dir_name))
- current_dir=real_current_dir_name; //no utf8, maybe latin?
- }
-
- chdir(prev_dir.utf8().get_data());
- return worked?OK:ERR_INVALID_PARAMETER;
-
-}
-
-String DirAccessOSX::get_current_dir() {
-
- String base = _get_root_path();
- if (base!="") {
-
- String bd = current_dir.replace_first(base,"");
- if (bd.begins_with("/"))
- return _get_root_string()+bd.substr(1,bd.length());
- else
- return _get_root_string()+bd;
-
- }
- return current_dir;
-}
-
-Error DirAccessOSX::rename(String p_path,String p_new_path) {
-
- if (p_path.is_rel_path())
- p_path=get_current_dir().plus_file(p_path);
- else
- p_path=fix_path(p_path);
-
- if (p_new_path.is_rel_path())
- p_new_path=get_current_dir().plus_file(p_new_path);
- else
- p_new_path=fix_path(p_new_path);
-
- return ::rename(p_path.utf8().get_data(),p_new_path.utf8().get_data())==0?OK:FAILED;
-}
-Error DirAccessOSX::remove(String p_path) {
-
- if (p_path.is_rel_path())
- p_path=get_current_dir().plus_file(p_path);
- else
- p_path=fix_path(p_path);
-
- struct stat flags;
- if ((stat(p_path.utf8().get_data(),&flags)!=0))
- return FAILED;
-
- if (S_ISDIR(flags.st_mode))
- return ::rmdir(p_path.utf8().get_data())==0?OK:FAILED;
- else
- return ::unlink(p_path.utf8().get_data())==0?OK:FAILED;
-}
-
-
-size_t DirAccessOSX::get_space_left() {
-
-#ifndef NO_STATVFS
- struct statvfs vfs;
- if (statvfs(current_dir.utf8().get_data(), &vfs) != 0) {
-
- return -1;
- };
-
- return vfs.f_bfree * vfs.f_bsize;
-#else
-#warning THIS IS BROKEN
- return 0;
-#endif
-};
-
-
-
-DirAccessOSX::DirAccessOSX() {
-
- dir_stream=0;
- current_dir=".";
- _cisdir=false;
-
- /* determine drive count */
-
- change_dir(current_dir);
-
-}
-
-
-DirAccessOSX::~DirAccessOSX() {
-
- list_dir_end();
-}
-
#endif //posix_enabled
diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp
index 3bc4ebdb1a..cb0514da9d 100644
--- a/platform/osx/export/export.cpp
+++ b/platform/osx/export/export.cpp
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* export.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#include "version.h"
#include "export.h"
#include "tools/editor/editor_settings.h"
@@ -32,6 +60,7 @@ class EditorExportPlatformOSX : public EditorExportPlatform {
String signature;
String copyright;
bool use64;
+ bool useFat;
bool high_resolution;
Ref<ImageTexture> logo;
@@ -95,6 +124,8 @@ bool EditorExportPlatformOSX::_set(const StringName& p_name, const Variant& p_va
copyright=p_value;
else if (n=="application/64_bits")
use64=p_value;
+ else if (n=="application/fat_bits")
+ useFat=p_value;
else if (n=="display/high_res")
high_resolution=p_value;
else
@@ -129,6 +160,8 @@ bool EditorExportPlatformOSX::_get(const StringName& p_name,Variant &r_ret) cons
r_ret=copyright;
else if (n=="application/64_bits")
r_ret=use64;
+ else if (n=="application/fat_bits")
+ r_ret=useFat;
else if (n=="display/high_res")
r_ret=high_resolution;
else
@@ -150,6 +183,7 @@ void EditorExportPlatformOSX::_get_property_list( List<PropertyInfo> *p_list) co
p_list->push_back( PropertyInfo( Variant::STRING, "application/version") );
p_list->push_back( PropertyInfo( Variant::STRING, "application/copyright") );
p_list->push_back( PropertyInfo( Variant::BOOL, "application/64_bits") );
+ p_list->push_back( PropertyInfo( Variant::BOOL, "application/fat_bits") );
p_list->push_back( PropertyInfo( Variant::BOOL, "display/high_res") );
@@ -287,7 +321,7 @@ Error EditorExportPlatformOSX::export_project(const String& p_path, bool p_debug
io2.opaque=&dst_f;
zipFile dpkg=zipOpen2(p_path.utf8().get_data(),APPEND_STATUS_CREATE,NULL,&io2);
- String binary_to_use="godot_osx_"+String(p_debug?"debug":"release")+"."+String(use64?"64":"32");
+ String binary_to_use="godot_osx_"+String(p_debug?"debug":"release")+"."+String(useFat?"fat":use64?"64":"32");
print_line("binary: "+binary_to_use);
String pkg_name;
@@ -459,6 +493,7 @@ EditorExportPlatformOSX::EditorExportPlatformOSX() {
short_version="1.0";
version="1.0";
use64=false;
+ useFat=false;
high_resolution=false;
}
diff --git a/platform/osx/export/export.h b/platform/osx/export/export.h
index b149e482c9..8e0b83b457 100644
--- a/platform/osx/export/export.h
+++ b/platform/osx/export/export.h
@@ -1,3 +1,29 @@
-
-
+/*************************************************************************/
+/* export.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
void register_osx_exporter();
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index d88dd89002..8d64686335 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.h
@@ -59,7 +59,7 @@ public:
bool force_quit;
Rasterizer *rasterizer;
VisualServer *visual_server;
- VideoMode current_videomode;
+
List<String> args;
MainLoop *main_loop;
unsigned int event_id;
@@ -104,9 +104,22 @@ public:
bool minimized;
bool maximized;
bool zoomed;
+
Vector<Rect2> screens;
+ Vector<int> screen_dpi;
+
+ Size2 window_size;
int current_screen;
Rect2 restore_rect;
+
+ float _mouse_scale(float p_scale) {
+ if (display_scale>1.0)
+ return p_scale;
+ else
+ return 1.0;
+ }
+
+ float display_scale;
protected:
virtual int get_video_driver_count() const;
@@ -173,6 +186,9 @@ public:
virtual int get_current_screen() const;
virtual void set_current_screen(int p_screen);
virtual Point2 get_screen_position(int p_screen=0) const;
+ virtual Size2 get_screen_size(int p_screen=0) const;
+ virtual int get_screen_dpi(int p_screen=0) const;
+
virtual Point2 get_window_position() const;
virtual void set_window_position(const Point2& p_position);
virtual void set_window_size(const Size2 p_size);
@@ -184,7 +200,6 @@ public:
virtual bool is_window_minimized() const;
virtual void set_window_maximized(bool p_enabled);
virtual bool is_window_maximized() const;
- Size2 get_screen_size(int p_screen=0) const;
void run();
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index c443fc2d0e..b5503fcd73 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -139,12 +139,10 @@ static int button_mask=0;
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
{
-/* _Godotwindow* window;
+ if (OS_OSX::singleton->get_main_loop())
+ OS_OSX::singleton->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_QUIT_REQUEST);
- for (window = _Godot.windowListHead; window; window = window->next)
- _GodotInputWindowCloseRequest(window);
-*/
- return NSTerminateCancel;
+ return NSTerminateCancel;
}
- (void)applicationDidHide:(NSNotification *)notification
@@ -202,10 +200,10 @@ static int button_mask=0;
[OS_OSX::singleton->context update];
const NSRect contentRect = [OS_OSX::singleton->window_view frame];
- const NSRect fbRect = convertRectToBacking(contentRect);
+ const NSRect fbRect = contentRect;//convertRectToBacking(contentRect);
- OS_OSX::singleton->current_videomode.width=fbRect.size.width;
- OS_OSX::singleton->current_videomode.height=fbRect.size.height;
+ OS_OSX::singleton->window_size.width=fbRect.size.width*OS_OSX::singleton->display_scale;
+ OS_OSX::singleton->window_size.height=fbRect.size.height*OS_OSX::singleton->display_scale;
// _GodotInputFramebufferSize(window, fbRect.size.width, fbRect.size.height);
@@ -291,16 +289,52 @@ static int button_mask=0;
self = [super init];
trackingArea = nil;
[self updateTrackingAreas];
-
+ [self registerForDraggedTypes:[NSArray arrayWithObject:NSFilenamesPboardType]];
return self;
}
+
-(void)dealloc
{
[trackingArea release];
[super dealloc];
}
+- (NSDragOperation)draggingEntered:(id < NSDraggingInfo >)sender {
+ return NSDragOperationCopy;
+}
+
+- (NSDragOperation)draggingUpdated:(id<NSDraggingInfo>)sender {
+ return NSDragOperationCopy;
+}
+
+- (BOOL)performDragOperation:(id<NSDraggingInfo>)sender {
+
+
+ NSPasteboard *pboard = [sender draggingPasteboard];
+ NSArray *filenames = [pboard propertyListForType:NSFilenamesPboardType];
+
+ Vector<String> files;
+ for(int i=0;i<filenames.count;i++) {
+ NSString *ns = [filenames objectAtIndex:i];
+ char *utfs = strdup([ns UTF8String]);
+ String ret;
+ ret.parse_utf8(utfs);
+ free(utfs);
+ files.push_back(ret);
+
+
+ }
+
+ if (files.size()) {
+ OS_OSX::singleton->main_loop->drop_files(files,0);
+ OS_OSX::singleton->move_window_to_foreground();
+ }
+
+ return NO;
+}
+
+
- (BOOL)isOpaque
{
return YES;
@@ -324,7 +358,7 @@ static int button_mask=0;
- (void)mouseDown:(NSEvent *)event
{
- print_line("mouse down:");
+ //print_line("mouse down:");
button_mask|=BUTTON_MASK_LEFT;
InputEvent ev;
ev.type=InputEvent::MOUSE_BUTTON;
@@ -383,14 +417,14 @@ static int button_mask=0;
prev_mouse_y=mouse_y;
const NSRect contentRect = [OS_OSX::singleton->window_view frame];
const NSPoint p = [event locationInWindow];
- mouse_x = p.x * [[event window] backingScaleFactor];
- mouse_y = (contentRect.size.height - p.y) * [[event window] backingScaleFactor];
+ mouse_x = p.x * OS_OSX::singleton->_mouse_scale([[event window] backingScaleFactor]);
+ mouse_y = (contentRect.size.height - p.y) * OS_OSX::singleton->_mouse_scale([[event window] backingScaleFactor]);
ev.mouse_motion.x=mouse_x;
ev.mouse_motion.y=mouse_y;
ev.mouse_motion.global_x=mouse_x;
ev.mouse_motion.global_y=mouse_y;
- ev.mouse_motion.relative_x=[event deltaX] * [[event window] backingScaleFactor];
- ev.mouse_motion.relative_y=[event deltaY] * [[event window] backingScaleFactor];
+ ev.mouse_motion.relative_x=[event deltaX] * OS_OSX::singleton->_mouse_scale([[event window] backingScaleFactor]);
+ ev.mouse_motion.relative_y=[event deltaY] * OS_OSX::singleton->_mouse_scale([[event window] backingScaleFactor]);
ev.mouse_motion.mod = translateFlags([event modifierFlags]);
OS_OSX::singleton->input->set_mouse_pos(Point2(mouse_x,mouse_y));
@@ -736,20 +770,48 @@ static int translateKey(unsigned int key)
- (void)flagsChanged:(NSEvent *)event
{
- /* int action;
- unsigned int newModifierFlags =
- [event modifierFlags] & NSDeviceIndependentModifierFlagsMask;
+ InputEvent ev;
+ int key = [event keyCode];
+ int mod = [event modifierFlags];
- if (newModifierFlags > window->ns.modifierFlags)
- action = GLFW_PRESS;
- else
- action = GLFW_RELEASE;
+ ev.type=InputEvent::KEY;
- window->ns.modifierFlags = newModifierFlags;
+ if (key == 0x36 || key == 0x37) {
+ if (mod & NSCommandKeyMask) {
+ mod&= ~NSCommandKeyMask;
+ ev.key.pressed = true;
+ } else {
+ ev.key.pressed = false;
+ }
+ } else if (key == 0x38 || key == 0x3c) {
+ if (mod & NSShiftKeyMask) {
+ mod&= ~NSShiftKeyMask;
+ ev.key.pressed = true;
+ } else {
+ ev.key.pressed = false;
+ }
+ } else if (key == 0x3a || key == 0x3d) {
+ if (mod & NSAlternateKeyMask) {
+ mod&= ~NSAlternateKeyMask;
+ ev.key.pressed = true;
+ } else {
+ ev.key.pressed = false;
+ }
+ } else if (key == 0x3b || key == 0x3e) {
+ if (mod & NSControlKeyMask) {
+ mod&= ~NSControlKeyMask;
+ ev.key.pressed = true;
+ } else {
+ ev.key.pressed = false;
+ }
+ } else {
+ return;
+ }
- const int key = translateKey([event keyCode]);
- const int mods = translateFlags([event modifierFlags]);
- _glfwInputKey(window, key, [event keyCode], action, mods);*/
+ ev.key.mod=translateFlags(mod);
+ ev.key.scancode = latin_keyboard_keycode_convert(translateKey(key));
+
+ OS_OSX::singleton->push_input(ev);
}
- (void)keyUp:(NSEvent *)event
@@ -833,6 +895,7 @@ static int translateKey(unsigned int key)
@implementation GodotWindow
+
- (BOOL)canBecomeKeyWindow
{
// Required for NSBorderlessWindowMask windows
@@ -893,6 +956,15 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
kTISNotifySelectedKeyboardInputSourceChanged, NULL,
CFNotificationSuspensionBehaviorDeliverImmediately);
+ if (is_hidpi_allowed() && [[NSScreen mainScreen] respondsToSelector:@selector(backingScaleFactor)]) {
+ for (NSScreen *screen in [NSScreen screens]) {
+ float s = [screen backingScaleFactor];
+ if (s > display_scale) {
+ display_scale=s;
+ }
+ }
+ }
+
window_delegate = [[GodotWindowDelegate alloc] init];
// Don't use accumulation buffer support; it's not accelerated
@@ -902,7 +974,7 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
window_object = [[GodotWindow alloc]
- initWithContentRect:NSMakeRect(0, 0, p_desired.width, p_desired.height)
+ initWithContentRect:NSMakeRect(0, 0, p_desired.width/display_scale, p_desired.height/display_scale)
styleMask:styleMask
backing:NSBackingStoreBuffered
defer:NO];
@@ -911,15 +983,11 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
window_view = [[GodotContentView alloc] init];
- current_videomode = p_desired;
-
- // Adjust for display density
- const NSRect fbRect = convertRectToBacking(NSMakeRect(0, 0, p_desired.width, p_desired.height));
- current_videomode.width = fbRect.size.width;
- current_videomode.height = fbRect.size.height;
+ 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) {
+ if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6 && display_scale>1) {
[window_view setWantsBestResolutionOpenGLSurface:YES];
//if (current_videomode.resizable)
[window_object setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
@@ -1062,9 +1130,28 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
printf("nscreen count %i\n", (int)[screenArray count]);
for (int i=0; i<[screenArray count]; i++) {
+ float displayScale = 1.0;
+
+ if (display_scale>1.0 && [[screenArray objectAtIndex: i] respondsToSelector:@selector(backingScaleFactor)]) {
+ displayScale = [[screenArray objectAtIndex: i] backingScaleFactor];
+ }
+
NSRect nsrect = [[screenArray objectAtIndex: i] visibleFrame];
- screens.push_back(Rect2(nsrect.origin.x, nsrect.origin.y, nsrect.size.width, nsrect.size.height));
- printf("added screen %i\n", screens.size());
+ Rect2 rect = Rect2(nsrect.origin.x, nsrect.origin.y, nsrect.size.width, nsrect.size.height);
+ rect.pos*=displayScale;
+ rect.size*=displayScale;
+ screens.push_back(rect);
+
+ NSDictionary *description = [[screenArray objectAtIndex: i] deviceDescription];
+ NSSize displayPixelSize = [[description objectForKey:NSDeviceSize] sizeValue];
+ CGSize displayPhysicalSize = CGDisplayScreenSize(
+ [[description objectForKey:@"NSScreenNumber"] unsignedIntValue]);
+
+ //printf("width: %i pwidth %i rect width %i\n",int(displayPixelSize.width*displayScale),int(displayPhysicalSize.width*displayScale),int(nsrect.size.width));
+ int dpi = (displayPixelSize.width * 25.4f / displayPhysicalSize.width)*displayScale;
+
+ screen_dpi.push_back(dpi);
+
};
restore_rect = Rect2(get_window_position(), get_window_size());
}
@@ -1326,7 +1413,11 @@ void OS_OSX::set_video_mode(const VideoMode& p_video_mode,int p_screen) {
OS::VideoMode OS_OSX::get_video_mode(int p_screen) const {
- return current_videomode;
+ VideoMode vm;
+ vm.width=window_size.width;
+ vm.height=window_size.height;
+
+ return vm;
}
void OS_OSX::get_fullscreen_mode_list(List<VideoMode> *p_list,int p_screen) const {
@@ -1354,6 +1445,12 @@ Point2 OS_OSX::get_screen_position(int p_screen) const {
return screens[p_screen].pos;
};
+int OS_OSX::get_screen_dpi(int p_screen) const {
+
+ ERR_FAIL_INDEX_V(p_screen, screens.size(), 72);
+ return screen_dpi[p_screen];
+}
+
Size2 OS_OSX::get_screen_size(int p_screen) const {
ERR_FAIL_INDEX_V(p_screen, screens.size(), Point2());
@@ -1362,24 +1459,30 @@ Size2 OS_OSX::get_screen_size(int p_screen) const {
Point2 OS_OSX::get_window_position() const {
- return Size2([window_object frame].origin.x, [window_object frame].origin.y);
+ Size2 wp([window_object frame].origin.x, [window_object frame].origin.y);
+ wp*=display_scale;
+ return wp;
};
void OS_OSX::set_window_position(const Point2& p_position) {
- [window_object setFrame:NSMakeRect(p_position.x, p_position.y, [window_object frame].size.width, [window_object frame].size.height) display:YES];
+ Point2 size=p_position;
+ size/=display_scale;
+ [window_object setFrame:NSMakeRect(size.x, size.y, [window_object frame].size.width, [window_object frame].size.height) display:YES];
};
Size2 OS_OSX::get_window_size() const {
- return Size2([window_object frame].size.width, [window_object frame].size.height);
+ return window_size;
+
};
void OS_OSX::set_window_size(const Size2 p_size) {
+ Size2 size=p_size;
NSRect frame = [window_object frame];
- [window_object setFrame:NSMakeRect(frame.origin.x, frame.origin.y, p_size.x, p_size.y) display:YES];
+ [window_object setFrame:NSMakeRect(frame.origin.x, frame.origin.y, size.x, size.y) display:YES];
};
void OS_OSX::set_window_fullscreen(bool p_enabled) {
@@ -1690,5 +1793,7 @@ OS_OSX::OS_OSX() {
maximized = false;
minimized = false;
+ window_size=Vector2(1024,600);
zoomed = false;
+ display_scale=1.0;
}
diff --git a/platform/osx/platform_config.h b/platform/osx/platform_config.h
index 085f13df73..86505206ae 100644
--- a/platform/osx/platform_config.h
+++ b/platform/osx/platform_config.h
@@ -27,6 +27,5 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include <alloca.h>
-#define GLES2_INCLUDE_H "gl_context/glew.h"
-#define GLES1_INCLUDE_H "gl_context/glew.h"
+#define GLES2_INCLUDE_H "gl_context/GL/glew.h"
#define PTHREAD_RENAME_SELF
diff --git a/platform/server/platform_config.h b/platform/server/platform_config.h
index 72b10a0fb2..143f16c1fa 100644
--- a/platform/server/platform_config.h
+++ b/platform/server/platform_config.h
@@ -27,4 +27,3 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include <alloca.h>
-
diff --git a/platform/windows/context_gl_win.cpp b/platform/windows/context_gl_win.cpp
index ab66b81421..fd9e895370 100644
--- a/platform/windows/context_gl_win.cpp
+++ b/platform/windows/context_gl_win.cpp
@@ -96,6 +96,20 @@ static GLWrapperFuncPtr wrapper_get_proc_address(const char* p_function) {
}
*/
+void ContextGL_Win::set_use_vsync(bool p_use) {
+
+ if (wglSwapIntervalEXT) {
+ wglSwapIntervalEXT(p_use?1:0);
+ }
+ use_vsync=p_use;
+
+}
+
+bool ContextGL_Win::is_using_vsync() const {
+
+ return use_vsync;
+}
+
Error ContextGL_Win::initialize() {
@@ -184,7 +198,7 @@ Error ContextGL_Win::initialize() {
printf("Activated GL 3.1 context");
}
-
+ wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC) wglGetProcAddress ("wglSwapIntervalEXT");
// glWrapperInit(wrapper_get_proc_address);
return OK;
@@ -194,6 +208,7 @@ ContextGL_Win::ContextGL_Win(HWND hwnd,bool p_opengl_3_context) {
opengl_3_context=p_opengl_3_context;
hWnd=hwnd;
+ use_vsync=false;
}
ContextGL_Win::~ContextGL_Win() {
diff --git a/platform/windows/context_gl_win.h b/platform/windows/context_gl_win.h
index 055e0b2f51..e1ab6fb26a 100644
--- a/platform/windows/context_gl_win.h
+++ b/platform/windows/context_gl_win.h
@@ -49,6 +49,8 @@
#include <windows.h>
+typedef bool (APIENTRY *PFNWGLSWAPINTERVALEXTPROC) (int interval);
+
class ContextGL_Win : public ContextGL {
HDC hDC;
@@ -56,6 +58,10 @@ class ContextGL_Win : public ContextGL {
unsigned int pixel_format;
HWND hWnd;
bool opengl_3_context;
+ bool use_vsync;
+
+
+ PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT;
public:
@@ -69,6 +75,8 @@ public:
virtual Error initialize();
+ virtual void set_use_vsync(bool p_use);
+ virtual bool is_using_vsync() const;
ContextGL_Win(HWND hwnd,bool p_opengl_3_context);
~ContextGL_Win();
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 56e8a5d45d..320fb9d269 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -168,7 +168,7 @@ def get_opts():
def get_flags():
return [
- ('freetype','builtin'), #use builtin freetype
+ ('glew','yes'),
('openssl','builtin'), #use builtin openssl
]
@@ -202,10 +202,6 @@ def configure(env):
env.Append(CPPPATH=['#platform/windows/include'])
env.Append(LIBPATH=['#platform/windows/lib'])
- if (env["freetype"]!="no"):
- env.Append(CCFLAGS=['/DFREETYPE_ENABLED'])
- env.Append(CPPPATH=['#tools/freetype'])
- env.Append(CPPPATH=['#tools/freetype/freetype/include'])
if (env["target"]=="release"):
@@ -242,7 +238,6 @@ def configure(env):
env.Append(CCFLAGS=['/DGLES2_ENABLED'])
- env.Append(CCFLAGS=['/DGLEW_ENABLED'])
LIBS=['winmm','opengl32','dsound','kernel32','ole32','oleaut32','user32','gdi32', 'IPHLPAPI','Shlwapi', 'wsock32', 'shell32','advapi32','dinput8','dxguid']
env.Append(LINKFLAGS=[p+env["LIBSUFFIX"] for p in LIBS])
@@ -350,10 +345,7 @@ def configure(env):
env.Append(CCFLAGS=['-g', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
- if (env["freetype"]!="no"):
- env.Append(CCFLAGS=['-DFREETYPE_ENABLED'])
- env.Append(CPPPATH=['#tools/freetype'])
- env.Append(CPPPATH=['#tools/freetype/freetype/include'])
+
env["CC"]=mingw_prefix+"gcc"
env['AS']=mingw_prefix+"as"
@@ -368,7 +360,7 @@ def configure(env):
env.Append(CCFLAGS=['-DWINDOWS_ENABLED','-mwindows'])
env.Append(CPPFLAGS=['-DRTAUDIO_ENABLED'])
- env.Append(CCFLAGS=['-DGLES2_ENABLED','-DGLEW_ENABLED'])
+ env.Append(CCFLAGS=['-DGLES2_ENABLED'])
env.Append(LIBS=['mingw32','opengl32', 'dsound', 'ole32', 'd3d9','winmm','gdi32','iphlpapi','shlwapi','wsock32','kernel32', 'oleaut32', 'dinput8', 'dxguid'])
# if (env["bits"]=="32"):
diff --git a/platform/windows/export/export.cpp b/platform/windows/export/export.cpp
index 952f51fdd4..9bf9ba93fe 100644
--- a/platform/windows/export/export.cpp
+++ b/platform/windows/export/export.cpp
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* export.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#include "export.h"
#include "platform/windows/logo.h"
#include "tools/editor/editor_import_export.h"
diff --git a/platform/windows/export/export.h b/platform/windows/export/export.h
index 68ce500a20..aa3578fb98 100644
--- a/platform/windows/export/export.h
+++ b/platform/windows/export/export.h
@@ -1,4 +1,29 @@
-
-
+/*************************************************************************/
+/* export.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
void register_windows_exporter();
-
diff --git a/platform/windows/godot.ico b/platform/windows/godot.ico
index e57ce36529..3e52f2e52f 100644
--- a/platform/windows/godot.ico
+++ b/platform/windows/godot.ico
Binary files differ
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index c9c7780a2a..630d5715e9 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -708,7 +708,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) {
case WM_SETCURSOR: {
if(LOWORD(lParam) == HTCLIENT) {
- if(mouse_mode == MOUSE_MODE_HIDDEN) {
+ if(mouse_mode == MOUSE_MODE_HIDDEN || mouse_mode == MOUSE_MODE_CAPTURED) {
//Hide the cursor
if(hCursor == NULL)
hCursor = SetCursor(NULL);
@@ -724,6 +724,32 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) {
}
} break;
+ case WM_DROPFILES: {
+
+ HDROP hDropInfo = NULL;
+ hDropInfo = (HDROP) wParam;
+ const int buffsize=4096;
+ wchar_t buf[buffsize];
+
+ int fcount = DragQueryFileW(hDropInfo, 0xFFFFFFFF,NULL,0);
+
+ Vector<String> files;
+
+ for(int i=0;i<fcount;i++) {
+
+ DragQueryFileW(hDropInfo, i, buf, buffsize);
+ String file=buf;
+ files.push_back(file);
+ }
+
+ if (files.size() && main_loop) {
+ main_loop->drop_files(files,0);
+ }
+
+
+ } break;
+
+
default: {
@@ -748,6 +774,8 @@ LRESULT CALLBACK WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) {
}
+
+
void OS_Windows::process_key_events() {
for(int i=0;i<key_event_pos;i++) {
@@ -767,7 +795,7 @@ void OS_Windows::process_key_events() {
k.mod=ke.mod_state;
k.pressed=true;
k.scancode=KeyMappingWindows::get_keysym(ke.wParam);
- k.unicode=ke.wParam;
+ k.unicode=ke.wParam;
if (k.unicode && gr_mem) {
k.mod.alt=false;
k.mod.control=false;
@@ -819,6 +847,75 @@ void OS_Windows::process_key_events() {
key_event_pos=0;
}
+enum _MonitorDpiType
+{
+ MDT_Effective_DPI = 0,
+ MDT_Angular_DPI = 1,
+ MDT_Raw_DPI = 2,
+ MDT_Default = MDT_Effective_DPI
+};
+
+
+static int QueryDpiForMonitor(HMONITOR hmon, _MonitorDpiType dpiType= MDT_Default)
+{
+
+
+ int dpiX = 96, dpiY = 96;
+
+ static HMODULE Shcore = NULL;
+ typedef HRESULT (WINAPI* GetDPIForMonitor_t)(HMONITOR hmonitor, _MonitorDpiType dpiType, UINT *dpiX, UINT *dpiY);
+ static GetDPIForMonitor_t getDPIForMonitor = NULL;
+
+ if (Shcore == NULL)
+ {
+ Shcore = LoadLibraryW(L"Shcore.dll");
+ getDPIForMonitor = Shcore ? (GetDPIForMonitor_t)GetProcAddress(Shcore, "GetDpiForMonitor") : NULL;
+
+ if ((Shcore == NULL) || (getDPIForMonitor == NULL))
+ {
+ if (Shcore)
+ FreeLibrary(Shcore);
+ Shcore = (HMODULE)INVALID_HANDLE_VALUE;
+ }
+ }
+
+ UINT x = 0, y = 0;
+ HRESULT hr = E_FAIL;
+ bool bSet = false;
+ if (hmon && (Shcore != (HMODULE)INVALID_HANDLE_VALUE))
+ {
+ hr = getDPIForMonitor(hmon, dpiType/*MDT_Effective_DPI*/, &x, &y);
+ if (SUCCEEDED(hr) && (x > 0) && (y > 0))
+ {
+
+ dpiX = (int)x;
+ dpiY = (int)y;
+ }
+ }
+ else
+ {
+ static int overallX = 0, overallY = 0;
+ if (overallX <= 0 || overallY <= 0)
+ {
+ HDC hdc = GetDC(NULL);
+ if (hdc)
+ {
+ overallX = GetDeviceCaps(hdc, LOGPIXELSX);
+ overallY = GetDeviceCaps(hdc, LOGPIXELSY);
+ ReleaseDC(NULL, hdc);
+ }
+ }
+ if (overallX > 0 && overallY > 0)
+ {
+ dpiX = overallX; dpiY = overallY;
+ }
+ }
+
+
+ return (dpiX+dpiY)/2;
+}
+
+
BOOL CALLBACK OS_Windows::MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) {
OS_Windows *self=(OS_Windows*)OS::get_singleton();
MonitorInfo minfo;
@@ -829,6 +926,8 @@ BOOL CALLBACK OS_Windows::MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPR
minfo.rect.size.x=lprcMonitor->right - lprcMonitor->left;
minfo.rect.size.y=lprcMonitor->bottom - lprcMonitor->top;
+ minfo.dpi = QueryDpiForMonitor(hMonitor);
+
self->monitor_info.push_back(minfo);
return TRUE;
@@ -1035,6 +1134,8 @@ void OS_Windows::initialize(const VideoMode& p_desired,int p_video_driver,int p_
_ensure_data_dir();
+ DragAcceptFiles(hWnd,true);
+
}
@@ -1338,6 +1439,14 @@ Size2 OS_Windows::get_screen_size(int p_screen) const{
return Vector2( monitor_info[p_screen].rect.size );
}
+
+int OS_Windows::get_screen_dpi(int p_screen) const {
+
+ ERR_FAIL_INDEX_V(p_screen,monitor_info.size(),72);
+ UINT dpix,dpiy;
+ return monitor_info[p_screen].dpi;
+
+}
Point2 OS_Windows::get_window_position() const{
RECT r;
@@ -1725,6 +1834,11 @@ uint64_t OS_Windows::get_unix_time() const {
};
uint64_t OS_Windows::get_system_time_secs() const {
+
+
+ const uint64_t WINDOWS_TICK = 10000000;
+ const uint64_t SEC_TO_UNIX_EPOCH = 11644473600LL;
+
SYSTEMTIME st;
GetSystemTime(&st);
FILETIME ft;
@@ -1733,7 +1847,8 @@ uint64_t OS_Windows::get_system_time_secs() const {
ret=ft.dwHighDateTime;
ret<<=32;
ret|=ft.dwLowDateTime;
- return ret;
+
+ return (uint64_t)(ret / WINDOWS_TICK - SEC_TO_UNIX_EPOCH);
}
void OS_Windows::delay_usec(uint32_t p_usec) const {
@@ -2134,7 +2249,7 @@ String OS_Windows::get_system_dir(SystemDir p_dir) const {
}
String OS_Windows::get_data_dir() const {
- String an = Globals::get_singleton()->get("application/name");
+ String an = get_safe_application_name();
if (an!="") {
if (has_environment("APPDATA")) {
@@ -2160,6 +2275,21 @@ String OS_Windows::get_joy_guid(int p_device) const {
return input->get_joy_guid_remapped(p_device);
}
+void OS_Windows::set_use_vsync(bool p_enable) {
+
+ if (gl_context)
+ gl_context->set_use_vsync(p_enable);
+}
+
+bool OS_Windows::is_vsnc_enabled() const{
+
+ if (gl_context)
+ return gl_context->is_using_vsync();
+
+ return true;
+}
+
+
OS_Windows::OS_Windows(HINSTANCE _hInstance) {
key_event_pos=0;
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index adea26308f..509d76abbf 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -103,7 +103,7 @@ class OS_Windows : public OS {
HDC hDC; // Private GDI Device Context
HINSTANCE hInstance; // Holds The Instance Of The Application
HWND hWnd;
-
+
HCURSOR hCursor;
Size2 window_rect;
@@ -172,6 +172,7 @@ protected:
HMONITOR hMonitor;
HDC hdcMonitor;
Rect2 rect;
+ int dpi;
};
@@ -213,6 +214,8 @@ public:
virtual void set_current_screen(int p_screen);
virtual Point2 get_screen_position(int p_screen=0) const;
virtual Size2 get_screen_size(int p_screen=0) const;
+ virtual int get_screen_dpi(int p_screen=0) const;
+
virtual Point2 get_window_position() const;
virtual void set_window_position(const Point2& p_position);
virtual Size2 get_window_size() const;
@@ -280,6 +283,9 @@ public:
virtual bool is_joy_known(int p_device);
virtual String get_joy_guid(int p_device) const;
+ virtual void set_use_vsync(bool p_enable);
+ virtual bool is_vsnc_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 0ca2d358af..2c79365c08 100644
--- a/platform/windows/packet_peer_udp_winsock.cpp
+++ b/platform/windows/packet_peer_udp_winsock.cpp
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* packet_peer_udp_winsock.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#include "packet_peer_udp_winsock.h"
#include <winsock2.h>
diff --git a/platform/windows/packet_peer_udp_winsock.h b/platform/windows/packet_peer_udp_winsock.h
index 34dbcbee91..b24dbac592 100644
--- a/platform/windows/packet_peer_udp_winsock.h
+++ b/platform/windows/packet_peer_udp_winsock.h
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* packet_peer_udp_winsock.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#ifndef PACKET_PEER_UDP_WINSOCK_H
#define PACKET_PEER_UDP_WINSOCK_H
diff --git a/platform/windows/platform_config.h b/platform/windows/platform_config.h
index 55f6b5547e..9e20750816 100644
--- a/platform/windows/platform_config.h
+++ b/platform/windows/platform_config.h
@@ -30,6 +30,6 @@
//#else
//#include <alloca.h>
//#endif
-#define GLES2_INCLUDE_H "gl_context/glew.h"
+#define GLES2_INCLUDE_H "gl_context/GL/glew.h"
diff --git a/platform/winrt/gl_context_egl.cpp b/platform/winrt/gl_context_egl.cpp
index fd9fbe406f..12ccd404a9 100644
--- a/platform/winrt/gl_context_egl.cpp
+++ b/platform/winrt/gl_context_egl.cpp
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* gl_context_egl.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#include "gl_context_egl.h"
#include "EGL/eglext.h"
diff --git a/platform/winrt/gl_context_egl.h b/platform/winrt/gl_context_egl.h
index ca3760e723..68dcdd5035 100644
--- a/platform/winrt/gl_context_egl.h
+++ b/platform/winrt/gl_context_egl.h
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* gl_context_egl.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#ifndef CONTEXT_EGL_H
#define CONTEXT_EGL_H
diff --git a/platform/winrt/os_winrt.cpp b/platform/winrt/os_winrt.cpp
index 5ec1bd2756..f045f54bf6 100644
--- a/platform/winrt/os_winrt.cpp
+++ b/platform/winrt/os_winrt.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* os_winrt.cpp */
+/* os_winrt.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
diff --git a/platform/winrt/os_winrt.h b/platform/winrt/os_winrt.h
index 0307f81954..145ccf0f7a 100644
--- a/platform/winrt/os_winrt.h
+++ b/platform/winrt/os_winrt.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* OSWinrt.h */
+/* os_winrt.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
diff --git a/platform/winrt/platform_config.h b/platform/winrt/platform_config.h
index 91669ad489..88b1fefed8 100644
--- a/platform/winrt/platform_config.h
+++ b/platform/winrt/platform_config.h
@@ -1,2 +1,29 @@
+/*************************************************************************/
+/* platform_config.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#include <malloc.h>
-
diff --git a/platform/winrt/thread_winrt.cpp b/platform/winrt/thread_winrt.cpp
index 3217292bee..097050e511 100644
--- a/platform/winrt/thread_winrt.cpp
+++ b/platform/winrt/thread_winrt.cpp
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* thread_winrt.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* 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 "os/memory.h"
diff --git a/platform/winrt/thread_winrt.h b/platform/winrt/thread_winrt.h
index 6140c9c506..df275d560a 100644
--- a/platform/winrt/thread_winrt.h
+++ b/platform/winrt/thread_winrt.h
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* thread_winrt.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* 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
diff --git a/platform/x11/context_gl_x11.cpp b/platform/x11/context_gl_x11.cpp
index 9f987e1376..cd325dfc99 100644
--- a/platform/x11/context_gl_x11.cpp
+++ b/platform/x11/context_gl_x11.cpp
@@ -34,7 +34,9 @@
#include <unistd.h>
#include <stdlib.h>
+#define GLX_GLXEXT_PROTOTYPES
#include <GL/glx.h>
+#include <GL/glxext.h>
#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
@@ -176,6 +178,41 @@ int ContextGL_X11::get_window_height() {
return xwa.height;
}
+void ContextGL_X11::set_use_vsync(bool p_use) {
+ static bool setup = false;
+ static PFNGLXSWAPINTERVALEXTPROC glXSwapIntervalEXT = NULL;
+ static PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalMESA = NULL;
+ static PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI = NULL;
+
+ if (!setup) {
+ setup = true;
+ String extensions = glXQueryExtensionsString(x11_display, DefaultScreen(x11_display));
+ if (extensions.find("GLX_EXT_swap_control") != -1)
+ glXSwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC) glXGetProcAddressARB((const GLubyte*)"glXSwapIntervalEXT");
+ if (extensions.find("GLX_MESA_swap_control") != -1)
+ glXSwapIntervalMESA = (PFNGLXSWAPINTERVALSGIPROC) glXGetProcAddressARB((const GLubyte*)"glXSwapIntervalMESA");
+ if (extensions.find("GLX_SGI_swap_control") != -1)
+ glXSwapIntervalSGI = (PFNGLXSWAPINTERVALSGIPROC) glXGetProcAddressARB((const GLubyte*)"glXSwapIntervalSGI");
+ }
+ int val = p_use ? 1:0;
+ if (glXSwapIntervalMESA) {
+ glXSwapIntervalMESA(val);
+ }
+ else if (glXSwapIntervalSGI) {
+ glXSwapIntervalSGI(val);
+ }
+ else if (glXSwapIntervalEXT) {
+ GLXDrawable drawable = glXGetCurrentDrawable();
+ glXSwapIntervalEXT(x11_display, drawable, val);
+ }
+ else return;
+ use_vsync = p_use;
+}
+bool ContextGL_X11::is_using_vsync() const {
+
+ return use_vsync;
+}
+
ContextGL_X11::ContextGL_X11(::Display *p_x11_display,::Window &p_x11_window,const OS::VideoMode& p_default_video_mode,bool p_opengl_3_context) : x11_window(p_x11_window) {
@@ -189,6 +226,7 @@ ContextGL_X11::ContextGL_X11(::Display *p_x11_display,::Window &p_x11_window,con
glx_minor=glx_major=0;
p = memnew( ContextGL_X11_Private );
p->glx_context=0;
+ use_vsync=false;
}
diff --git a/platform/x11/context_gl_x11.h b/platform/x11/context_gl_x11.h
index c77fb3e333..4474542c0b 100644
--- a/platform/x11/context_gl_x11.h
+++ b/platform/x11/context_gl_x11.h
@@ -55,6 +55,7 @@ class ContextGL_X11 : public ContextGL {
bool direct_render;
int glx_minor,glx_major;
bool opengl_3_context;
+ bool use_vsync;
public:
virtual void release_current();
@@ -65,6 +66,9 @@ public:
virtual Error initialize();
+ virtual void set_use_vsync(bool p_use);
+ virtual bool is_using_vsync() const;
+
ContextGL_X11(::Display *p_x11_display,::Window &p_x11_window,const OS::VideoMode& p_default_video_mode,bool p_opengl_3_context);
~ContextGL_X11();
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index 6b3f7147ef..5f272536ba 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -45,6 +45,11 @@ def can_build():
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
+
return True # X11 enabled
@@ -65,7 +70,10 @@ def get_flags():
return [
('builtin_zlib', 'no'),
+ ('glew', 'yes'),
("openssl", "yes"),
+ ('freetype','yes'), #use system freetype
+
#("theora","no"),
]
@@ -131,6 +139,7 @@ def configure(env):
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"]=="yes"):
env.ParseConfig('pkg-config openssl --cflags --libs')
@@ -140,14 +149,9 @@ def configure(env):
env.ParseConfig('pkg-config freetype2 --cflags --libs')
- if (env["freetype"]!="no"):
- env.Append(CCFLAGS=['-DFREETYPE_ENABLED'])
- if (env["freetype"]=="builtin"):
- env.Append(CPPPATH=['#tools/freetype'])
- env.Append(CPPPATH=['#tools/freetype/freetype/include'])
- env.Append(CPPFLAGS=['-DOPENGL_ENABLED','-DGLEW_ENABLED'])
+ env.Append(CPPFLAGS=['-DOPENGL_ENABLED'])
if os.system("pkg-config --exists alsa")==0:
print("Enabling ALSA")
@@ -178,7 +182,7 @@ def configure(env):
print("PulseAudio development libraries not found, disabling driver")
env.Append(CPPFLAGS=['-DX11_ENABLED','-DUNIX_ENABLED','-DGLES2_ENABLED','-DGLES_OVER_GL'])
- env.Append(LIBS=['GL', 'GLU', 'pthread', 'z'])
+ env.Append(LIBS=['GL', 'GLU', 'pthread', 'z', 'dl'])
#env.Append(CPPFLAGS=['-DMPC_FIXED_POINT'])
#host compiler is default..
diff --git a/platform/x11/export/export.cpp b/platform/x11/export/export.cpp
index bed57fbe9f..c6675ace72 100644
--- a/platform/x11/export/export.cpp
+++ b/platform/x11/export/export.cpp
@@ -1,3 +1,31 @@
+/*************************************************************************/
+/* export.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
#include "export.h"
#include "platform/x11/logo.h"
#include "tools/editor/editor_import_export.h"
diff --git a/platform/x11/export/export.h b/platform/x11/export/export.h
index 1077709ea1..9dc13d7459 100644
--- a/platform/x11/export/export.h
+++ b/platform/x11/export/export.h
@@ -1,4 +1,29 @@
-
-
+/*************************************************************************/
+/* export.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 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 */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
void register_x11_exporter();
-
diff --git a/platform/x11/joystick_linux.cpp b/platform/x11/joystick_linux.cpp
index 2793cc5734..5ce0219df7 100644
--- a/platform/x11/joystick_linux.cpp
+++ b/platform/x11/joystick_linux.cpp
@@ -316,13 +316,21 @@ void joystick_linux::setup_joystick_properties(int p_id) {
}
}
}
-}
+ joy->force_feedback = false;
+ joy->ff_effect_timestamp = 0;
+ unsigned long ffbit[NBITS(FF_CNT)];
+ if (ioctl(joy->fd, EVIOCGBIT(EV_FF, sizeof(ffbit)), ffbit) != -1) {
+ if (test_bit(FF_RUMBLE, ffbit)) {
+ joy->force_feedback = true;
+ }
+ }
+}
void joystick_linux::open_joystick(const char *p_path) {
int joy_num = get_free_joy_slot();
- int fd = open(p_path, O_RDONLY | O_NONBLOCK);
+ int fd = open(p_path, O_RDWR | O_NONBLOCK);
if (fd != -1 && joy_num != -1) {
unsigned long evbit[NBITS(EV_MAX)] = { 0 };
@@ -392,6 +400,55 @@ 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)
+{
+ Joystick& joy = joysticks[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);
+ }
+
+ struct ff_effect effect;
+ effect.type = FF_RUMBLE;
+ effect.id = -1;
+ effect.u.rumble.weak_magnitude = floor(p_weak_magnitude * (float)0xffff);
+ effect.u.rumble.strong_magnitude = floor(p_strong_magnitude * (float)0xffff);
+ effect.replay.length = floor(p_duration * 1000);
+ effect.replay.delay = 0;
+
+ if (ioctl(joy.fd, EVIOCSFF, &effect) < 0) {
+ return;
+ }
+
+ struct input_event play;
+ play.type = EV_FF;
+ play.code = effect.id;
+ play.value = 1;
+ write(joy.fd, (const void*)&play, sizeof(play));
+
+ joy.ff_effect_id = effect.id;
+ joy.ff_effect_timestamp = p_timestamp;
+}
+
+void joystick_linux::joystick_vibration_stop(int p_id, uint64_t p_timestamp)
+{
+ Joystick& joy = joysticks[p_id];
+ if (!joy.force_feedback || joy.fd == -1 || joy.ff_effect_id == -1) {
+ return;
+ }
+
+ struct input_event stop;
+ stop.type = EV_FF;
+ stop.code = joy.ff_effect_id;
+ stop.value = 0;
+ write(joy.fd, (const void*)&stop, sizeof(stop));
+
+ joy.ff_effect_id = -1;
+ joy.ff_effect_timestamp = p_timestamp;
+}
+
InputDefault::JoyAxis joystick_linux::axis_correct(const input_absinfo *p_abs, int p_value) const {
int min = p_abs->minimum;
@@ -485,6 +542,19 @@ uint32_t joystick_linux::process_joysticks(uint32_t p_event_id) {
if (len == 0 || (len < 0 && errno != EAGAIN)) {
close_joystick(i);
};
+
+ if (joy->force_feedback) {
+ uint64_t timestamp = input->get_joy_vibration_timestamp(i);
+ if (timestamp > joy->ff_effect_timestamp) {
+ 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);
+ } else {
+ joystick_vibration_start(i, strength.x, strength.y, duration, timestamp);
+ }
+ }
+ }
}
joy_mutex->unlock();
return p_event_id;
diff --git a/platform/x11/joystick_linux.h b/platform/x11/joystick_linux.h
index 4f0533721b..7ea2664ebb 100644
--- a/platform/x11/joystick_linux.h
+++ b/platform/x11/joystick_linux.h
@@ -61,6 +61,10 @@ private:
String devpath;
input_absinfo *abs_info[MAX_ABS];
+ bool force_feedback;
+ int ff_effect_id;
+ uint64_t ff_effect_timestamp;
+
Joystick();
~Joystick();
void reset();
@@ -88,6 +92,9 @@ private:
void run_joystick_thread();
void open_joystick(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);
+
InputDefault::JoyAxis axis_correct(const input_absinfo *abs, int value) const;
};
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 4d7532d637..1ca779ef7c 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -57,6 +57,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
+#include <dlfcn.h>
//stupid linux.h
#ifdef KEY_TAB
@@ -105,6 +106,7 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
last_timestamp=0;
last_mouse_pos_valid=false;
last_keyrelease_time=0;
+ xdnd_version = 0;
if (get_render_thread_mode()==RENDER_SEPARATE_THREAD) {
XInitThreads();
@@ -116,6 +118,37 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
char * modifiers = XSetLocaleModifiers ("@im=none");
ERR_FAIL_COND( modifiers == NULL );
+ const char* err;
+ xrr_get_monitors = NULL;
+ xrr_free_monitors = NULL;
+ int xrandr_major = 0;
+ int xrandr_minor = 0;
+ int event_base, error_base;
+ xrandr_ext_ok = XRRQueryExtension(x11_display,&event_base, &error_base);
+ xrandr_handle = dlopen("libXrandr.so", RTLD_LAZY);
+ err = dlerror();
+ if (!xrandr_handle) {
+ fprintf(stderr, "could not load libXrandr.so, Error: %s\n", err);
+ }
+ else {
+ XRRQueryVersion(x11_display, &xrandr_major, &xrandr_minor);
+ if (((xrandr_major << 8) | xrandr_minor) >= 0x0105) {
+ xrr_get_monitors = (xrr_get_monitors_t) dlsym(xrandr_handle, "XRRGetMonitors");
+ if (!xrr_get_monitors) {
+ err = dlerror();
+ fprintf(stderr, "could not find symbol XRRGetMonitors\nError: %s\n", err);
+ }
+ else {
+ xrr_free_monitors = (xrr_free_monitors_t) dlsym(xrandr_handle, "XRRFreeMonitors");
+ if (!xrr_free_monitors) {
+ err = dlerror();
+ fprintf(stderr, "could not find XRRFreeMonitors\nError: %s\n", err);
+ xrr_get_monitors = NULL;
+ }
+ }
+ }
+ }
+
xim = XOpenIM (x11_display, NULL, NULL, NULL);
@@ -415,6 +448,19 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
}
set_cursor_shape(CURSOR_BUSY);
+ //Set Xdnd (drag & drop) support
+ Atom XdndAware = XInternAtom(x11_display, "XdndAware", False);
+ Atom version=5;
+ XChangeProperty(x11_display, x11_window, XdndAware, XA_ATOM, 32, PropModeReplace, (unsigned char*)&version, 1);
+
+ xdnd_enter = XInternAtom(x11_display, "XdndEnter", False);
+ xdnd_position = XInternAtom(x11_display, "XdndPosition", False);
+ xdnd_status = XInternAtom(x11_display, "XdndStatus", False);
+ xdnd_action_copy = XInternAtom(x11_display, "XdndActionCopy", False);
+ xdnd_drop = XInternAtom(x11_display, "XdndDrop", False);
+ xdnd_finished = XInternAtom(x11_display, "XdndFinished", False);
+ xdnd_selection = XInternAtom(x11_display, "XdndSelection", False);
+ requested = None;
visual_server->init();
//
@@ -466,6 +512,9 @@ void OS_X11::finalize() {
physics_2d_server->finish();
memdelete(physics_2d_server);
+ if (xrandr_handle)
+ dlclose(xrandr_handle);
+
XUnmapWindow( x11_display, x11_window );
XDestroyWindow( x11_display, x11_window );
@@ -708,6 +757,46 @@ Size2 OS_X11::get_screen_size(int p_screen) const {
return size;
}
+int OS_X11::get_screen_dpi(int p_screen) const {
+
+ //invalid screen?
+ ERR_FAIL_INDEX_V(p_screen, get_screen_count(), 0);
+
+ //Get physical monitor Dimensions through XRandR and calculate dpi
+ Size2 sc = get_screen_size(p_screen);
+ if (xrandr_ext_ok) {
+ int count = 0;
+ if (xrr_get_monitors) {
+ xrr_monitor_info *monitors = xrr_get_monitors(x11_display, x11_window, true, &count);
+ if (p_screen < count) {
+ double xdpi = sc.width / (double) monitors[p_screen].mwidth * 25.4;
+ double ydpi = sc.height / (double) monitors[p_screen].mheight * 25.4;
+ xrr_free_monitors(monitors);
+ return (xdpi + ydpi) / 2;
+ }
+ xrr_free_monitors(monitors);
+ }
+ else if (p_screen == 0) {
+ XRRScreenSize *sizes = XRRSizes(x11_display, 0, &count);
+ if (sizes) {
+ double xdpi = sc.width / (double) sizes[0].mwidth * 25.4;
+ double ydpi = sc.height / (double) sizes[0].mheight * 25.4;
+ return (xdpi + ydpi) / 2;
+ }
+ }
+ }
+
+ int width_mm = DisplayWidthMM(x11_display, p_screen);
+ int height_mm = DisplayHeightMM(x11_display, p_screen);
+ double xdpi = (width_mm ? sc.width / (double) width_mm * 25.4 : 0);
+ double ydpi = (height_mm ? sc.height / (double) height_mm * 25.4 : 0);
+ if (xdpi || xdpi)
+ return (xdpi + ydpi)/(xdpi && ydpi ? 2 : 1);
+
+ //could not get dpi
+ return 96;
+}
+
Point2 OS_X11::get_window_position() const {
int x,y;
Window child;
@@ -1166,6 +1255,72 @@ void OS_X11::handle_key_event(XKeyEvent *p_event, bool p_echo) {
input->parse_input_event( event);
}
+struct Property
+{
+ unsigned char *data;
+ int format, nitems;
+ Atom type;
+};
+
+static Property read_property(Display* p_display, Window p_window, Atom p_property) {
+
+ Atom actual_type;
+ int actual_format;
+ unsigned long nitems;
+ unsigned long bytes_after;
+ unsigned char *ret=0;
+
+ int read_bytes = 1024;
+
+ //Keep trying to read the property until there are no
+ //bytes unread.
+ do
+ {
+ if(ret != 0)
+ XFree(ret);
+
+ XGetWindowProperty(p_display, p_window, p_property, 0, read_bytes, False, AnyPropertyType,
+ &actual_type, &actual_format, &nitems, &bytes_after,
+ &ret);
+
+ read_bytes *= 2;
+
+ }while(bytes_after != 0);
+
+ Property p = {ret, actual_format, nitems, actual_type};
+
+ return p;
+}
+
+static Atom pick_target_from_list(Display* p_display, Atom *p_list, int p_count) {
+
+ static const char* target_type = "text/uri-list";
+
+ for (int i = 0; i < p_count; i++) {
+
+ Atom atom = p_list[i];
+
+ if (atom != None && String(XGetAtomName(p_display, atom)) == target_type)
+ return atom;
+ }
+ return None;
+}
+
+static Atom pick_target_from_atoms(Display* p_disp, Atom p_t1, Atom p_t2, Atom p_t3) {
+
+ static const char* target_type = "text/uri-list";
+ if (p_t1 != None && String(XGetAtomName(p_disp, p_t1)) == target_type)
+ return p_t1;
+
+ if (p_t2 != None && String(XGetAtomName(p_disp, p_t2)) == target_type)
+ return p_t2;
+
+ if (p_t3 != None && String(XGetAtomName(p_disp, p_t3)) == target_type)
+ return p_t3;
+
+ return None;
+}
+
void OS_X11::process_xevents() {
//printf("checking events %i\n", XPending(x11_display));
@@ -1456,11 +1611,96 @@ void OS_X11::process_xevents() {
XFlush (x11_display);
} break;
+ case SelectionNotify:
+
+ if (event.xselection.target == requested) {
+
+ Property p = read_property(x11_display, x11_window, XInternAtom(x11_display, "PRIMARY", 0));
+
+ Vector<String> files = String((char *)p.data).split("\n", false);
+ for (int i = 0; i < files.size(); i++) {
+ files[i] = files[i].replace("file://", "").replace("%20", " ").strip_escapes();
+ }
+ main_loop->drop_files(files);
+
+ //Reply that all is well.
+ XClientMessageEvent m;
+ memset(&m, sizeof(m), 0);
+ m.type = ClientMessage;
+ m.display = x11_display;
+ m.window = xdnd_source_window;
+ m.message_type = xdnd_finished;
+ m.format=32;
+ m.data.l[0] = x11_window;
+ m.data.l[1] = 1;
+ m.data.l[2] = xdnd_action_copy; //We only ever copy.
+
+ XSendEvent(x11_display, xdnd_source_window, False, NoEventMask, (XEvent*)&m);
+ }
+ break;
case ClientMessage:
if ((unsigned int)event.xclient.data.l[0]==(unsigned int)wm_delete)
main_loop->notification(MainLoop::NOTIFICATION_WM_QUIT_REQUEST);
+
+ else if ((unsigned int)event.xclient.message_type == (unsigned int)xdnd_enter) {
+
+ //File(s) have been dragged over the window, check for supported target (text/uri-list)
+ xdnd_version = ( event.xclient.data.l[1] >> 24);
+ Window source = event.xclient.data.l[0];
+ bool more_than_3 = event.xclient.data.l[1] & 1;
+ if (more_than_3) {
+ Property p = read_property(x11_display, source, XInternAtom(x11_display, "XdndTypeList", False));
+ requested = pick_target_from_list(x11_display, (Atom*)p.data, p.nitems);
+ }
+ else
+ requested = pick_target_from_atoms(x11_display, event.xclient.data.l[2],event.xclient.data.l[3], event.xclient.data.l[4]);
+ }
+ else if ((unsigned int)event.xclient.message_type == (unsigned int )xdnd_position) {
+
+ //xdnd position event, reply with an XDND status message
+ //just depending on type of data for now
+ XClientMessageEvent m;
+ memset(&m, sizeof(m), 0);
+ m.type = ClientMessage;
+ m.display = event.xclient.display;
+ m.window = event.xclient.data.l[0];
+ m.message_type = xdnd_status;
+ m.format=32;
+ m.data.l[0] = x11_window;
+ m.data.l[1] = (requested != None);
+ m.data.l[2] = 0; //empty rectangle
+ m.data.l[3] = 0;
+ m.data.l[4] = xdnd_action_copy;
+
+ XSendEvent(x11_display, event.xclient.data.l[0], False, NoEventMask, (XEvent*)&m);
+ XFlush(x11_display);
+ }
+ else if ((unsigned int)event.xclient.message_type == (unsigned int)xdnd_drop) {
+
+ if (requested != None) {
+ xdnd_source_window = event.xclient.data.l[0];
+ if(xdnd_version >= 1)
+ XConvertSelection(x11_display, xdnd_selection, requested, XInternAtom(x11_display, "PRIMARY", 0), x11_window, event.xclient.data.l[2]);
+ else
+ XConvertSelection(x11_display, xdnd_selection, requested, XInternAtom(x11_display, "PRIMARY", 0), x11_window, CurrentTime);
+ }
+ else {
+ //Reply that we're not interested.
+ XClientMessageEvent m;
+ memset(&m, sizeof(m), 0);
+ m.type = ClientMessage;
+ m.display = event.xclient.display;
+ m.window = event.xclient.data.l[0];
+ m.message_type = xdnd_finished;
+ m.format=32;
+ m.data.l[0] = x11_window;
+ m.data.l[1] = 0;
+ m.data.l[2] = None; //Failed.
+ XSendEvent(x11_display, event.xclient.data.l[0], False, NoEventMask, (XEvent*)&m);
+ }
+ }
break;
default:
break;
@@ -1787,6 +2027,20 @@ String OS_X11::get_joy_guid(int p_device) const {
return input->get_joy_guid_remapped(p_device);
}
+void OS_X11::set_use_vsync(bool p_enable) {
+ if (context_gl)
+ return context_gl->set_use_vsync(p_enable);
+}
+
+bool OS_X11::is_vsnc_enabled() const {
+
+ if (context_gl)
+ return context_gl->is_using_vsync();
+
+ return true;
+}
+
+
void OS_X11::set_context(int p_context) {
XClassHint* classHint = NULL;
diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h
index d9a5b1688c..71bbe726dd 100644
--- a/platform/x11/os_x11.h
+++ b/platform/x11/os_x11.h
@@ -52,6 +52,7 @@
#include <X11/keysym.h>
#include <X11/Xlib.h>
#include <X11/Xcursor/Xcursor.h>
+#include <X11/extensions/Xrandr.h>
// Hints for X11 fullscreen
typedef struct {
@@ -62,6 +63,20 @@ typedef struct {
unsigned long status;
} Hints;
+typedef struct _xrr_monitor_info {
+ Atom name;
+ Bool primary;
+ Bool automatic;
+ int noutput;
+ int x;
+ int y;
+ int width;
+ int height;
+ int mwidth;
+ int mheight;
+ RROutput *outputs;
+} xrr_monitor_info;
+
#undef CursorShape
/**
@author Juan Linietsky <reduzio@gmail.com>
@@ -70,6 +85,17 @@ typedef struct {
class OS_X11 : public OS_Unix {
Atom wm_delete;
+ Atom xdnd_enter;
+ Atom xdnd_position;
+ Atom xdnd_status;
+ Atom xdnd_action_copy;
+ Atom xdnd_drop;
+ Atom xdnd_finished;
+ Atom xdnd_selection;
+ Atom requested;
+
+ int xdnd_version;
+
#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED)
ContextGL_X11 *context_gl;
#endif
@@ -78,6 +104,7 @@ class OS_X11 : public OS_Unix {
VideoMode current_videomode;
List<String> args;
Window x11_window;
+ Window xdnd_source_window;
MainLoop *main_loop;
::Display* x11_display;
char *xmbstring;
@@ -150,6 +177,12 @@ class OS_X11 : public OS_Unix {
//void set_wm_border(bool p_enabled);
void set_wm_fullscreen(bool p_enabled);
+ typedef xrr_monitor_info* (*xrr_get_monitors_t)(Display *dpy, Window window, Bool get_active, int *nmonitors);
+ typedef void (*xrr_free_monitors_t)(xrr_monitor_info* monitors);
+ xrr_get_monitors_t xrr_get_monitors;
+ xrr_free_monitors_t xrr_free_monitors;
+ void *xrandr_handle;
+ Bool xrandr_ext_ok;
protected:
@@ -207,6 +240,7 @@ public:
virtual void set_current_screen(int p_screen);
virtual Point2 get_screen_position(int p_screen=0) const;
virtual Size2 get_screen_size(int p_screen=0) const;
+ virtual int get_screen_dpi(int p_screen=0) const;
virtual Point2 get_window_position() const;
virtual void set_window_position(const Point2& p_position);
virtual Size2 get_window_size() const;
@@ -228,6 +262,9 @@ public:
virtual void set_context(int p_context);
+ virtual void set_use_vsync(bool p_enable);
+ virtual bool is_vsnc_enabled() const;
+
void run();
OS_X11();
diff --git a/platform/x11/platform_config.h b/platform/x11/platform_config.h
index aac50c27c2..3b47b2c92d 100644
--- a/platform/x11/platform_config.h
+++ b/platform/x11/platform_config.h
@@ -34,6 +34,6 @@
#define PTHREAD_BSD_SET_NAME
#endif
-#define GLES2_INCLUDE_H "gl_context/glew.h"
+#define GLES2_INCLUDE_H "gl_context/GL/glew.h"