diff options
| author | Juan Linietsky | 2015-09-24 18:07:13 -0300 |
|---|---|---|
| committer | Juan Linietsky | 2015-09-24 18:07:13 -0300 |
| commit | 9962518ffdcbd6936e3565311152799d7a71c9c3 (patch) | |
| tree | c2706fc63d28b588daebb94a940d94f32b402b65 /platform | |
| parent | 82a3304458738b410a5aff8994ce587413aeb464 (diff) | |
| parent | f6957eb1542fd0fd476140b1abec1f09a250fce4 (diff) | |
| download | godot-9962518ffdcbd6936e3565311152799d7a71c9c3.tar.gz godot-9962518ffdcbd6936e3565311152799d7a71c9c3.tar.zst godot-9962518ffdcbd6936e3565311152799d7a71c9c3.zip | |
Merge branch 'master' of https://github.com/okamstudio/godot
Diffstat (limited to 'platform')
| -rw-r--r-- | platform/android/export/export.cpp | 16 | ||||
| -rw-r--r-- | platform/bb10/export/export.cpp | 10 | ||||
| -rwxr-xr-x | platform/iphone/gl_view.mm | 2 | ||||
| -rw-r--r-- | platform/javascript/SCsub | 2 | ||||
| -rw-r--r-- | platform/javascript/audio_server_javascript.cpp | 11 | ||||
| -rw-r--r-- | platform/javascript/export/export.cpp | 10 | ||||
| -rw-r--r-- | platform/javascript/javascript_main.cpp | 57 | ||||
| -rw-r--r-- | platform/javascript/os_javascript.cpp | 43 | ||||
| -rw-r--r-- | platform/javascript/os_javascript.h | 7 | ||||
| -rw-r--r-- | platform/osx/export/export.cpp | 8 | ||||
| -rw-r--r-- | platform/x11/detect.py | 13 | ||||
| -rw-r--r-- | platform/x11/os_x11.cpp | 10 | ||||
| -rw-r--r-- | platform/x11/os_x11.h | 2 |
13 files changed, 152 insertions, 39 deletions
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 982ef9d1c..f8fc03ec6 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -249,11 +249,11 @@ public: virtual int get_device_count() const; virtual String get_device_name(int p_device) const; virtual String get_device_info(int p_device) const; - virtual Error run(int p_device,bool p_dumb=false,bool p_remote_debug=false); + virtual Error run(int p_device,int p_flags=0); virtual bool requieres_password(bool p_debug) const { return !p_debug; } virtual String get_binary_extension() const { return "apk"; } - virtual Error export_project(const String& p_path, bool p_debug, bool p_dumb=false, bool p_remote_debug=false); + virtual Error export_project(const String& p_path, bool p_debug, int p_flags=0); virtual bool can_export(String *r_error=NULL) const; @@ -1014,7 +1014,7 @@ Error EditorExportPlatformAndroid::save_apk_file(void *p_userdata,const String& -Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_debug, bool p_dumb,bool p_remote_debug) { +Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_debug, int p_flags) { String src_apk; @@ -1078,7 +1078,7 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d if (file=="AndroidManifest.xml") { - _fix_manifest(data,p_dumb || p_remote_debug); + _fix_manifest(data,p_flags&(EXPORT_DUMB_CLIENT|EXPORT_REMOTE_DEBUG)); } if (file=="resources.arsc") { @@ -1156,9 +1156,9 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d } } - gen_export_flags(cl,p_dumb,p_remote_debug); + gen_export_flags(cl,p_flags); - if (p_dumb) { + if (p_flags) { /*String host = EditorSettings::get_singleton()->get("file_server/host"); int port = EditorSettings::get_singleton()->get("file_server/post"); @@ -1485,7 +1485,7 @@ void EditorExportPlatformAndroid::_device_poll_thread(void *ud) { } -Error EditorExportPlatformAndroid::run(int p_device, bool p_dumb, bool p_remote_debug) { +Error EditorExportPlatformAndroid::run(int p_device, int p_flags) { ERR_FAIL_INDEX_V(p_device,devices.size(),ERR_INVALID_PARAMETER); device_lock->lock(); @@ -1504,7 +1504,7 @@ Error EditorExportPlatformAndroid::run(int p_device, bool p_dumb, bool p_remote_ ep.step("Exporting APK",0); String export_to=EditorSettings::get_singleton()->get_settings_path()+"/tmp/tmpexport.apk"; - Error err = export_project(export_to,true,p_dumb,p_remote_debug); + Error err = export_project(export_to,true,p_flags); if (err) { device_lock->unlock(); return err; diff --git a/platform/bb10/export/export.cpp b/platform/bb10/export/export.cpp index 44fef621c..434aaff41 100644 --- a/platform/bb10/export/export.cpp +++ b/platform/bb10/export/export.cpp @@ -67,11 +67,11 @@ public: virtual int get_device_count() const; virtual String get_device_name(int p_device) const; virtual String get_device_info(int p_device) const; - virtual Error run(int p_device,bool p_dumb=false,bool p_remote_debug=false); + virtual Error run(int p_device,int p_flags=0); virtual bool requieres_password(bool p_debug) const { return !p_debug; } virtual String get_binary_extension() const { return "bar"; } - virtual Error export_project(const String& p_path,bool p_debug,bool p_dumb=false,bool p_remote_debug=false); + virtual Error export_project(const String& p_path,bool p_debug,int p_flags=0); virtual bool can_export(String *r_error=NULL) const; @@ -270,7 +270,7 @@ void EditorExportPlatformBB10::_fix_descriptor(Vector<uint8_t>& p_descriptor) { -Error EditorExportPlatformBB10::export_project(const String& p_path, bool p_debug, bool p_dumb, bool p_remote_debug) { +Error EditorExportPlatformBB10::export_project(const String& p_path, bool p_debug, int p_flags) { EditorProgress ep("export","Exporting for BlackBerry 10",104); @@ -619,7 +619,7 @@ void EditorExportPlatformBB10::_device_poll_thread(void *ud) { } -Error EditorExportPlatformBB10::run(int p_device, bool p_dumb, bool p_remote_debug) { +Error EditorExportPlatformBB10::run(int p_device, int p_flags) { ERR_FAIL_INDEX_V(p_device,devices.size(),ERR_INVALID_PARAMETER); @@ -643,7 +643,7 @@ Error EditorExportPlatformBB10::run(int p_device, bool p_dumb, bool p_remote_deb ep.step("Exporting APK",0); String export_to=EditorSettings::get_singleton()->get_settings_path().plus_file("/tmp/tmpexport.bar"); - Error err = export_project(export_to,true); + Error err = export_project(export_to,true,p_flags); if (err) { device_lock->unlock(); return err; diff --git a/platform/iphone/gl_view.mm b/platform/iphone/gl_view.mm index 3309fd082..4d5d1b81e 100755 --- a/platform/iphone/gl_view.mm +++ b/platform/iphone/gl_view.mm @@ -345,6 +345,8 @@ static void clear_touches() { [self destroyFramebuffer]; [self createFramebuffer]; [self drawView]; + [self drawView]; + } - (BOOL)createFramebuffer diff --git a/platform/javascript/SCsub b/platform/javascript/SCsub index ac17f68aa..cd96cf4f3 100644 --- a/platform/javascript/SCsub +++ b/platform/javascript/SCsub @@ -17,7 +17,7 @@ javascript_objects=[] for x in javascript_files: javascript_objects.append( env_javascript.Object( x ) ) -env.Append(LINKFLAGS=["-s","EXPORTED_FUNCTIONS=\"['_main','_audio_server_mix_function']\""]) +env.Append(LINKFLAGS=["-s","EXPORTED_FUNCTIONS=\"['_main','_audio_server_mix_function','_main_after_fs_sync']\""]) prog = None diff --git a/platform/javascript/audio_server_javascript.cpp b/platform/javascript/audio_server_javascript.cpp index 8fa76d5ae..fd505b8a8 100644 --- a/platform/javascript/audio_server_javascript.cpp +++ b/platform/javascript/audio_server_javascript.cpp @@ -626,11 +626,14 @@ void AudioServerJavascript::finish(){ } void AudioServerJavascript::update(){ - for(List<Stream*>::Element *E=active_audio_streams.front();E;E=E->next()) { + for(List<Stream*>::Element *E=active_audio_streams.front();E;) { //stream might be removed durnig this callback + + List<Stream*>::Element *N=E->next(); - if (E->get()->audio_stream ) { + if (E->get()->audio_stream) E->get()->audio_stream->update(); - } + + E=N; } } @@ -653,7 +656,7 @@ int AudioServerJavascript::get_default_mix_rate() const{ void AudioServerJavascript::set_stream_global_volume_scale(float p_volume){ - + stream_volume_scale=p_volume; } void AudioServerJavascript::set_fx_global_volume_scale(float p_volume){ diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp index c38035e64..9e2595f4a 100644 --- a/platform/javascript/export/export.cpp +++ b/platform/javascript/export/export.cpp @@ -77,11 +77,11 @@ public: virtual int get_device_count() const { return show_run?1:0; }; virtual String get_device_name(int p_device) const { return "Run in Browser"; } virtual String get_device_info(int p_device) const { return "Run exported HTML in the system's default browser."; } - virtual Error run(int p_device,bool p_dumb=false,bool p_remote_debug=false); + virtual Error run(int p_device,int p_flags=0); virtual bool requieres_password(bool p_debug) const { return false; } virtual String get_binary_extension() const { return "html"; } - virtual Error export_project(const String& p_path,bool p_debug,bool p_dumb=false,bool p_remote_debug=false); + virtual Error export_project(const String& p_path,bool p_debug,int p_flags=0); virtual bool can_export(String *r_error=NULL) const; @@ -198,7 +198,7 @@ struct JSExportData { -Error EditorExportPlatformJavaScript::export_project(const String& p_path, bool p_debug, bool p_dumb, bool p_remote_debug) { +Error EditorExportPlatformJavaScript::export_project(const String& p_path, bool p_debug, int p_flags) { String src_template; @@ -309,10 +309,10 @@ Error EditorExportPlatformJavaScript::export_project(const String& p_path, bool } -Error EditorExportPlatformJavaScript::run(int p_device, bool p_dumb, bool p_remote_debug) { +Error EditorExportPlatformJavaScript::run(int p_device, int p_flags) { String path = EditorSettings::get_singleton()->get_settings_path()+"/tmp/tmp_export.html"; - Error err = export_project(path,true,""); + Error err = export_project(path,true,p_flags); if (err) return err; diff --git a/platform/javascript/javascript_main.cpp b/platform/javascript/javascript_main.cpp index 9aade8c44..fb87dc848 100644 --- a/platform/javascript/javascript_main.cpp +++ b/platform/javascript/javascript_main.cpp @@ -31,7 +31,8 @@ #include "main/main.h" #include "io/resource_loader.h" #include "os/keyboard.h" - +#include "emscripten.h" +#include <string.h> OS_JavaScript *os=NULL; @@ -198,15 +199,39 @@ static void _gfx_idle() { glutPostRedisplay(); } +int start_step=0; + static void _godot_draw(void) { - os->main_loop_iterate(); + if (start_step==1) { + start_step=2; + Main::start(); + os->main_loop_begin(); + } + + if (start_step==2) { + os->main_loop_iterate(); + } + glutSwapBuffers(); } + + +extern "C" { + +void main_after_fs_sync(int value) { + + start_step=1; + printf("FS SYNCHED!\n"); +} + +} + int main(int argc, char *argv[]) { - /* Initialize the window */ + + /* Initialize the window */ printf("let it go!\n"); glutInit(&argc, argv); os = new OS_JavaScript(_gfx_init,NULL,NULL,NULL,NULL); @@ -220,7 +245,7 @@ int main(int argc, char *argv[]) { #endif ResourceLoader::set_abort_on_missing_resources(false); //ease up compatibility - Main::start(); + glutSpecialUpFunc(_glut_skey_up); glutSpecialFunc(_glut_skey_down); @@ -238,10 +263,32 @@ int main(int argc, char *argv[]) { // glutReshapeFunc(gears_reshape); glutDisplayFunc(_godot_draw); //glutSpecialFunc(gears_special); - os->main_loop_begin(); + + + + //mount persistent filesystem + EM_ASM( + FS.mkdir('/userfs'); + FS.mount(IDBFS, {}, '/userfs'); + + + + // sync from persisted state into memory and then + // run the 'test' function + FS.syncfs(true, function (err) { + assert(!err); + console.log("done syncinc!"); + _after_sync_cb = Module.cwrap('main_after_fs_sync', 'void',['number']); + _after_sync_cb(0); + + }); + + ); glutMainLoop(); + + return 0; } diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index e18d5d949..ae97bf990 100644 --- a/platform/javascript/os_javascript.cpp +++ b/platform/javascript/os_javascript.cpp @@ -37,6 +37,7 @@ #include "main/main.h" #include "core/globals.h" +#include "emscripten.h" int OS_JavaScript::get_video_driver_count() const { @@ -270,6 +271,32 @@ bool OS_JavaScript::main_loop_iterate() { if (!main_loop) return false; + + if (time_to_save_sync>=0) { + int64_t newtime = get_ticks_msec(); + int64_t elapsed = newtime - last_sync_time; + last_sync_time=newtime; + + time_to_save_sync-=elapsed; + + print_line("elapsed "+itos(elapsed)+" tts "+itos(time_to_save_sync)); + + if (time_to_save_sync<0) { + //time to sync, for real + // run 'success' + print_line("DOING SYNCH!"); + EM_ASM( + FS.syncfs(function (err) { + assert(!err); + console.log("Synched!"); + //ccall('success', 'v'); + }); + ); + } + + + } + return Main::iteration(); } @@ -562,14 +589,21 @@ String OS_JavaScript::get_locale() const { String OS_JavaScript::get_data_dir() const { - if (get_data_dir_func) - return get_data_dir_func(); - return "/"; + //if (get_data_dir_func) + // return get_data_dir_func(); + return "/userfs"; //return Globals::get_singleton()->get_singleton_object("GodotOS")->call("get_data_dir"); }; +void OS_JavaScript::_close_notification_funcs(const String& p_file,int p_flags) { + print_line("close "+p_file+" flags "+itos(p_flags)); + if (p_file.begins_with("/userfs") && p_flags&FileAccess::WRITE) { + static_cast<OS_JavaScript*>(get_singleton())->last_sync_time=OS::get_singleton()->get_ticks_msec(); + static_cast<OS_JavaScript*>(get_singleton())->time_to_save_sync=5000; //five seconds since last save + } +} OS_JavaScript::OS_JavaScript(GFXInitFunc p_gfx_init_func,void*p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetDataDirFunc p_get_data_dir_func,GetLocaleFunc p_get_locale_func) { @@ -589,6 +623,9 @@ OS_JavaScript::OS_JavaScript(GFXInitFunc p_gfx_init_func,void*p_gfx_init_ud, Ope open_uri_func=p_open_uri_func; get_data_dir_func=p_get_data_dir_func; get_locale_func=p_get_locale_func; + FileAccessUnix::close_notification_func=_close_notification_funcs; + + time_to_save_sync=-1; } diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h index 5f671d45c..1e925fb8d 100644 --- a/platform/javascript/os_javascript.h +++ b/platform/javascript/os_javascript.h @@ -66,6 +66,9 @@ private: bool use_gl2; + int64_t time_to_save_sync; + int64_t last_sync_time; + Rasterizer *rasterizer; VisualServer *visual_server; AudioServerJavascript *audio_server; @@ -85,6 +88,8 @@ private: GetDataDirFunc get_data_dir_func; GetLocaleFunc get_locale_func; + static void _close_notification_funcs(const String& p_file,int p_flags); + public: // functions used by main to initialize/deintialize the OS @@ -107,7 +112,7 @@ public: typedef int64_t ProcessID; - static OS* get_singleton(); + //static OS* get_singleton(); virtual void vprint(const char* p_format, va_list p_list, bool p_stderr=false); virtual void print(const char *p_format, ... ); diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp index 823bc46d7..79ee91bc6 100644 --- a/platform/osx/export/export.cpp +++ b/platform/osx/export/export.cpp @@ -57,11 +57,11 @@ public: virtual int get_device_count() const { return 0; }; virtual String get_device_name(int p_device) const { return String(); } virtual String get_device_info(int p_device) const { return String(); } - virtual Error run(int p_device,bool p_dumb=false,bool p_remote_debug=false); + virtual Error run(int p_device,int p_flags=0); virtual bool requieres_password(bool p_debug) const { return false; } virtual String get_binary_extension() const { return "zip"; } - virtual Error export_project(const String& p_path,bool p_debug,bool p_dumb=false,bool p_remote_debug=false); + virtual Error export_project(const String& p_path,bool p_debug,int p_flags=0); virtual bool can_export(String *r_error=NULL) const; @@ -245,7 +245,7 @@ void EditorExportPlatformOSX::_fix_plist(Vector<uint8_t>& plist,const String& p_ } } -Error EditorExportPlatformOSX::export_project(const String& p_path, bool p_debug, bool p_dumb, bool p_remote_debug) { +Error EditorExportPlatformOSX::export_project(const String& p_path, bool p_debug, int p_flags) { String src_pkg; @@ -437,7 +437,7 @@ Error EditorExportPlatformOSX::export_project(const String& p_path, bool p_debug } -Error EditorExportPlatformOSX::run(int p_device, bool p_dumb, bool p_remote_debug) { +Error EditorExportPlatformOSX::run(int p_device, int p_flags) { return OK; } diff --git a/platform/x11/detect.py b/platform/x11/detect.py index b8890a3a2..33e8fd03e 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -131,8 +131,17 @@ def configure(env): env.ParseConfig('pkg-config openssl --cflags --libs') - env.ParseConfig('pkg-config freetype2 --cflags --libs') - env.Append(CCFLAGS=['-DFREETYPE_ENABLED']) + if (env["freetype"]=="yes"): + 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']) diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 482e4d715..fe15dd5a0 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -1880,6 +1880,16 @@ void OS_X11::swap_buffers() { context_gl->swap_buffers(); } +void OS_X11::alert(const String& p_alert,const String& p_title) { + + List<String> args; + args.push_back("-center"); + args.push_back("-title"); + args.push_back(p_title); + args.push_back(p_alert); + + execute("/usr/bin/xmessage",args,true); +} void OS_X11::set_icon(const Image& p_icon) { if (!p_icon.empty()) { diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h index 95857c034..1566062b9 100644 --- a/platform/x11/os_x11.h +++ b/platform/x11/os_x11.h @@ -244,7 +244,7 @@ public: virtual bool is_window_maximized() const; virtual void move_window_to_foreground(); - + virtual void alert(const String& p_alert,const String& p_title="ALERT!"); void run(); OS_X11(); |
