From d871c22f25aa5386c17dbff8e079304b26d24267 Mon Sep 17 00:00:00 2001 From: Taylor Richards Date: Thu, 15 Feb 2018 19:35:47 -0500 Subject: [PATCH] initial loading/progress screen for emscripten --- CMakeLists.txt | 2 +- dist/{fs_shell.html => fs2demo_shell.html} | 60 ++++++++- dist/fsdemo_shell.html | 139 +++++++++++++++++++++ src/freespace2/freespace.cpp | 5 + 4 files changed, 203 insertions(+), 3 deletions(-) rename dist/{fs_shell.html => fs2demo_shell.html} (63%) create mode 100644 dist/fsdemo_shell.html diff --git a/CMakeLists.txt b/CMakeLists.txt index cf7608b..64414e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -234,7 +234,7 @@ if(EMSCRIPTEN) "-s FULL_ES2=1" # "-s WASM=1" "-s TOTAL_MEMORY=184549376" - "--shell-file ${CMAKE_SOURCE_DIR}/dist/fs_shell.html" + "--shell-file ${CMAKE_SOURCE_DIR}/dist/${FS_BINARY}_shell.html" "--preload-file game@/" "-s SAFE_HEAP=1" "-s DEMANGLE_SUPPORT=1" diff --git a/dist/fs_shell.html b/dist/fs2demo_shell.html similarity index 63% rename from dist/fs_shell.html rename to dist/fs2demo_shell.html index 768629e..729cdb8 100644 --- a/dist/fs_shell.html +++ b/dist/fs2demo_shell.html @@ -4,15 +4,51 @@ - FreeSpace + FreeSpace 2 Demo +
+
+
+
+
+
+ {{{ SCRIPT }}} + + diff --git a/src/freespace2/freespace.cpp b/src/freespace2/freespace.cpp index e0fafb8..2fa5030 100644 --- a/src/freespace2/freespace.cpp +++ b/src/freespace2/freespace.cpp @@ -6861,6 +6861,11 @@ int game_main(const char *szCmdLine) } #ifdef __EMSCRIPTEN__ + EM_ASM({ + var progress = document.getElementById('progress'); + progress.hidden = true; + }); + emscripten_set_main_loop(game_loop_caller, 0, 1); #else while ( game_loop() ) { /* nothing */ } -- 2.39.2