From 0fb7b5aa0c023d60880d259e70f7641152460aa6 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Thu, 10 Sep 2015 00:10:54 -0300 Subject: HTML5 exporter Improvements -Better template handling -Voice support -Stream support --- platform/javascript/javascript_main.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'platform/javascript/javascript_main.cpp') diff --git a/platform/javascript/javascript_main.cpp b/platform/javascript/javascript_main.cpp index 5be6c5b647..9aade8c445 100644 --- a/platform/javascript/javascript_main.cpp +++ b/platform/javascript/javascript_main.cpp @@ -31,6 +31,8 @@ #include "main/main.h" #include "io/resource_loader.h" #include "os/keyboard.h" + + OS_JavaScript *os=NULL; static void _gfx_init(void *ud,bool gl2,int w, int h,bool fs) { -- cgit v1.2.3 From a88f67821ca828d9b4d3453b19de60e27ab24efc Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sat, 12 Sep 2015 10:54:47 -0300 Subject: HTML5 exporter seems to be fully functional -user:// filesystem implemented -default template page could look prettier, help appreciated --- platform/javascript/javascript_main.cpp | 57 ++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 5 deletions(-) (limited to 'platform/javascript/javascript_main.cpp') diff --git a/platform/javascript/javascript_main.cpp b/platform/javascript/javascript_main.cpp index 9aade8c445..fb87dc848e 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 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; } -- cgit v1.2.3