diff --git a/CMakeLists.txt b/CMakeLists.txt index 1576f00..dbed26a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -169,7 +169,7 @@ if(WIN32 AND MSVC) # set working directory for Visual Studio Debugger set_target_properties( ${OutputExecutable} PROPERTIES - VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/bin" + VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" ) # set subsytem, console if HAS_TERMINAL is true. windows if not @@ -258,7 +258,22 @@ if (EMSCRIPTEN) -sUSE_LIBPNG=1 -sLLD_REPORT_UNDEFINED) endif() + + set_target_properties(${OutputExecutable} PROPERTIES LINK_FLAGS "--shell-file ${CMAKE_CURRENT_SOURCE_DIR}/emscripten_shell.html") + + add_custom_command( + TARGET ${OutputExecutable} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E remove -f ${CMAKE_BINARY_DIR}/bin/index.html + ) + add_custom_command( + TARGET ${OutputExecutable} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E rename ${CMAKE_BINARY_DIR}/bin/${OutputExecutable}.html ${CMAKE_BINARY_DIR}/bin/index.html + ) endif() # Emscripten ###################################################################### diff --git a/emscripten_shell.html b/emscripten_shell.html new file mode 100644 index 0000000..5c4ff2c --- /dev/null +++ b/emscripten_shell.html @@ -0,0 +1,148 @@ + + + + + + Hamster + + + + +
+ +
+ + + {{{ SCRIPT }}} + + + \ No newline at end of file diff --git a/src/olcPixelGameEngine.h b/src/olcPixelGameEngine.h index c7fbb7c..a32c239 100644 --- a/src/olcPixelGameEngine.h +++ b/src/olcPixelGameEngine.h @@ -6568,7 +6568,10 @@ namespace olc virtual olc::rcode SetWindowTitle(const std::string& s) override - { emscripten_set_window_title(s.c_str()); return olc::OK; } + { + // emscripten_set_window_title(s.c_str()); + return olc::OK; + } virtual olc::rcode StartSystemEventLoop() override { return olc::OK; }