HTML5 exporter seems to be fully functional

-user:// filesystem implemented
-default template page could look prettier, help appreciated
This commit is contained in:
Juan Linietsky 2015-09-12 10:54:47 -03:00
parent 56c907ad04
commit a88f67821c
6 changed files with 113 additions and 13 deletions

View file

@ -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();
}
int main(int argc, char *argv[]) {
/* Initialize the window */
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 */
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;
}