From f95382630f96b95c28d39cb094accd4677d8bce4 Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Mon, 22 Aug 2022 21:07:17 -0500 Subject: [PATCH] Include buildtemplate building for the web using a custom file. Co-authored-by: sigonasr2 --- C++/scripts/md5 | 2 +- C++/scripts/web.sh | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/C++/scripts/md5 b/C++/scripts/md5 index 9403698..3e77b3f 100644 --- a/C++/scripts/md5 +++ b/C++/scripts/md5 @@ -1,3 +1,3 @@ build.sh:530634457ea9041267c05d4ced95eee1 - commit.sh:d03a46e721060c22ccb146e19d27e70a - -web.sh:3fdcf079bbabf079cc24c32fa7133c40 - +web.sh:241ce74055952325f82f009b494df250 - diff --git a/C++/scripts/web.sh b/C++/scripts/web.sh index d00e5ca..eef8c5b 100755 --- a/C++/scripts/web.sh +++ b/C++/scripts/web.sh @@ -6,4 +6,12 @@ else em++ -std=c++17 -O2 -s ALLOW_MEMORY_GROWTH=1 -s MAX_WEBGL_VERSION=2 -s MIN_WEBGL_VERSION=2 -s USE_LIBPNG=1 $(find . -type f -name "*.cpp") -o ${PROJECT_NAME}.html -I pixelGameEngine.h fi -emrun ${PROJECT_NAME}.html +cp buildtemplate.html ${PROJECT_NAME}.html +sed -i "s/_REPLACEME_/$PROJECT_NAME.js/" ${PROJECT_NAME}.html + +if [ "$1" == "headless" ]; then + echo "Running as headless web server" + emrun --no_browser ${PROJECT_NAME}.html +else + emrun --serve_after_close ${PROJECT_NAME}.html +fi