summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
Diffstat (limited to 'platform')
-rw-r--r--platform/android/SCsub4
-rw-r--r--platform/android/detect.py28
-rw-r--r--platform/android/export/export.cpp44
-rw-r--r--platform/flash/SCsub1
-rw-r--r--platform/flash/detect.py1
-rw-r--r--platform/iphone/SCsub11
-rw-r--r--platform/iphone/app_delegate.mm6
-rw-r--r--platform/iphone/detect.py19
-rw-r--r--platform/isim/SCsub9
-rw-r--r--platform/isim/detect.py14
-rw-r--r--platform/javascript/SCsub4
-rw-r--r--platform/javascript/detect.py11
-rw-r--r--platform/osx/SCsub2
-rw-r--r--platform/osx/detect.py18
-rw-r--r--platform/osx/os_osx.mm15
-rw-r--r--platform/server/detect.py38
-rw-r--r--platform/windows/SCsub2
-rw-r--r--platform/windows/detect.py107
-rw-r--r--platform/winrt/SCsub5
-rw-r--r--platform/winrt/app.cpp162
-rw-r--r--platform/winrt/app.h51
-rw-r--r--platform/winrt/detect.py6
-rw-r--r--platform/winrt/gl_context_egl.cpp151
-rw-r--r--platform/winrt/gl_context_egl.h44
-rw-r--r--platform/winrt/os_winrt.cpp197
-rw-r--r--platform/winrt/os_winrt.h7
-rw-r--r--platform/x11/SCsub2
-rw-r--r--platform/x11/detect.py69
28 files changed, 636 insertions, 392 deletions
diff --git a/platform/android/SCsub b/platform/android/SCsub
index 699db30cad..3c55b993ef 100644
--- a/platform/android/SCsub
+++ b/platform/android/SCsub
@@ -66,6 +66,6 @@ for x in env.android_module_libraries:
shutil.copy(x,abspath+"/java/libs")
-env_android.SharedLibrary("#platform/android/libgodot_android.so",[android_objects])
+env_android.SharedLibrary("#bin/libgodot_android",[android_objects],SHLIBSUFFIX=env["SHLIBSUFFIX"])
-env.Command('#bin/libgodot_android.so', '#platform/android/libgodot_android.so', Copy('bin/libgodot_android.so', 'platform/android/libgodot_android.so'))
+#env.Command('#bin/libgodot_android.so', '#platform/android/libgodot_android.so', Copy('bin/libgodot_android.so', 'platform/android/libgodot_android.so'))
diff --git a/platform/android/detect.py b/platform/android/detect.py
index 0c860c23b1..062cc62b52 100644
--- a/platform/android/detect.py
+++ b/platform/android/detect.py
@@ -27,14 +27,13 @@ def get_opts():
('NDK_TARGET', 'toolchain to use for the NDK',"arm-linux-androideabi-4.8"),
('android_stl','enable STL support in android port (for modules)','no'),
('armv6','compile for older phones running arm v6 (instead of v7+neon+smp)','no'),
- ('x86','compile for x86','no')
+ ('x86','Xompile for Android-x86','no')
]
def get_flags():
return [
- ('lua', 'no'),
('tools', 'no'),
('nedmalloc', 'no'),
('builtin_zlib', 'no'),
@@ -77,13 +76,7 @@ def configure(env):
env.Append(CPPPATH=['#platform/android'])
if env['x86']=='yes':
- env['OBJSUFFIX'] = ".android.ox"
- env['LIBSUFFIX'] = ".android.ax"
- else:
- env['OBJSUFFIX'] = ".android.o"
- env['LIBSUFFIX'] = ".android.a"
- env['PROGSUFFIX'] = ".android"
- env['SHLIBSUFFIX'] = ".so"
+ env.extra_suffix=".x86"
gcc_path=env["ANDROID_NDK_ROOT"]+"/toolchains/"+env["NDK_TARGET"]+"/prebuilt/";
@@ -128,7 +121,7 @@ def configure(env):
ld_path=env["ANDROID_NDK_ROOT"]+"/platforms/"+ndk_platform+"/"+env['ARCH']+"/usr/lib"
env.Append(CPPPATH=[gcc_include])
# env['CCFLAGS'] = string.split('-DNO_THREADS -MMD -MP -MF -fpic -ffunction-sections -funwind-tables -fstack-protector -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -fno-exceptions -mthumb -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED ')
- print("********* armv6", env['armv6'])
+
if env['x86']=='yes':
env['CCFLAGS'] = string.split('-DNO_STATVFS -MMD -MP -MF -fpic -ffunction-sections -funwind-tables -fstack-protector -D__GLIBC__ -Wno-psabi -ftree-vectorize -funsafe-math-optimizations -fno-strict-aliasing -DANDROID -Wa,--noexecstack -DGLES2_ENABLED -DGLES1_ENABLED')
elif env["armv6"]!="no":
@@ -149,23 +142,10 @@ def configure(env):
if (env["target"]=="release"):
env.Append(CCFLAGS=['-O2', '-ffast-math','-fomit-frame-pointer'])
- env['OBJSUFFIX'] = "_opt"+env['OBJSUFFIX']
- env['LIBSUFFIX'] = "_opt"+env['LIBSUFFIX']
elif (env["target"]=="release_debug"):
env.Append(CCFLAGS=['-O2', '-ffast-math','-DDEBUG_ENABLED'])
- env['OBJSUFFIX'] = "_optd"+env['OBJSUFFIX']
- env['LIBSUFFIX'] = "_optd"+env['LIBSUFFIX']
-
- elif (env["target"]=="profile"):
-
- env.Append(CCFLAGS=['-O2', '-ffast-math','-fomit-frame-pointer', '-g1'])
- env.Append(LIBPATH=['#platform/android/armeabi'])
- env.Append(LIBS=['andprof'])
- env['OBJSUFFIX'] = "_prof"+env['OBJSUFFIX']
- env['LIBSUFFIX'] = "_prof"+env['LIBSUFFIX']
- env['SHLIBSUFFIX'] = "_prof"+env['SHLIBSUFFIX']
elif (env["target"]=="debug"):
@@ -174,8 +154,10 @@ def configure(env):
if env["armv6"] == "no" and env['x86'] != 'yes':
env['neon_enabled']=True
+
env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED', '-DNO_FCNTL','-DMPC_FIXED_POINT'])
# env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED','-DMPC_FIXED_POINT'])
+
if (env['android_stl']=='yes'):
#env.Append(CCFLAGS=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/system/include"])
env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.4.3/include"])
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index aef223470a..bcc818dac8 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -184,6 +184,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
String cmdline;
bool _signed;
bool apk_expansion;
+ bool remove_prev;
String apk_expansion_salt;
String apk_expansion_pkey;
int orientation;
@@ -258,7 +259,9 @@ bool EditorExportPlatformAndroid::_set(const StringName& p_name, const Variant&
String n=p_name;
- if (n=="custom_package/debug")
+ if (n=="one_click_deploy/clear_previous_install")
+ remove_prev=p_value;
+ else if (n=="custom_package/debug")
custom_debug_package=p_value;
else if (n=="custom_package/release")
custom_release_package=p_value;
@@ -321,7 +324,9 @@ bool EditorExportPlatformAndroid::_set(const StringName& p_name, const Variant&
bool EditorExportPlatformAndroid::_get(const StringName& p_name,Variant &r_ret) const{
String n=p_name;
- if (n=="custom_package/debug")
+ if (n=="one_click_deploy/clear_previous_install")
+ r_ret=remove_prev;
+ else if (n=="custom_package/debug")
r_ret=custom_debug_package;
else if (n=="custom_package/release")
r_ret=custom_release_package;
@@ -378,6 +383,7 @@ bool EditorExportPlatformAndroid::_get(const StringName& p_name,Variant &r_ret)
void EditorExportPlatformAndroid::_get_property_list( List<PropertyInfo> *p_list) const{
+ p_list->push_back( PropertyInfo( Variant::BOOL, "one_click_deploy/clear_previous_install"));
p_list->push_back( PropertyInfo( Variant::STRING, "custom_package/debug", PROPERTY_HINT_GLOBAL_FILE,"apk"));
p_list->push_back( PropertyInfo( Variant::STRING, "custom_package/release", PROPERTY_HINT_GLOBAL_FILE,"apk"));
p_list->push_back( PropertyInfo( Variant::STRING, "command_line/extra_args"));
@@ -392,8 +398,9 @@ void EditorExportPlatformAndroid::_get_property_list( List<PropertyInfo> *p_list
p_list->push_back( PropertyInfo( Variant::BOOL, "screen/support_normal") );
p_list->push_back( PropertyInfo( Variant::BOOL, "screen/support_large") );
p_list->push_back( PropertyInfo( Variant::BOOL, "screen/support_xlarge") );
- p_list->push_back( PropertyInfo( Variant::STRING, "keystore/release",PROPERTY_HINT_FILE,"keystore") );
+ p_list->push_back( PropertyInfo( Variant::STRING, "keystore/release",PROPERTY_HINT_GLOBAL_FILE,"keystore") );
p_list->push_back( PropertyInfo( Variant::STRING, "keystore/release_user" ) );
+ p_list->push_back( PropertyInfo( Variant::STRING, "keystore/release_password" ) );
p_list->push_back( PropertyInfo( Variant::BOOL, "apk_expansion/enable" ) );
p_list->push_back( PropertyInfo( Variant::STRING, "apk_expansion/SALT" ) );
p_list->push_back( PropertyInfo( Variant::STRING, "apk_expansion/public_key",PROPERTY_HINT_MULTILINE_TEXT ) );
@@ -1231,6 +1238,11 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
args.push_back("SHA1");
args.push_back("-sigalg");
args.push_back("MD5withRSA");
+ String tsa_url=EditorSettings::get_singleton()->get("android/timestamping_authority_url");
+ if (tsa_url != "") {
+ args.push_back("-tsa");
+ args.push_back(tsa_url);
+ }
args.push_back("-verbose");
args.push_back("-keystore");
args.push_back(keystore);
@@ -1448,16 +1460,20 @@ Error EditorExportPlatformAndroid::run(int p_device, bool p_dumb) {
return err;
}
- ep.step("Uninstalling..",1);
-
- print_line("Uninstalling previous version: "+devices[p_device].name);
List<String> args;
- args.push_back("-s");
- args.push_back(devices[p_device].id);
- args.push_back("uninstall");
- args.push_back(package);
int rv;
- err = OS::get_singleton()->execute(adb,args,true,NULL,NULL,&rv);
+
+ if (remove_prev) {
+ ep.step("Uninstalling..",1);
+
+ print_line("Uninstalling previous version: "+devices[p_device].name);
+
+ args.push_back("-s");
+ args.push_back(devices[p_device].id);
+ args.push_back("uninstall");
+ args.push_back(package);
+
+ err = OS::get_singleton()->execute(adb,args,true,NULL,NULL,&rv);
#if 0
if (err || rv!=0) {
EditorNode::add_io_error("Could not install to device.");
@@ -1465,6 +1481,8 @@ Error EditorExportPlatformAndroid::run(int p_device, bool p_dumb) {
return ERR_CANT_CREATE;
}
#endif
+ }
+
print_line("Installing into device (please wait..): "+devices[p_device].name);
ep.step("Installing to Device (please wait..)..",2);
@@ -1473,7 +1491,7 @@ Error EditorExportPlatformAndroid::run(int p_device, bool p_dumb) {
args.push_back(devices[p_device].id);
args.push_back("install");
args.push_back(export_to);
- rv;
+
err = OS::get_singleton()->execute(adb,args,true,NULL,NULL,&rv);
if (err || rv!=0) {
EditorNode::add_io_error("Could not install to device.");
@@ -1515,6 +1533,7 @@ EditorExportPlatformAndroid::EditorExportPlatformAndroid() {
device_lock = Mutex::create();
quit_request=false;
orientation=0;
+ remove_prev=false;
device_thread=Thread::create(_device_poll_thread,this);
devices_changed=true;
@@ -1613,6 +1632,7 @@ void register_android_exporter() {
//EDITOR_DEF("android/release_keystore","");
//EDITOR_DEF("android/release_username","");
//EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"android/release_keystore",PROPERTY_HINT_GLOBAL_FILE,"*.keystore"));
+ EDITOR_DEF("android/timestamping_authority_url","");
Ref<EditorExportPlatformAndroid> exporter = Ref<EditorExportPlatformAndroid>( memnew(EditorExportPlatformAndroid) );
EditorImportExport::get_singleton()->add_export_platform(exporter);
diff --git a/platform/flash/SCsub b/platform/flash/SCsub
index 0dea7bf011..b7aef3b65d 100644
--- a/platform/flash/SCsub
+++ b/platform/flash/SCsub
@@ -8,7 +8,6 @@ common_flash=[\
#"dir_access_flash.cpp",
]
-print("** path is ", env['ENV']['PATH'])
abc = env.Command('#platform/flash/Console.abc', '#platform/flash/Console.as',
"""
diff --git a/platform/flash/detect.py b/platform/flash/detect.py
index 56d2516ab5..5507ce5177 100644
--- a/platform/flash/detect.py
+++ b/platform/flash/detect.py
@@ -11,7 +11,6 @@ def get_name():
def can_build():
#import os
- print(os.environ)
if (not os.environ.has_key("FLASCC_ROOT")):
return False
return True
diff --git a/platform/iphone/SCsub b/platform/iphone/SCsub
index d30d101e1b..9fc90bc84e 100644
--- a/platform/iphone/SCsub
+++ b/platform/iphone/SCsub
@@ -35,11 +35,6 @@ if env['ios_appirater'] == "yes":
obj = env_ios.Object('godot_iphone.cpp')
prog = None
-if env["target"]=="release" or env["target"] == "release_debug":
- prog = env_ios.Program('#bin/godot_opt', [obj] + iphone_lib)
- #action = "dsymutil "+File(prog)[0].path+" -o ../build/script_exec/build/Debug-iphoneos/script_exec.app.dSYM"
- #env.AddPostAction(prog, action)
-else:
- prog = env_ios.Program('#bin/godot', [obj] + iphone_lib)
- action = "dsymutil "+File(prog)[0].path+" -o bin/godot.iphone.dSYM"
- env.AddPostAction(prog, action)
+prog = env_ios.Program('#bin/godot', [obj] + iphone_lib)
+action = "dsymutil "+File(prog)[0].path+" -o " + File(prog)[0].path + ".dSYM"
+env.AddPostAction(prog, action)
diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm
index 9877e09ade..76c2d06080 100644
--- a/platform/iphone/app_delegate.mm
+++ b/platform/iphone/app_delegate.mm
@@ -257,7 +257,8 @@ static int frame_count = 0;
- (void)applicationDidEnterBackground:(UIApplication *)application
{
printf("********************* did enter background\n");
- OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT);
+ if (OS::get_singleton()->get_main_loop())
+ OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT);
[view_controller.view stopAnimation];
}
@@ -282,7 +283,8 @@ static int frame_count = 0;
printf("********************* mobile app tracker found\n");
[MobileAppTracker measureSession];
#endif
- OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN);
+ if (OS::get_singleton()->get_main_loop())
+ OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN);
[view_controller.view startAnimation]; // FIXME: resume seems to be recommended elsewhere
}
diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py
index 2065d459cd..c25742a854 100644
--- a/platform/iphone/detect.py
+++ b/platform/iphone/detect.py
@@ -34,9 +34,7 @@ def get_opts():
def get_flags():
return [
- ('lua', 'no'),
('tools', 'no'),
- ('nedmalloc', 'no'),
('webp', 'yes'),
('openssl','builtin'), #use builtin openssl
]
@@ -47,10 +45,6 @@ def configure(env):
env.Append(CPPPATH=['#platform/iphone', '#platform/iphone/include'])
- env['OBJSUFFIX'] = ".iphone.o"
- env['LIBSUFFIX'] = ".iphone.a"
- env['PROGSUFFIX'] = ".iphone"
-
env['ENV']['PATH'] = env['IPHONEPATH']+"/Developer/usr/bin/:"+env['ENV']['PATH']
# env['CC'] = '$IPHONEPATH/Developer/usr/bin/gcc'
@@ -101,15 +95,11 @@ def configure(env):
env.Append(CCFLAGS=['-Os', '-ffast-math', '-DNS_BLOCK_ASSERTIONS=1','-Wall'])
env.Append(LINKFLAGS=['-Os', '-ffast-math'])
- env['OBJSUFFIX'] = "_opt"+env['OBJSUFFIX']
- env['LIBSUFFIX'] = "_opt"+env['LIBSUFFIX']
elif env["target"] == "release_debug":
env.Append(CCFLAGS=['-Os', '-ffast-math', '-DNS_BLOCK_ASSERTIONS=1','-Wall','-DDEBUG_ENABLED'])
env.Append(LINKFLAGS=['-Os', '-ffast-math'])
env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ENABLED'])
- env['OBJSUFFIX'] = "_opt"+env['OBJSUFFIX']
- env['LIBSUFFIX'] = "_opt"+env['LIBSUFFIX']
elif (env["target"]=="debug"):
@@ -130,9 +120,10 @@ def configure(env):
env.Append(CPPFLAGS=['-fno-exceptions'])
#env['neon_enabled']=True
env['S_compiler'] = '$IPHONEPATH/Developer/usr/bin/gcc'
-
- if env['lua'] == "yes":
- env.Append(CCFLAGS=['-DLUA_USE_FLOAT'])
-
+
+ import methods
+ env.Append( BUILDERS = { 'GLSL120' : env.Builder(action = methods.build_legacygl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
+ env.Append( BUILDERS = { 'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
+ env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
# /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c-header -arch armv7s -fmessage-length=0 -std=gnu99 -fobjc-arc -Wno-trigraphs -fpascal-strings -Os -Wno-missing-field-initializers -Wno-missing-prototypes -Wreturn-type -Wno-implicit-atomic-properties -Wno-receiver-is-weak -Wduplicate-method-match -Wformat -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-shorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wno-undeclared-selector -Wno-deprecated-implementations -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk -Wprotocol -Wdeprecated-declarations -g -fvisibility=hidden -Wno-sign-conversion "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -miphoneos-version-min=4.3 -iquote /Users/lucasgondolo/test/build/test.build/Release-iphoneos/test.build/test-generated-files.hmap -I/Users/lucasgondolo/test/build/test.build/Release-iphoneos/test.build/test-own-target-headers.hmap -I/Users/lucasgondolo/test/build/test.build/Release-iphoneos/test.build/test-all-target-headers.hmap -iquote /Users/lucasgondolo/test/build/test.build/Release-iphoneos/test.build/test-project-headers.hmap -I/Users/lucasgondolo/test/build/Release-iphoneos/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/lucasgondolo/test/build/test.build/Release-iphoneos/test.build/DerivedSources/armv7s -I/Users/lucasgondolo/test/build/test.build/Release-iphoneos/test.build/DerivedSources -F/Users/lucasgondolo/test/build/Release-iphoneos -DNS_BLOCK_ASSERTIONS=1 --serialize-diagnostics /var/folders/9r/_65jj9457bgb4n4nxcsm0xl80000gn/C/com.apple.Xcode.501/SharedPrecompiledHeaders/test-Prefix-esrzoamhgruxcxbhemvvlrjmmvoh/test-Prefix.pch.dia -c /Users/lucasgondolo/test/test/test-Prefix.pch -o /var/folders/9r/_65jj9457bgb4n4nxcsm0xl80000gn/C/com.apple.Xcode.501/SharedPrecompiledHeaders/test-Prefix-esrzoamhgruxcxbhemvvlrjmmvoh/test-Prefix.pch.pth -MMD -MT dependencies -MF /var/folders/9r/_65jj9457bgb4n4nxcsm0xl80000gn/C/com.apple.Xcode.501/SharedPrecompiledHeaders/test-Prefix-esrzoamhgruxcxbhemvvlrjmmvoh/test-Prefix.pch.d
diff --git a/platform/isim/SCsub b/platform/isim/SCsub
index e7de935b2e..07761486a9 100644
--- a/platform/isim/SCsub
+++ b/platform/isim/SCsub
@@ -34,11 +34,4 @@ if env['ios_appirater'] == "yes":
obj = env_ios.Object('#platform/iphone/godot_iphone.cpp')
prog = None
-if env["target"]=="release":
- prog = env_ios.Program('#bin/godot_opt', [obj] + iphone_lib)
- #action = "dsymutil "+File(prog)[0].path+" -o ../build/script_exec/build/Debug-iphoneos/script_exec.app.dSYM"
- #env.AddPostAction(prog, action)
-else:
- prog = env_ios.Program('#bin/godot', [obj] + iphone_lib)
- #action = "dsymutil "+File(prog)[0].path+" -o ../build/script_exec/build/Debug-iphoneos/script_exec.app.dSYM"
- #env.AddPostAction(prog, action)
+prog = env_ios.Program('#bin/godot', [obj] + iphone_lib)
diff --git a/platform/isim/detect.py b/platform/isim/detect.py
index c89ca81167..f4a17838f9 100644
--- a/platform/isim/detect.py
+++ b/platform/isim/detect.py
@@ -22,7 +22,7 @@ def get_opts():
return [
('ISIMPLATFORM', 'name of the iphone platform', 'iPhoneSimulator'),
('ISIMPATH', 'the path to iphone toolchain', '/Applications/Xcode.app/Contents/Developer/Platforms/${ISIMPLATFORM}.platform'),
- ('ISIMSDK', 'path to the iphone SDK', '$ISIMPATH/Developer/SDKs/${ISIMPLATFORM}7.0.sdk'),
+ ('ISIMSDK', 'path to the iphone SDK', '$ISIMPATH/Developer/SDKs/${ISIMPLATFORM}7.1.sdk'),
('game_center', 'Support for game center', 'yes'),
('store_kit', 'Support for in-app store', 'yes'),
('ios_gles22_override', 'Force GLES2.0 on iOS', 'yes'),
@@ -34,9 +34,7 @@ def get_opts():
def get_flags():
return [
- ('lua', 'no'),
('tools', 'yes'),
- ('nedmalloc', 'no'),
('webp', 'yes'),
]
@@ -46,10 +44,6 @@ def configure(env):
env.Append(CPPPATH=['#platform/iphone'])
- env['OBJSUFFIX'] = ".isim.o"
- env['LIBSUFFIX'] = ".isim.a"
- env['PROGSUFFIX'] = ".isim"
-
env['ENV']['PATH'] = env['ISIMPATH']+"/Developer/usr/bin/:"+env['ENV']['PATH']
env['CC'] = '$ISIMPATH/Developer/usr/bin/gcc'
@@ -83,8 +77,6 @@ def configure(env):
env.Append(CCFLAGS=['-O3', '-ffast-math'])
env.Append(LINKFLAGS=['-O3', '-ffast-math'])
- env['OBJSUFFIX'] = "_opt"+env['OBJSUFFIX']
- env['LIBSUFFIX'] = "_opt"+env['LIBSUFFIX']
elif (env["target"]=="debug"):
@@ -99,8 +91,6 @@ def configure(env):
env['ENV']['MACOSX_DEPLOYMENT_TARGET'] = '10.6'
env['ENV']['CODESIGN_ALLOCATE'] = '/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate'
- env.Append(CPPFLAGS=['-DIPHONE_ENABLED', '-DUNIX_ENABLED', '-DGLES2_ENABLED', '-fno-exceptions'])
+ env.Append(CPPFLAGS=['-DIPHONE_ENABLED', '-DUNIX_ENABLED', '-DGLES2_ENABLED', '-fexceptions'])
- if env['lua'] == "yes":
- env.Append(CCFLAGS=['-DLUA_USE_FLOAT'])
diff --git a/platform/javascript/SCsub b/platform/javascript/SCsub
index fd1bb39e90..c1ba0c2283 100644
--- a/platform/javascript/SCsub
+++ b/platform/javascript/SCsub
@@ -6,8 +6,6 @@ javascript_files = [
"javascript_main.cpp"
]
-#env.Depends('#core/math/vector3.h', 'vector3_psp.h')
-
#obj = env.SharedObject('godot_javascript.cpp')
env_javascript = env.Clone()
@@ -22,4 +20,4 @@ prog = None
#env_javascript.SharedLibrary("#platform/javascript/libgodot_javascript.so",[javascript_objects])
-env.Program('#bin/godot.html', javascript_objects)
+env.Program('#bin/godot',javascript_objects,PROGSUFFIX=env["PROGSUFFIX"]+".html")
diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py
index e4cdaad313..845b2e3395 100644
--- a/platform/javascript/detect.py
+++ b/platform/javascript/detect.py
@@ -46,11 +46,7 @@ def get_flags():
def configure(env):
- env.Append(CPPPATH=['#platform/android'])
-
- env['OBJSUFFIX'] = ".js.o"
- env['LIBSUFFIX'] = ".js.a"
- env['PROGSUFFIX'] = ".html"
+ env.Append(CPPPATH=['#platform/javascript'])
em_path=os.environ["EMSCRIPTEN_ROOT"]
@@ -68,17 +64,12 @@ def configure(env):
if (env["target"]=="release"):
env.Append(CCFLAGS=['-O2'])
- env['OBJSUFFIX'] = "_opt"+env['OBJSUFFIX']
- env['LIBSUFFIX'] = "_opt"+env['LIBSUFFIX']
elif (env["target"]=="release_debug"):
env.Append(CCFLAGS=['-O2','-DDEBUG_ENABLED'])
- env['OBJSUFFIX'] = "_optd"+env['OBJSUFFIX']
- env['LIBSUFFIX'] = "_optd"+env['LIBSUFFIX']
elif (env["target"]=="debug"):
-
env.Append(CCFLAGS=['-D_DEBUG', '-Wall', '-O2', '-DDEBUG_ENABLED'])
env.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC'])
diff --git a/platform/osx/SCsub b/platform/osx/SCsub
index d7839d7d65..4904636afd 100644
--- a/platform/osx/SCsub
+++ b/platform/osx/SCsub
@@ -8,4 +8,4 @@ files = [
# 'context_gl_osx.cpp',
]
-env.Program('#bin/godot_osx',files)
+env.Program('#bin/godot',files)
diff --git a/platform/osx/detect.py b/platform/osx/detect.py
index 5337416074..1b32838525 100644
--- a/platform/osx/detect.py
+++ b/platform/osx/detect.py
@@ -38,42 +38,30 @@ def configure(env):
env.Append(CPPPATH=['#platform/osx'])
- if (env["tools"]=="no"):
- #no tools suffix
- env['OBJSUFFIX'] = ".nt"+env['OBJSUFFIX']
- env['LIBSUFFIX'] = ".nt"+env['LIBSUFFIX']
+ if (env["bits"]=="default"):
+ env["bits"]="32"
if (env["target"]=="release"):
env.Append(CCFLAGS=['-O2','-ffast-math','-fomit-frame-pointer','-ftree-vectorize','-msse2'])
- env['OBJSUFFIX'] = "_opt"+env['OBJSUFFIX']
- env['LIBSUFFIX'] = "_opt"+env['LIBSUFFIX']
elif (env["target"]=="release_debug"):
env.Append(CCFLAGS=['-O2','-DDEBUG_ENABLED'])
- env['OBJSUFFIX'] = "_optd"+env['OBJSUFFIX']
- env['LIBSUFFIX'] = "_optd"+env['LIBSUFFIX']
elif (env["target"]=="debug"):
env.Append(CCFLAGS=['-g3', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
- elif (env["target"]=="profile"):
- env.Append(CCFLAGS=['-g','-pg'])
- env.Append(LINKFLAGS=['-pg'])
-
if (env["freetype"]!="no"):
env.Append(CCFLAGS=['-DFREETYPE_ENABLED'])
env.Append(CPPPATH=['#tools/freetype'])
env.Append(CPPPATH=['#tools/freetype/freetype/include'])
- if (env["force_64_bits"]!="no"):
+ if (env["bits"]=="64"):
env.Append(CCFLAGS=['-arch', 'x86_64'])
env.Append(LINKFLAGS=['-arch', 'x86_64'])
- env['OBJSUFFIX'] = ".64"+env['OBJSUFFIX']
- env['LIBSUFFIX'] = ".64"+env['LIBSUFFIX']
else:
env.Append(CCFLAGS=['-arch', 'i386'])
env.Append(LINKFLAGS=['-arch', 'i386'])
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index c09dadc066..643c287c95 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -1070,7 +1070,20 @@ bool OS_OSX::is_mouse_grab_enabled() const {
void OS_OSX::warp_mouse_pos(const Point2& p_to) {
-//not done, must be done
+ //copied from windows impl with osx native calls
+ if (mouse_mode == MOUSE_MODE_CAPTURED){
+ mouse_x = p_to.x;
+ mouse_y = p_to.y;
+ }
+ else{ //set OS position
+ CGPoint lMouseWarpPos = {p_to.x, p_to.y};
+
+ CGEventSourceRef lEventRef = CGEventSourceCreate(kCGEventSourceStateCombinedSessionState);
+ CGEventSourceSetLocalEventsSuppressionInterval(lEventRef, 0.0);
+ CGAssociateMouseAndMouseCursorPosition(false);
+ CGWarpMouseCursorPosition(lMouseWarpPos);
+ CGAssociateMouseAndMouseCursorPosition(true);
+ }
}
Point2 OS_OSX::get_mouse_pos() const {
diff --git a/platform/server/detect.py b/platform/server/detect.py
index 682c6d0729..24b36d3188 100644
--- a/platform/server/detect.py
+++ b/platform/server/detect.py
@@ -41,50 +41,36 @@ def configure(env):
env["CXX"]="clang++"
env["LD"]="clang++"
- env['OBJSUFFIX'] = ".srv"+env['OBJSUFFIX']
- env['LIBSUFFIX'] = ".srv"+env['LIBSUFFIX']
+ is64=sys.maxsize > 2**32
- if (env["force_32_bits"]!="no"):
- env['OBJSUFFIX'] = ".32"+env['OBJSUFFIX']
- env['LIBSUFFIX'] = ".32"+env['LIBSUFFIX']
+ if (env["bits"]=="default"):
+ if (is64):
+ env["bits"]="64"
+ else:
+ env["bits"]="32"
- if (env["tools"]=="no"):
- #no tools suffix
- env['OBJSUFFIX'] = ".nt"+env['OBJSUFFIX']
- env['LIBSUFFIX'] = ".nt"+env['LIBSUFFIX']
+ #if (env["tools"]=="no"):
+ # #no tools suffix
+ # env['OBJSUFFIX'] = ".nt"+env['OBJSUFFIX']
+ # env['LIBSUFFIX'] = ".nt"+env['LIBSUFFIX']
if (env["target"]=="release"):
-
+
env.Append(CCFLAGS=['-O2','-ffast-math','-fomit-frame-pointer'])
- env['OBJSUFFIX'] = "_opt"+env['OBJSUFFIX']
- env['LIBSUFFIX'] = "_opt"+env['LIBSUFFIX']
elif (env["target"]=="release_debug"):
env.Append(CCFLAGS=['-O2','-ffast-math','-DDEBUG_ENABLED'])
- env['OBJSUFFIX'] = "_optd"+env['OBJSUFFIX']
- env['LIBSUFFIX'] = "_optd"+env['LIBSUFFIX']
-
elif (env["target"]=="debug"):
-
- env.Append(CCFLAGS=['-g2', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
- elif (env["target"]=="profile"):
-
- env.Append(CCFLAGS=['-g','-pg'])
- env.Append(LINKFLAGS=['-pg'])
+ env.Append(CCFLAGS=['-g2', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
-
env.Append(CPPFLAGS=['-DSERVER_ENABLED','-DUNIX_ENABLED'])
env.Append(LIBS=['pthread','z']) #TODO detect linux/BSD!
- if (env["force_32_bits"]=="yes"):
- env.Append(CPPFLAGS=['-m32'])
- env.Append(LINKFLAGS=['-m32','-L/usr/lib/i386-linux-gnu'])
-
if (env["CXX"]=="clang++"):
env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
env["CC"]="clang"
diff --git a/platform/windows/SCsub b/platform/windows/SCsub
index 1d454e40c2..08a775e689 100644
--- a/platform/windows/SCsub
+++ b/platform/windows/SCsub
@@ -10,4 +10,4 @@ common_win=[
"stream_peer_winsock.cpp",
]
-env.Program('#bin/godot.exe',['godot_win.cpp']+common_win)
+env.Program('#bin/godot',['godot_win.cpp']+common_win,PROGSUFFIX=env["PROGSUFFIX"])
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 3277884165..16f70b60d0 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -25,26 +25,38 @@ def can_build():
if (os.name=="posix"):
-
- if os.system("i586-mingw32msvc-gcc --version") == 0:
+
+ mingw = "i586-mingw32msvc-"
+ mingw64 = "i686-w64-mingw32-"
+ if (os.getenv("MINGW32_PREFIX")):
+ mingw=os.getenv("MINGW32_PREFIX")
+ if (os.getenv("MINGW64_PREFIX")):
+ mingw64=os.getenv("MINGW64_PREFIX")
+
+ if os.system(mingw+"gcc --version >/dev/null") == 0 or os.system(mingw64+"gcc --version >/dev/null") ==0:
return True
+
return False
def get_opts():
- mwp=""
- mwp64=""
+ mingw=""
+ mingw64=""
if (os.name!="nt"):
- mwp="i586-mingw32msvc-"
- mwp64="x86_64-w64-mingw32-"
+ mingw = "i586-mingw32msvc-"
+ mingw64 = "i686-w64-mingw32-"
+ if (os.getenv("MINGW32_PREFIX")):
+ mingw=os.getenv("MINGW32_PREFIX")
+ if (os.getenv("MINGW64_PREFIX")):
+ mingw64=os.getenv("MINGW64_PREFIX")
+
return [
- ('force_64_bits','Force 64 bits binary','no'),
- ('force_32_bits','Force 32 bits binary','no'),
- ('mingw_prefix','Mingw Prefix',mwp),
- ('mingw_prefix_64','Mingw Prefix 64 bits',mwp64),
+ ('mingw_prefix','Mingw Prefix',mingw),
+ ('mingw_prefix_64','Mingw Prefix 64 bits',mingw64),
+ ('mingw64_for_32','Use Mingw 64 for 32 Bits Build',"no"),
]
def get_flags():
@@ -52,25 +64,15 @@ def get_flags():
return [
('freetype','builtin'), #use builtin freetype
('openssl','builtin'), #use builtin openssl
+ ('theora','no'),
]
def configure(env):
- if os.name == "posix":
- env['OBJSUFFIX'] = ".win"+env['OBJSUFFIX']
- env['LIBSUFFIX'] = ".win"+env['LIBSUFFIX']
-
env.Append(CPPPATH=['#platform/windows'])
- if (env["tools"]=="no"):
- #no tools suffix
- env['OBJSUFFIX'] = ".nt"+env['OBJSUFFIX']
- #env['LIBSUFFIX'] = ".nt"+env['LIBSUFFIX']
- env['platform_libsuffix'] = ".nt"+env['LIBSUFFIX']
-
-
if (os.name=="nt" and os.getenv("VSINSTALLDIR")!=None):
#build using visual studio
@@ -89,21 +91,17 @@ def configure(env):
env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS'])
env.Append(LINKFLAGS=['/ENTRY:mainCRTStartup'])
- elif (env["target"]=="test"):
+ elif (env["target"]=="release_debug"):
- env.Append(CCFLAGS=['/O2','/DDEBUG_ENABLED','/DD3D_DEBUG_INFO'])
+ env.Append(CCFLAGS=['/O2','/DDEBUG_ENABLED'])
env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
elif (env["target"]=="debug"):
- env.Append(CCFLAGS=['/Zi','/DDEBUG_ENABLED','/DD3D_DEBUG_INFO','/O1'])
+ env.Append(CCFLAGS=['/Zi','/DDEBUG_ENABLED','/DDEBUG_MEMORY_ENABLED','/DD3D_DEBUG_INFO','/O1'])
env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
env.Append(LINKFLAGS=['/DEBUG'])
- elif (env["target"]=="profile"):
-
- env.Append(CCFLAGS=['-g','-pg'])
- env.Append(LINKFLAGS=['-pg'])
env.Append(CCFLAGS=['/MT','/Gd','/GR','/nologo'])
env.Append(CXXFLAGS=['/TP'])
@@ -117,7 +115,8 @@ def configure(env):
env.Append(CCFLAGS=['/DGLES2_ENABLED'])
env.Append(CCFLAGS=['/DGLES1_ENABLED'])
env.Append(CCFLAGS=['/DGLEW_ENABLED'])
- env.Append(LIBS=['winmm','opengl32','dsound','kernel32','ole32','user32','gdi32', 'IPHLPAPI', 'wsock32', 'shell32','advapi32'])
+ LIBS=['winmm','opengl32','dsound','kernel32','ole32','user32','gdi32', 'IPHLPAPI', 'wsock32', 'shell32','advapi32']
+ env.Append(LINKFLAGS=[p+env["LIBSUFFIX"] for p in LIBS])
env.Append(LIBPATH=[os.getenv("WindowsSdkDir")+"/Lib"])
if (os.getenv("DXSDK_DIR")):
@@ -139,47 +138,57 @@ def configure(env):
#build using mingw
if (os.name=="nt"):
env['ENV']['TMP'] = os.environ['TMP'] #way to go scons, you can be so stupid sometimes
+ else:
+ env["PROGSUFFIX"]=env["PROGSUFFIX"]+".exe"
mingw_prefix=""
- if (env["force_32_bits"]!="no"):
- env['OBJSUFFIX'] = ".32"+env['OBJSUFFIX']
- env['LIBSUFFIX'] = ".32"+env['LIBSUFFIX']
- env.Append(CCFLAGS=['-m32'])
- env.Append(LINKFLAGS=['-m32'])
- env.Append(LINKFLAGS=['-static-libgcc'])
- env.Append(LINKFLAGS=['-static-libstdc++'])
+ if (env["bits"]=="default"):
+ env["bits"]="32"
+ use64=False
+ if (env["bits"]=="32"):
+ if (env["mingw64_for_32"]=="yes"):
+ env.Append(CCFLAGS=['-m32'])
+ env.Append(LINKFLAGS=['-m32'])
+ env.Append(LINKFLAGS=['-static-libgcc'])
+ env.Append(LINKFLAGS=['-static-libstdc++'])
+ mingw_prefix=env["mingw_prefix_64"];
+ else:
+ mingw_prefix=env["mingw_prefix"];
- if (env["force_64_bits"]!="no"):
+ else:
mingw_prefix=env["mingw_prefix_64"];
- env['OBJSUFFIX'] = ".64"+env['OBJSUFFIX']
- env['LIBSUFFIX'] = ".64"+env['LIBSUFFIX']
env.Append(LINKFLAGS=['-static'])
+
+ nulstr=""
+
+ if (os.name=="posix"):
+ nulstr=">/dev/null"
else:
- mingw_prefix=env["mingw_prefix"];
+ nulstr=">nul"
+
+
+
+ if os.system(mingw_prefix+"gcc --version"+nulstr)!=0:
+ #not really super consistent but..
+ print("Can't find Windows compiler: "+mingw_prefix)
+ sys.exit(255)
if (env["target"]=="release"):
env.Append(CCFLAGS=['-O3','-ffast-math','-fomit-frame-pointer','-msse2'])
- env['OBJSUFFIX'] = "_opt"+env['OBJSUFFIX']
- env['LIBSUFFIX'] = "_opt"+env['LIBSUFFIX']
env.Append(LINKFLAGS=['-Wl,--subsystem,windows'])
+
elif (env["target"]=="release_debug"):
env.Append(CCFLAGS=['-O2','-DDEBUG_ENABLED'])
- env['OBJSUFFIX'] = "_optd"+env['OBJSUFFIX']
- env['LIBSUFFIX'] = "_optd"+env['LIBSUFFIX']
elif (env["target"]=="debug"):
- env.Append(CCFLAGS=['-g', '-Wall','-DDEBUG_ENABLED'])
- elif (env["target"]=="release_tools"):
-
- env.Append(CCFLAGS=['-O2','-Wall','-DDEBUG_ENABLED'])
-
+ env.Append(CCFLAGS=['-g', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
if (env["freetype"]!="no"):
env.Append(CCFLAGS=['-DFREETYPE_ENABLED'])
diff --git a/platform/winrt/SCsub b/platform/winrt/SCsub
index c83f4fab32..07e2ba81a6 100644
--- a/platform/winrt/SCsub
+++ b/platform/winrt/SCsub
@@ -3,6 +3,9 @@ Import('env')
files = [
'thread_winrt.cpp',
# '#platform/windows/stream_peer_winsock.cpp',
+ 'gl_context_egl.cpp',
+ 'app.cpp',
+ 'os_winrt.cpp',
]
-env.Program('#bin/godot_rt.exe', files)
+env.Program('#bin/godot_rt', files)
diff --git a/platform/winrt/app.cpp b/platform/winrt/app.cpp
new file mode 100644
index 0000000000..e3213d574a
--- /dev/null
+++ b/platform/winrt/app.cpp
@@ -0,0 +1,162 @@
+//
+// This file demonstrates how to initialize EGL in a Windows Store app, using ICoreWindow.
+//
+
+#include "app.h"
+
+#include "main/main.h"
+
+using namespace Windows::ApplicationModel::Core;
+using namespace Windows::ApplicationModel::Activation;
+using namespace Windows::UI::Core;
+using namespace Windows::UI::Input;
+using namespace Windows::Foundation;
+using namespace Windows::Graphics::Display;
+using namespace Microsoft::WRL;
+using namespace Platform;
+
+using namespace $ext_safeprojectname$;
+
+// Helper to convert a length in device-independent pixels (DIPs) to a length in physical pixels.
+inline float ConvertDipsToPixels(float dips, float dpi)
+{
+ static const float dipsPerInch = 96.0f;
+ return floor(dips * dpi / dipsPerInch + 0.5f); // Round to nearest integer.
+}
+
+// Implementation of the IFrameworkViewSource interface, necessary to run our app.
+ref class HelloTriangleApplicationSource sealed : Windows::ApplicationModel::Core::IFrameworkViewSource
+{
+public:
+ virtual Windows::ApplicationModel::Core::IFrameworkView^ CreateView()
+ {
+ return ref new App();
+ }
+};
+
+// The main function creates an IFrameworkViewSource for our app, and runs the app.
+[Platform::MTAThread]
+int main(Platform::Array<Platform::String^>^)
+{
+ auto helloTriangleApplicationSource = ref new HelloTriangleApplicationSource();
+ CoreApplication::Run(helloTriangleApplicationSource);
+ return 0;
+}
+
+App::App() :
+ mWindowClosed(false),
+ mWindowVisible(true),
+ mWindowWidth(0),
+ mWindowHeight(0),
+ mEglDisplay(EGL_NO_DISPLAY),
+ mEglContext(EGL_NO_CONTEXT),
+ mEglSurface(EGL_NO_SURFACE)
+{
+}
+
+// The first method called when the IFrameworkView is being created.
+void App::Initialize(CoreApplicationView^ applicationView)
+{
+ // Register event handlers for app lifecycle. This example includes Activated, so that we
+ // can make the CoreWindow active and start rendering on the window.
+ applicationView->Activated +=
+ ref new TypedEventHandler<CoreApplicationView^, IActivatedEventArgs^>(this, &App::OnActivated);
+
+ // Logic for other event handlers could go here.
+ // Information about the Suspending and Resuming event handlers can be found here:
+ // http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh994930.aspx
+
+ os = new OSWinrt;
+}
+
+// Called when the CoreWindow object is created (or re-created).
+void App::SetWindow(CoreWindow^ window)
+{
+ window->VisibilityChanged +=
+ ref new TypedEventHandler<CoreWindow^, VisibilityChangedEventArgs^>(this, &App::OnVisibilityChanged);
+
+ window->Closed +=
+ ref new TypedEventHandler<CoreWindow^, CoreWindowEventArgs^>(this, &App::OnWindowClosed);
+
+ window->SizeChanged +=
+ ref new TypedEventHandler<CoreWindow^, WindowSizeChangedEventArgs^>(this, &App::OnWindowSizeChanged);
+
+#if !(WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
+ // Disable all pointer visual feedback for better performance when touching.
+ // This is not supported on Windows Phone applications.
+ auto pointerVisualizationSettings = PointerVisualizationSettings::GetForCurrentView();
+ pointerVisualizationSettings->IsContactFeedbackEnabled = false;
+ pointerVisualizationSettings->IsBarrelButtonFeedbackEnabled = false;
+#endif
+
+ // The CoreWindow has been created, so EGL can be initialized.
+ ContextEGL* context = memnew(ContextEGL(window));
+ os->set_gl_context(context);
+ UpdateWindowSize(Size(window->Bounds.Width, window->Bounds.Height));
+}
+
+// Initializes scene resources
+void App::Load(Platform::String^ entryPoint)
+{
+ char** args = {NULL};
+ Main::setup("winrt", 0, args);
+}
+
+// This method is called after the window becomes active.
+void App::Run()
+{
+
+ if (Main::start())
+ os->run();
+}
+
+// Terminate events do not cause Uninitialize to be called. It will be called if your IFrameworkView
+// class is torn down while the app is in the foreground.
+void App::Uninitialize()
+{
+ Main::cleanup();
+ delete os;
+}
+
+// Application lifecycle event handler.
+void App::OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ args)
+{
+ // Run() won't start until the CoreWindow is activated.
+ CoreWindow::GetForCurrentThread()->Activate();
+}
+
+// Window event handlers.
+void App::OnVisibilityChanged(CoreWindow^ sender, VisibilityChangedEventArgs^ args)
+{
+ mWindowVisible = args->Visible;
+}
+
+void App::OnWindowClosed(CoreWindow^ sender, CoreWindowEventArgs^ args)
+{
+ mWindowClosed = true;
+}
+
+void App::OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEventArgs^ args)
+{
+#if (WINAPI_FAMILY == WINAPI_FAMILY_PC_APP)
+ // On Windows 8.1, apps are resized when they are snapped alongside other apps, or when the device is rotated.
+ // The default framebuffer will be automatically resized when either of these occur.
+ // In particular, on a 90 degree rotation, the default framebuffer's width and height will switch.
+ UpdateWindowSize(args->Size);
+#else if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
+ // On Windows Phone 8.1, the window size changes when the device is rotated.
+ // The default framebuffer will not be automatically resized when this occurs.
+ // It is therefore up to the app to handle rotation-specific logic in its rendering code.
+#endif
+}
+
+void App::UpdateWindowSize(Size size)
+{
+ /*
+ DisplayInformation^ currentDisplayInformation = DisplayInformation::GetForCurrentView();
+ Size pixelSize(ConvertDipsToPixels(size.Width, currentDisplayInformation->LogicalDpi), ConvertDipsToPixels(size.Height, currentDisplayInformation->LogicalDpi));
+
+ mWindowWidth = static_cast<GLsizei>(pixelSize.Width);
+ mWindowHeight = static_cast<GLsizei>(pixelSize.Height);
+ */
+}
diff --git a/platform/winrt/app.h b/platform/winrt/app.h
new file mode 100644
index 0000000000..a67b936cdf
--- /dev/null
+++ b/platform/winrt/app.h
@@ -0,0 +1,51 @@
+#pragma once
+
+#include <string>
+
+#include <wrl.h>
+
+#include "os_winrt.h"
+#include "GLES2/gl2.h"
+
+namespace $ext_safeprojectname$
+{
+ ref class App sealed : public Windows::ApplicationModel::Core::IFrameworkView
+ {
+ public:
+ App();
+
+ // IFrameworkView Methods.
+ virtual void Initialize(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView);
+ virtual void SetWindow(Windows::UI::Core::CoreWindow^ window);
+ virtual void Load(Platform::String^ entryPoint);
+ virtual void Run();
+ virtual void Uninitialize();
+
+ private:
+ void RecreateRenderer();
+
+ // Application lifecycle event handlers.
+ void OnActivated(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView, Windows::ApplicationModel::Activation::IActivatedEventArgs^ args);
+
+ // Window event handlers.
+ void OnWindowSizeChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ args);
+ void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args);
+ void OnWindowClosed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CoreWindowEventArgs^ args);
+
+ void UpdateWindowSize(Windows::Foundation::Size size);
+ void InitializeEGL(Windows::UI::Core::CoreWindow^ window);
+ void CleanupEGL();
+
+ bool mWindowClosed;
+ bool mWindowVisible;
+ GLsizei mWindowWidth;
+ GLsizei mWindowHeight;
+
+ EGLDisplay mEglDisplay;
+ EGLContext mEglContext;
+ EGLSurface mEglSurface;
+
+ OSWinrt* os;
+ };
+
+}
diff --git a/platform/winrt/detect.py b/platform/winrt/detect.py
index d09688b71c..00913b0ade 100644
--- a/platform/winrt/detect.py
+++ b/platform/winrt/detect.py
@@ -57,13 +57,13 @@ def configure(env):
env.Append(CCFLAGS=['-g','-pg'])
env.Append(LINKFLAGS=['-pg'])
- env.Append(CCFLAGS=['/Gd','/GR','/nologo', '/ZW', '/EHsc'])
- env.Append(CXXFLAGS=['/TP'])
+ env.Append(CCFLAGS=['/Gd','/GR','/nologo', '/EHsc'])
+ env.Append(CXXFLAGS=['/TP', '/ZW'])
env.Append(CPPFLAGS=['/DMSVC', '/GR', ])
#env.Append(CCFLAGS=['/I'+os.getenv("WindowsSdkDir")+"/Include"])
env.Append(CCFLAGS=['/DWINRT_ENABLED'])
env.Append(CCFLAGS=['/DWINDOWS_ENABLED'])
- env.Append(CCFLAGS=['/DWINAPI_FAMILY=WINAPI_FAMILY_APP'])
+ env.Append(CCFLAGS=['/DWINAPI_FAMILY=WINAPI_FAMILY_APP', '/D_WIN32_WINNT=0x0603', '/DNTDDI_VERSION=0x06030000'])
env.Append(CCFLAGS=['/DRTAUDIO_ENABLED'])
#env.Append(CCFLAGS=['/DWIN32'])
env.Append(CCFLAGS=['/DTYPED_METHOD_BIND'])
diff --git a/platform/winrt/gl_context_egl.cpp b/platform/winrt/gl_context_egl.cpp
new file mode 100644
index 0000000000..ca592c5d19
--- /dev/null
+++ b/platform/winrt/gl_context_egl.cpp
@@ -0,0 +1,151 @@
+#include "gl_context_egl.h"
+
+using namespace Platform;
+
+void ContextEGL::release_current() {
+
+ eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, mEglContext);
+};
+
+void ContextEGL::make_current() {
+
+ eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext);
+};
+
+int ContextEGL::get_window_width() {
+
+ return width;
+};
+
+int ContextEGL::get_window_height() {
+
+ return height;
+};
+
+void ContextEGL::swap_buffers() {
+
+ if (eglSwapBuffers(mEglDisplay, mEglSurface) != EGL_TRUE)
+ {
+ cleanup();
+
+ window = CoreWindow::GetForCurrentThread();
+ initialize();
+
+ // tell rasterizer to reload textures and stuff?
+ }
+};
+
+Error ContextEGL::initialize() {
+
+ EGLint configAttribList[] = {
+ EGL_RED_SIZE, 8,
+ EGL_GREEN_SIZE, 8,
+ EGL_BLUE_SIZE, 8,
+ EGL_ALPHA_SIZE, 8,
+ EGL_DEPTH_SIZE, 8,
+ EGL_STENCIL_SIZE, 8,
+ EGL_SAMPLE_BUFFERS, 0,
+ EGL_NONE
+ };
+
+ EGLint surfaceAttribList[] = {
+ EGL_NONE, EGL_NONE
+ };
+
+ EGLint numConfigs = 0;
+ EGLint majorVersion = 1;
+ EGLint minorVersion = 0;
+ EGLDisplay display = EGL_NO_DISPLAY;
+ EGLContext context = EGL_NO_CONTEXT;
+ EGLSurface surface = EGL_NO_SURFACE;
+ EGLConfig config = nullptr;
+ EGLint contextAttribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE, EGL_NONE };
+
+ try {
+
+ display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
+ if (display == EGL_NO_DISPLAY)
+ {
+ throw Exception::CreateException(E_FAIL, L"Failed to get default EGL display");
+ }
+
+ if (eglInitialize(display, &majorVersion, &minorVersion) == EGL_FALSE)
+ {
+ throw Exception::CreateException(E_FAIL, L"Failed to initialize EGL");
+ }
+
+ if (eglGetConfigs(display, NULL, 0, &numConfigs) == EGL_FALSE)
+ {
+ throw Exception::CreateException(E_FAIL, L"Failed to get EGLConfig count");
+ }
+
+ if (eglChooseConfig(display, configAttribList, &config, 1, &numConfigs) == EGL_FALSE)
+ {
+ throw Exception::CreateException(E_FAIL, L"Failed to choose first EGLConfig count");
+ }
+
+ surface = eglCreateWindowSurface(display, config, reinterpret_cast<IInspectable*>(window), surfaceAttribList);
+ if (surface == EGL_NO_SURFACE)
+ {
+ throw Exception::CreateException(E_FAIL, L"Failed to create EGL fullscreen surface");
+ }
+
+ context = eglCreateContext(display, config, EGL_NO_CONTEXT, contextAttribs);
+ if (context == EGL_NO_CONTEXT)
+ {
+ throw Exception::CreateException(E_FAIL, L"Failed to create EGL context");
+ }
+
+ if (eglMakeCurrent(display, surface, surface, context) == EGL_FALSE)
+ {
+ throw Exception::CreateException(E_FAIL, L"Failed to make fullscreen EGLSurface current");
+ }
+ } catch (...) {
+ return FAILED;
+ };
+
+ mEglDisplay = display;
+ mEglSurface = surface;
+ mEglContext = context;
+
+ eglQuerySurface(display,surface,EGL_WIDTH,&width);
+ eglQuerySurface(display,surface,EGL_HEIGHT,&height);
+
+ return OK;
+};
+
+void ContextEGL::cleanup() {
+
+ if (mEglDisplay != EGL_NO_DISPLAY && mEglSurface != EGL_NO_SURFACE)
+ {
+ eglDestroySurface(mEglDisplay, mEglSurface);
+ mEglSurface = EGL_NO_SURFACE;
+ }
+
+ if (mEglDisplay != EGL_NO_DISPLAY && mEglContext != EGL_NO_CONTEXT)
+ {
+ eglDestroyContext(mEglDisplay, mEglContext);
+ mEglContext = EGL_NO_CONTEXT;
+ }
+
+ if (mEglDisplay != EGL_NO_DISPLAY)
+ {
+ eglTerminate(mEglDisplay);
+ mEglDisplay = EGL_NO_DISPLAY;
+ }
+};
+
+ContextEGL::ContextEGL(CoreWindow^ p_window) :
+ mEglDisplay(EGL_NO_DISPLAY),
+ mEglContext(EGL_NO_CONTEXT),
+ mEglSurface(EGL_NO_SURFACE)
+ {
+
+ window = p_window;
+};
+
+ContextEGL::~ContextEGL() {
+
+ cleanup();
+};
+
diff --git a/platform/winrt/gl_context_egl.h b/platform/winrt/gl_context_egl.h
new file mode 100644
index 0000000000..56bf654ee5
--- /dev/null
+++ b/platform/winrt/gl_context_egl.h
@@ -0,0 +1,44 @@
+#ifndef CONTEXT_EGL_H
+#define CONTEXT_EGL_H
+
+#include <wrl.h>
+
+#include "os/os.h"
+#include "EGL/egl.h"
+#include "error_list.h"
+#include "drivers/gl_context/context_gl.h"
+
+using namespace Windows::UI::Core;
+
+class ContextEGL : public ContextGL {
+
+ CoreWindow^ window;
+
+ EGLDisplay mEglDisplay;
+ EGLContext mEglContext;
+ EGLSurface mEglSurface;
+
+ EGLint width;
+ EGLint height;
+
+public:
+
+ virtual void release_current();
+
+ virtual void make_current();
+
+ virtual int get_window_width();
+ virtual int get_window_height();
+ virtual void swap_buffers();
+
+ virtual Error initialize();
+
+ void cleanup();
+
+ ContextEGL(CoreWindow^ p_window);
+ ~ContextEGL();
+
+};
+
+#endif
+
diff --git a/platform/winrt/os_winrt.cpp b/platform/winrt/os_winrt.cpp
index 16a74c877c..99c4ad968e 100644
--- a/platform/winrt/os_winrt.cpp
+++ b/platform/winrt/os_winrt.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* os_windows.cpp */
+/* os_winrt.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,12 +28,12 @@
/*************************************************************************/
#include "drivers/gles2/rasterizer_gles2.h"
#include "drivers/gles1/rasterizer_gles1.h"
-#include "os_windows.h"
+#include "os_winrt.h"
#include "drivers/nedmalloc/memory_pool_static_nedmalloc.h"
#include "drivers/unix/memory_pool_static_malloc.h"
#include "os/memory_pool_dynamic_static.h"
-#include "drivers/windows/thread_windows.h"
-#include "drivers/windows/semaphore_windows.h"
+#include "thread_winrt.h"
+//#include "drivers/windows/semaphore_windows.h"
#include "drivers/windows/mutex_windows.h"
#include "main/main.h"
#include "drivers/windows/file_access_windows.h"
@@ -44,14 +44,22 @@
#include "servers/audio/audio_server_sw.h"
#include "servers/visual/visual_server_wrap_mt.h"
-#include "tcp_server_winsock.h"
-#include "stream_peer_winsock.h"
#include "os/pc_joystick_map.h"
-#include "lang_table.h"
#include "os/memory_pool_dynamic_prealloc.h"
#include "globals.h"
#include "io/marshalls.h"
+#include <wrl.h>
+
+using namespace Windows::ApplicationModel::Core;
+using namespace Windows::ApplicationModel::Activation;
+using namespace Windows::UI::Core;
+using namespace Windows::UI::Input;
+using namespace Windows::Foundation;
+using namespace Windows::Graphics::Display;
+using namespace Microsoft::WRL;
+
+
int OSWinrt::get_video_driver_count() const {
return 2;
@@ -129,59 +137,18 @@ bool OSWinrt::can_draw() const {
};
-void OSWinrt::_touch_event(int idx, UINT uMsg, WPARAM wParam, LPARAM lParam) {
-
- InputEvent event;
- event.type = InputEvent::SCREEN_TOUCH;
- event.ID=++last_id;
- event.screen_touch.index = idx;
+void OSWinrt::set_gl_context(ContextEGL* p_context) {
- switch (uMsg) {
- case WM_LBUTTONDOWN:
- case WM_MBUTTONDOWN:
- case WM_RBUTTONDOWN: {
-
- event.screen_touch.pressed = true;
- } break;
-
- case WM_LBUTTONUP:
- case WM_MBUTTONUP:
- case WM_RBUTTONUP: {
- event.screen_touch.pressed = false;
- } break;
- };
-
- event.screen_touch.x=GET_X_LPARAM(lParam);
- event.screen_touch.y=GET_Y_LPARAM(lParam);
-
- if (main_loop) {
- input->parse_input_event(event);
- }
+ gl_context = p_context;
};
-void OSWinrt::_drag_event(int idx,UINT uMsg, WPARAM wParam, LPARAM lParam) {
-
- InputEvent event;
- event.type = InputEvent::SCREEN_DRAG;
- event.ID=++last_id;
- event.screen_drag.index = idx;
-
- event.screen_drag.x=GET_X_LPARAM(lParam);
- event.screen_drag.y=GET_Y_LPARAM(lParam);
-
- if (main_loop)
- input->parse_input_event(event);
-};
-
-
void OSWinrt::initialize(const VideoMode& p_desired,int p_video_driver,int p_audio_driver) {
-
-
main_loop=NULL;
outside=true;
-
+ gl_context->initialize();
+
visual_server = memnew( VisualServerRaster(rasterizer) );
if (get_render_thread_mode()!=RENDER_THREAD_UNSAFE) {
@@ -222,6 +189,7 @@ void OSWinrt::initialize(const VideoMode& p_desired,int p_video_driver,int p_aud
void OSWinrt::set_clipboard(const String& p_text) {
+ /*
if (!OpenClipboard(hWnd)) {
ERR_EXPLAIN("Unable to open clipboard.");
ERR_FAIL();
@@ -255,10 +223,12 @@ void OSWinrt::set_clipboard(const String& p_text) {
SetClipboardData(CF_TEXT, mem);
CloseClipboard();
+ */
};
String OSWinrt::get_clipboard() const {
+ /*
String ret;
if (!OpenClipboard(hWnd)) {
ERR_EXPLAIN("Unable to open clipboard.");
@@ -295,6 +265,8 @@ String OSWinrt::get_clipboard() const {
CloseClipboard();
return ret;
+ */
+ return "";
};
@@ -327,10 +299,6 @@ void OSWinrt::finalize() {
if (rasterizer)
memdelete(rasterizer);
- if (user_proc) {
- SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)user_proc);
- };
-
spatial_sound_server->finish();
memdelete(spatial_sound_server);
spatial_sound_2d_server->finish();
@@ -355,16 +323,11 @@ void OSWinrt::finalize() {
}
void OSWinrt::finalize_core() {
- memdelete(process_map);
-
if (mempool_dynamic)
memdelete( mempool_dynamic );
if (mempool_static)
delete mempool_static;
-
- TCPServerWinsock::cleanup();
- StreamPeerWinsock::cleanup();
}
void OSWinrt::vprint(const char* p_format, va_list p_list, bool p_stderr) {
@@ -399,10 +362,7 @@ void OSWinrt::vprint(const char* p_format, va_list p_list, bool p_stderr) {
void OSWinrt::alert(const String& p_alert,const String& p_title) {
- if (!is_no_window_mode_enabled())
- MessageBoxW(NULL,p_alert.c_str(),p_title.c_str(),MB_OK|MB_ICONEXCLAMATION);
- else
- print_line("ALERT: "+p_alert);
+ print_line("ALERT: "+p_alert);
}
void OSWinrt::set_mouse_mode(MouseMode p_mode) {
@@ -445,71 +405,16 @@ void OSWinrt::get_fullscreen_mode_list(List<VideoMode> *p_list,int p_screen) con
void OSWinrt::print_error(const char* p_function,const char* p_file,int p_line,const char *p_code,const char*p_rationale,ErrorType p_type) {
- HANDLE hCon=GetStdHandle(STD_OUTPUT_HANDLE);
- if (!hCon || hCon==INVALID_HANDLE_VALUE) {
- if (p_rationale && p_rationale[0]) {
-
- print("\E[1;31;40mERROR: %s: \E[1;37;40m%s\n",p_function,p_rationale);
- print("\E[0;31;40m At: %s:%i.\E[0;0;37m\n",p_file,p_line);
+ if (p_rationale && p_rationale[0]) {
- } else {
- print("\E[1;31;40mERROR: %s: \E[1;37;40m%s\n",p_function,p_code);
- print("\E[0;31;40m At: %s:%i.\E[0;0;37m\n",p_file,p_line);
+ print("\E[1;31;40mERROR: %s: \E[1;37;40m%s\n",p_function,p_rationale);
+ print("\E[0;31;40m At: %s:%i.\E[0;0;37m\n",p_file,p_line);
- }
} else {
+ print("\E[1;31;40mERROR: %s: \E[1;37;40m%s\n",p_function,p_code);
+ print("\E[0;31;40m At: %s:%i.\E[0;0;37m\n",p_file,p_line);
- CONSOLE_SCREEN_BUFFER_INFO sbi; //original
- GetConsoleScreenBufferInfo(hCon,&sbi);
-
- SetConsoleTextAttribute(hCon,sbi.wAttributes);
-
-
-
- uint32_t basecol=0;
- switch(p_type) {
- case ERR_ERROR: basecol = FOREGROUND_RED; break;
- case ERR_WARNING: basecol = FOREGROUND_RED|FOREGROUND_GREEN; break;
- case ERR_SCRIPT: basecol = FOREGROUND_GREEN; break;
- }
-
- if (p_rationale && p_rationale[0]) {
-
- SetConsoleTextAttribute(hCon,basecol|FOREGROUND_INTENSITY);
-
-
- switch(p_type) {
- case ERR_ERROR: print("ERROR: "); break;
- case ERR_WARNING: print("WARNING: "); break;
- case ERR_SCRIPT: print("SCRIPT ERROR: "); break;
- }
-
- SetConsoleTextAttribute(hCon,FOREGROUND_RED|FOREGROUND_BLUE|FOREGROUND_GREEN|FOREGROUND_INTENSITY);
- print(" %s\n",p_rationale);
- SetConsoleTextAttribute(hCon,basecol);
- print("At: ");
- SetConsoleTextAttribute(hCon,FOREGROUND_RED|FOREGROUND_BLUE|FOREGROUND_GREEN);
- print(" %s:%i\n",p_file,p_line);
-
-
- } else {
- SetConsoleTextAttribute(hCon,basecol|FOREGROUND_INTENSITY);
- switch(p_type) {
- case ERR_ERROR: print("ERROR: %s: ",p_function); break;
- case ERR_WARNING: print("WARNING: %s: ",p_function); break;
- case ERR_SCRIPT: print("SCRIPT ERROR: %s: ",p_function); break;
- }
- SetConsoleTextAttribute(hCon,FOREGROUND_RED|FOREGROUND_BLUE|FOREGROUND_GREEN|FOREGROUND_INTENSITY);
- print(" %s\n",p_code);
- SetConsoleTextAttribute(hCon,basecol);
- print("At: ");
- SetConsoleTextAttribute(hCon,FOREGROUND_RED|FOREGROUND_BLUE|FOREGROUND_GREEN);
- print(" %s:%i\n",p_file,p_line);
- }
-
- SetConsoleTextAttribute(hCon,sbi.wAttributes);
}
-
}
@@ -566,10 +471,10 @@ uint64_t OSWinrt::get_unix_time() const {
void OSWinrt::delay_usec(uint32_t p_usec) const {
- if (p_usec < 1000)
- Sleep(1);
- else
- Sleep(p_usec / 1000);
+ int msec = p_usec < 1000 ? 1 : p_usec / 1000;
+
+ // no Sleep()
+ WaitForSingleObjectEx(GetCurrentThread(), msec, false);
}
uint64_t OSWinrt::get_ticks_usec() const {
@@ -607,19 +512,12 @@ Error OSWinrt::kill(const ProcessID& p_pid) {
Error OSWinrt::set_cwd(const String& p_cwd) {
- if (_wchdir(p_cwd.c_str())!=0)
- return ERR_CANT_OPEN;
-
return OK;
}
String OSWinrt::get_executable_path() const {
- wchar_t bufname[4096];
- GetModuleFileNameW(NULL,bufname,4096);
- String s= bufname;
- print_line("EXEC PATHPó: "+s);
- return s;
+ return "";
}
void OSWinrt::set_icon(const Image& p_icon) {
@@ -629,25 +527,16 @@ void OSWinrt::set_icon(const Image& p_icon) {
bool OSWinrt::has_environment(const String& p_var) const {
- return getenv(p_var.utf8().get_data()) != NULL;
+ return false;
};
String OSWinrt::get_environment(const String& p_var) const {
- char* val = getenv(p_var.utf8().get_data());
- if (val)
- return val;
-
return "";
};
String OSWinrt::get_stdin_string(bool p_block) {
- if (p_block) {
- char buff[1024];
- return fgets(buff,1024,stdin);
- };
-
return String();
}
@@ -665,23 +554,22 @@ Error OSWinrt::shell_open(String p_uri) {
String OSWinrt::get_locale() const {
Platform::String ^language = Windows::Globalization::Language::CurrentInputMethodLanguageTag;
- return language.Data();
+ return language->Data();
}
void OSWinrt::release_rendering_thread() {
- //gl_context->release_current();
-
+ gl_context->release_current();
}
void OSWinrt::make_rendering_thread() {
- //gl_context->make_current();
+ gl_context->make_current();
}
void OSWinrt::swap_buffers() {
- //gl_context->swap_buffers();
+ gl_context->swap_buffers();
}
@@ -699,6 +587,7 @@ void OSWinrt::run() {
while (!force_quit) {
+ CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent);
process_events(); // get rid of pending events
if (Main::iteration()==true)
break;
@@ -724,7 +613,7 @@ String OSWinrt::get_data_dir() const {
}
-OSWinrt::OSWinrt(HINSTANCE _hInstance) {
+OSWinrt::OSWinrt() {
key_event_pos=0;
force_quit=false;
@@ -743,6 +632,8 @@ OSWinrt::OSWinrt(HINSTANCE _hInstance) {
stdo=fopen("stdout.txt","wb");
#endif
+ gl_context = NULL;
+
}
diff --git a/platform/winrt/os_winrt.h b/platform/winrt/os_winrt.h
index bc7e188c20..c309239af1 100644
--- a/platform/winrt/os_winrt.h
+++ b/platform/winrt/os_winrt.h
@@ -41,11 +41,10 @@
#include "servers/spatial_sound_2d/spatial_sound_2d_server_sw.h"
#include "servers/physics_2d/physics_2d_server_sw.h"
+#include "gl_context_egl.h"
#include <windows.h>
-#include "key_mapping_win.h"
-#include <windowsx.h>
#include <io.h>
#include <fcntl.h>
@@ -93,6 +92,8 @@ class OSWinrt : public OS {
Physics2DServer *physics_2d_server;
int pressrc;
+ ContextEGL* gl_context;
+
struct Joystick {
int id;
@@ -224,6 +225,8 @@ public:
virtual void move_window_to_foreground();
virtual String get_data_dir() const;
+ void set_gl_context(ContextEGL* p_context);
+
virtual void release_rendering_thread();
virtual void make_rendering_thread();
virtual void swap_buffers();
diff --git a/platform/x11/SCsub b/platform/x11/SCsub
index 1a552cbaac..7a6f02daa5 100644
--- a/platform/x11/SCsub
+++ b/platform/x11/SCsub
@@ -8,5 +8,3 @@ common_x11=[\
]
env.Program('#bin/godot',['godot_x11.cpp']+common_x11)
-if env['target'] == "release":
- env.Command('#bin/godot_rel', '#bin/godot', Copy('bin/godot_rel', 'bin/godot'))
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index cff7ea86b6..03de91fa2f 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -47,22 +47,29 @@ def get_opts():
return [
('use_llvm','Use llvm compiler','no'),
('use_sanitizer','Use llvm compiler sanitize address','no'),
- ('force_32_bits','Force 32 bits binary','no')
]
def get_flags():
return [
- ('opengl', 'no'),
- ('legacygl', 'yes'),
('builtin_zlib', 'no'),
("openssl", "yes"),
+ ("theora","no"),
]
def configure(env):
+ is64=sys.maxsize > 2**32
+
+ if (env["bits"]=="default"):
+ if (is64):
+ env["bits"]="64"
+ else:
+ env["bits"]="32"
+
+
env.Append(CPPPATH=['#platform/x11'])
if (env["use_llvm"]=="yes"):
env["CC"]="clang"
@@ -71,53 +78,30 @@ def configure(env):
if (env["use_sanitizer"]=="yes"):
env.Append(CXXFLAGS=['-fsanitize=address','-fno-omit-frame-pointer'])
env.Append(LINKFLAGS=['-fsanitize=address'])
+ env.extra_suffix=".llvms"
+ else:
+ env.extra_suffix=".llvm"
+
- if (env["tools"]=="no"):
- #no tools suffix
- env['OBJSUFFIX'] = ".nt"+env['OBJSUFFIX']
- env['LIBSUFFIX'] = ".nt"+env['LIBSUFFIX']
+ #if (env["tools"]=="no"):
+ # #no tools suffix
+ # env['OBJSUFFIX'] = ".nt"+env['OBJSUFFIX']
+ # env['LIBSUFFIX'] = ".nt"+env['LIBSUFFIX']
if (env["target"]=="release"):
env.Append(CCFLAGS=['-O2','-ffast-math','-fomit-frame-pointer'])
- env['OBJSUFFIX'] = "_opt"+env['OBJSUFFIX']
- env['LIBSUFFIX'] = "_opt"+env['LIBSUFFIX']
elif (env["target"]=="release_debug"):
env.Append(CCFLAGS=['-O2','-ffast-math','-DDEBUG_ENABLED'])
- env['OBJSUFFIX'] = "_optd"+env['OBJSUFFIX']
- env['LIBSUFFIX'] = "_optd"+env['LIBSUFFIX']
-
-
-# env.Append(CCFLAGS=['-Os','-ffast-math','-fomit-frame-pointer'])
-#does not seem to have much effect
-# env.Append(CCFLAGS=['-fno-default-inline'])
-#recommended by wxwidgets
-# env.Append(CCFLAGS=['-ffunction-sections','-fdata-sections'])
-# env.Append(LINKFLAGS=['-Wl','--gc-sections'])
elif (env["target"]=="debug"):
-
- env.Append(CCFLAGS=['-g2', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
-#does not seem to have much effect
-# env.Append(CCFLAGS=['-fno-default-inline'])
-#recommended by wxwidgets
-# env.Append(CCFLAGS=['-ffunction-sections','-fdata-sections'])
-# env.Append(LINKFLAGS=['-Wl','--gc-sections'])
- elif (env["target"]=="debug_light"):
-
- env.Append(CCFLAGS=['-g1', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
-
-
- elif (env["target"]=="profile"):
-
- env.Append(CCFLAGS=['-g','-pg'])
- env.Append(LINKFLAGS=['-pg'])
+ env.Append(CCFLAGS=['-g2', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
env.ParseConfig('pkg-config x11 --cflags --libs')
env.ParseConfig('pkg-config xcursor --cflags --libs')
@@ -128,19 +112,20 @@ def configure(env):
env.Append(CCFLAGS=['-DFREETYPE_ENABLED'])
- if env['opengl'] == 'yes':
- env.Append(CPPFLAGS=['-DOPENGL_ENABLED','-DGLEW_ENABLED'])
- #env.Append(CPPFLAGS=["-DRTAUDIO_ENABLED"])
+ env.Append(CPPFLAGS=['-DOPENGL_ENABLED','-DGLEW_ENABLED'])
env.Append(CPPFLAGS=["-DALSA_ENABLED"])
env.Append(CPPFLAGS=['-DX11_ENABLED','-DUNIX_ENABLED','-DGLES2_ENABLED','-DGLES1_ENABLED','-DGLES_OVER_GL'])
-# env.Append(CPPFLAGS=['-DX11_ENABLED','-DUNIX_ENABLED','-DGLES2_ENABLED','-DGLES_OVER_GL'])
env.Append(LIBS=['GL', 'GLU', 'pthread','asound','z']) #TODO detect linux/BSD!
#env.Append(CPPFLAGS=['-DMPC_FIXED_POINT'])
- if (env["force_32_bits"]=="yes"):
+
+#host compiler is default..
+
+ if (is64 and env["bits"]=="32"):
env.Append(CPPFLAGS=['-m32'])
env.Append(LINKFLAGS=['-m32','-L/usr/lib/i386-linux-gnu'])
- env['OBJSUFFIX'] = ".32"+env['OBJSUFFIX']
- env['LIBSUFFIX'] = ".32"+env['LIBSUFFIX']
+ elif (not is64 and env["bits"]=="32"):
+ env.Append(CPPFLAGS=['-m64'])
+ env.Append(LINKFLAGS=['-m64','-L/usr/lib/i686-linux-gnu'])
if (env["CXX"]=="clang++"):