From 0030275bc94107d015e9d1c380415f60bd436c8a Mon Sep 17 00:00:00 2001 From: doyle Date: Tue, 17 Oct 2023 12:29:57 +1100 Subject: [PATCH] fp: Make the website prettier, set the tab title --- External/tely | 2 +- build.bat | 1 + feely_pona.cpp | 2 +- feely_pona_build.cpp | 49 +++++++++----- feely_pona_emscripten_shell.html | 110 ++++++------------------------- feely_pona_unity_nodll.h | 3 +- 6 files changed, 55 insertions(+), 112 deletions(-) diff --git a/External/tely b/External/tely index 135fd17..20e5540 160000 --- a/External/tely +++ b/External/tely @@ -1 +1 @@ -Subproject commit 135fd1783947016e783c141102ff6cf635f45c9f +Subproject commit 20e554042aa9d7e2b734841746100984cc8626fe diff --git a/build.bat b/build.bat index a77ae9d..504d51e 100644 --- a/build.bat +++ b/build.bat @@ -7,6 +7,7 @@ set build_dir=%script_dir%\Build set code_dir=%script_dir% REM Bootstrap the build program +mkdir %build_dir% 2>nul pushd %build_dir% cl /nologo /Z7 /W4 %code_dir%\feely_pona_build.cpp || exit /B 1 copy feely_pona_build.exe %code_dir% 1>nul diff --git a/feely_pona.cpp b/feely_pona.cpp index fd143f7..7b4a1df 100644 --- a/feely_pona.cpp +++ b/feely_pona.cpp @@ -496,7 +496,7 @@ void TELY_DLL_Reload(void *user_data) { TELY_Platform *platform = DQN_CAST(TELY_Platform *)user_data; Dqn_Library_SetPointer(platform->core.dqn_lib); - + platform->func_set_window_title(DQN_STRING8("Terry Cherry")); } FP_DLL_FUNCTION diff --git a/feely_pona_build.cpp b/feely_pona_build.cpp index 53f6d4b..799de73 100644 --- a/feely_pona_build.cpp +++ b/feely_pona_build.cpp @@ -387,6 +387,22 @@ int main(int argc, char const **argv) uint64_t feely_pona_emscripten_timings[2] = {}; if (target_web) { Dqn_String8 const raylib_emscripten_lib_name = DQN_STRING8("raylib_emscripten.a"); + bool debug_build = false; + + Dqn_List build_specific_compile_flags = {}; + if (debug_build) { + build_specific_compile_flags = Dqn_List_InitCArrayCopy(scratch.arena, 32, { + DQN_STRING8("-s"), DQN_STRING8("ASSERTIONS=2"), + DQN_STRING8("-s"), DQN_STRING8("SAFE_HEAP=0"), + DQN_STRING8("-s"), DQN_STRING8("STACK_OVERFLOW_CHECK=2"), + DQN_STRING8("--profiling-funcs"), // Expose function names in stack trace + DQN_STRING8("-g"), // Debug symbols + }); + } else { + build_specific_compile_flags = Dqn_List_InitCArrayCopy(scratch.arena, 32, { + DQN_STRING8("-Os"), // Optimise for size + }); + } // NOTE: Compile each raylib file separately with emcc ===================================== { @@ -406,8 +422,7 @@ int main(int argc, char const **argv) build_file.input_file_path = base_file; build_file.output_file_path = Dqn_String8_InitF(scratch.allocator, "raylib_%.*s_emscripten.o", DQN_STRING_FMT(file_stem)); - raylib_emscripten_build_context.compile_files = Dqn_Slice_InitCArrayCopy(scratch.arena, {build_file}); - raylib_emscripten_build_context.compile_flags = Dqn_Slice_InitCArrayCopy(scratch.arena, { + Dqn_List compile_flags = Dqn_List_InitCArrayCopy(scratch.arena, 32, { DQN_STRING8("cmd"), DQN_STRING8("/C"), DQN_STRING8("emcc.bat"), @@ -417,6 +432,10 @@ int main(int argc, char const **argv) DQN_STRING8("-D PLATFORM_WEB"), DQN_STRING8("-D GRAPHICS_API_OPENGL_ES2"), }); + Dqn_List_AddList(&compile_flags, build_specific_compile_flags); + + raylib_emscripten_build_context.compile_files = Dqn_Slice_InitCArrayCopy(scratch.arena, {build_file}); + raylib_emscripten_build_context.compile_flags = Dqn_List_ToSliceCopy(&compile_flags, scratch.arena); raylib_emscripten_build_context.build_dir = build_dir; Dqn_List_Add(&raylib_emscripten_output_files, build_file.output_file_path); @@ -458,31 +477,25 @@ int main(int argc, char const **argv) Dqn_CPPBuildCompileFile{{}, Dqn_FsPath_ConvertF(scratch.arena, "%.*s/feely_pona_unity_nodll.cpp", DQN_STRING_FMT(code_dir)) }, }); - Dqn_String8 prefix = DQN_STRING8("Terry_Cherry"); - build_context.compile_flags = Dqn_Slice_InitCArrayCopy(scratch.arena, { + Dqn_String8 output_name = DQN_STRING8("Terry_Cherry"); + Dqn_List compile_flags = Dqn_List_InitCArrayCopy(scratch.arena, 32, { DQN_STRING8("cmd"), DQN_STRING8("/C"), DQN_STRING8("emcc.bat"), - DQN_STRING8("-o"), Dqn_String8_InitF(scratch.allocator, "%.*s.html", DQN_STRING_FMT(prefix)), - DQN_STRING8("-Os"), // Optimize for size + DQN_STRING8("-o"), Dqn_String8_InitF(scratch.allocator, "%.*s.html", DQN_STRING_FMT(output_name)), DQN_STRING8("-Wall"), DQN_STRING8("--shell-file"), Dqn_FsPath_ConvertF(scratch.arena, "%.*s/feely_pona_emscripten_shell.html", DQN_STRING_FMT(code_dir)), Dqn_FsPath_ConvertF(scratch.arena, "%.*s/%.*s", DQN_STRING_FMT(build_dir), DQN_STRING_FMT(raylib_emscripten_lib_name)), DQN_STRING8("-s"), DQN_STRING8("USE_GLFW=3"), - // DQN_STRING8("-s"), DQN_STRING8("ASSERTIONS=2"), - // DQN_STRING8("-s"), DQN_STRING8("SAFE_HEAP=0"), DQN_STRING8("-s"), DQN_STRING8("TOTAL_MEMORY=512MB"), DQN_STRING8("-s"), DQN_STRING8("TOTAL_STACK=32MB"), DQN_STRING8("-s"), DQN_STRING8("ALLOW_MEMORY_GROWTH"), - // DQN_STRING8("-s"), DQN_STRING8("STACK_OVERFLOW_CHECK=2"), - // DQN_STRING8("--profiling-funcs"), // Expose function names in stack trace - // DQN_STRING8("-g"), // Debug symbols - // NOTE: Must be relative path such that fopen("Data/...") works - // otherwise the VFS will encode the full absolute path to the - // assets DQN_STRING8("--preload-file"), DQN_STRING8("Data"), DQN_STRING8("-msimd128"), DQN_STRING8("-msse2"), }); - build_context.build_dir = build_dir; + Dqn_List_AddList(&compile_flags, build_specific_compile_flags); + + build_context.compile_flags = Dqn_List_ToSliceCopy(&compile_flags, scratch.arena); + build_context.build_dir = build_dir; if (dry_run) { Dqn_String8 cmd = Dqn_CPPBuild_ToCommandLine(build_context, Dqn_CPPBuildMode_AlwaysRebuild, scratch.allocator); @@ -492,7 +505,7 @@ int main(int argc, char const **argv) } // NOTE: Move the files to a directory - Dqn_String8 folder_path = Dqn_FsPath_ConvertF(scratch.arena, "%.*s/%.*s_Emscripten", DQN_STRING_FMT(build_dir), DQN_STRING_FMT(prefix)); + Dqn_String8 folder_path = Dqn_FsPath_ConvertF(scratch.arena, "%.*s/%.*s_Emscripten", DQN_STRING_FMT(build_dir), DQN_STRING_FMT(output_name)); if (!Dqn_Fs_DirExists(folder_path)) { Dqn_String8 mkdir_cmd = Dqn_String8_InitF(scratch.allocator, "mkdir %.*s", DQN_STRING_FMT(folder_path)); Dqn_OS_ExecOrAbort(mkdir_cmd, {}); @@ -506,8 +519,8 @@ int main(int argc, char const **argv) }; for (Dqn_String8 file_ext : generated_file_extension) { - Dqn_String8 src_path = Dqn_FsPath_ConvertF(scratch.arena, "%.*s/%.*s.%.*s", DQN_STRING_FMT(build_dir), DQN_STRING_FMT(prefix), DQN_STRING_FMT(file_ext)); - Dqn_String8 dest_path = Dqn_FsPath_ConvertF(scratch.arena, "%.*s/%.*s.%.*s", DQN_STRING_FMT(folder_path), DQN_STRING_FMT(prefix), DQN_STRING_FMT(file_ext)); + Dqn_String8 src_path = Dqn_FsPath_ConvertF(scratch.arena, "%.*s/%.*s.%.*s", DQN_STRING_FMT(build_dir), DQN_STRING_FMT(output_name), DQN_STRING_FMT(file_ext)); + Dqn_String8 dest_path = Dqn_FsPath_ConvertF(scratch.arena, "%.*s/%.*s.%.*s", DQN_STRING_FMT(folder_path), DQN_STRING_FMT(output_name), DQN_STRING_FMT(file_ext)); Dqn_String8 cmd = Dqn_String8_InitF(scratch.allocator, "cmd /C move /Y %.*s %.*s", DQN_STRING_FMT(src_path), DQN_STRING_FMT(dest_path)); if (dry_run) { Dqn_Print_StdLnF(Dqn_PrintStd_Out, "%.*s\n", DQN_STRING_FMT(cmd)); diff --git a/feely_pona_emscripten_shell.html b/feely_pona_emscripten_shell.html index b373394..50f1a62 100644 --- a/feely_pona_emscripten_shell.html +++ b/feely_pona_emscripten_shell.html @@ -4,87 +4,43 @@ - raylib web game + Terry Cherry - - - + + - - - - - - - - - - - - - - - - - - -