From 3df3e8e027a95478ff8d544548982148c138d93e Mon Sep 17 00:00:00 2001 From: Phillip Trudeau-Tavara Date: Wed, 23 Aug 2023 03:30:29 -0400 Subject: [PATCH 01/13] Add automated blender_export.bat script --- blender_export.bat | 33 +++++++++++++++++++++++++++++++++ build_desktop_debug.bat | 12 +++++++++++- build_web_debug.bat | 4 +++- build_web_release.bat | 5 ++++- 4 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 blender_export.bat diff --git a/blender_export.bat b/blender_export.bat new file mode 100644 index 0000000..0f6548d --- /dev/null +++ b/blender_export.bat @@ -0,0 +1,33 @@ +@echo off + +pushd %~dp0%\art + +if not exist "art.blend" ( + powershell Expand-Archive -Path art.zip -DestinationPath . || goto :error +) + +set "blender=" +if exist "%ProgramFiles%\Blender Foundation\Blender 3.5\blender.exe" ( + echo Using Blender 3.5 detected + set "blender=%ProgramFiles%\Blender Foundation\Blender 3.5\blender.exe" +) +if exist "%ProgramFiles%\Blender Foundation\Blender 3.6\blender.exe" ( + echo Using Blender 3.6 detected + set "blender=%ProgramFiles%\Blender Foundation\Blender 3.6\blender.exe" +) + +if "%blender%" neq "" ( + call "%blender%" --background art.blend --python Exporter.py || goto :error +) else ( + goto :error +) + +goto :success + +:error +echo Blender export failed + +:success +set "returncode=%ERRORLEVEL%" +popd +exit /B %returncode% diff --git a/build_desktop_debug.bat b/build_desktop_debug.bat index f5e8bda..6cda265 100644 --- a/build_desktop_debug.bat +++ b/build_desktop_debug.bat @@ -2,8 +2,18 @@ @REM https://learn.microsoft.com/en-us/cpp/build/reference/compiler-options-listed-by-category?view=msvc-170 +setlocal enableDelayedExpansion + +set "should_do_blender_export=0" +set "should_do_codegen=0" +for %%A in (%*) do ( + if "%%~A"=="blender_export" ( set "should_do_blender_export=1" ) + if "%%~A"=="codegen" ( set "should_do_codegen=1" ) +) + +if "%should_do_blender_export%"=="1" ( call blender_export.bat || goto :error ) +if "%should_do_codegen%"=="1" ( call run_codegen.bat || goto :error ) -if "%1" == "codegen" ( call run_codegen.bat || goto :error ) else ( echo NOT RUNNING CODEGEN ) @REM start /B zig cc -DDEVTOOLS -Igen -Ithirdparty -lDbghelp -lGdi32 -lD3D11 -lOle32 -lwinhttp -gfull -gcodeview -o main_zig.exe main.c cl /diagnostics:caret /DDEVTOOLS /Igen /Ithirdparty /Wall /FC /Zi /WX Dbghelp.lib winhttp.lib main.c || goto :error diff --git a/build_web_debug.bat b/build_web_debug.bat index 0de78bf..3dca7e2 100644 --- a/build_web_debug.bat +++ b/build_web_debug.bat @@ -29,6 +29,8 @@ goto :success :error echo Failed to build + :success +set "returncode=%ERRORLEVEL%" popd -exit /B %ERRORLEVEL% +exit /B %returncode% diff --git a/build_web_release.bat b/build_web_release.bat index 301ac74..57ff6bf 100644 --- a/build_web_release.bat +++ b/build_web_release.bat @@ -5,6 +5,7 @@ pushd %~dp0% rmdir /S /q build_web_release mkdir build_web_release +call blender_export.bat || goto :error call run_codegen.bat || goto :error set FLAGS=-O0 -DNDEBUG @@ -16,6 +17,8 @@ goto :success :error echo Failed to build + :success +set "returncode=%ERRORLEVEL%" popd -exit /B %ERRORLEVEL% +exit /B %returncode% From 4ee067be9c78e2cf82c21a0e341ccf50672f0a2d Mon Sep 17 00:00:00 2001 From: Phillip Trudeau-Tavara Date: Wed, 23 Aug 2023 03:32:21 -0400 Subject: [PATCH 02/13] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 07ce7d3..9076aa6 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# rpgpt -RPG GPT. Short experience +# [Dante's Cowboy - Wishlist now on Steam!](https://github.com/pmttavara/ph2/releases/download/latest/ph2ed_proto.zip) +A fantasy western RPG with an immersive and natural dynamic dialogue system powered by GPT. ![Western Frontier](https://upload.wikimedia.org/wikipedia/commons/thumb/3/32/Distribution_of_US_Rural_Population_during_1900.pdf/page1-1280px-Distribution_of_US_Rural_Population_during_1900.pdf.jpg) # Important Building Steps and Contribution Notes -Every time you checkin/clone the project, you have to unzip art.blend... If this is annoying to you, make a git hook +Every time you checkin/clone the project, make sure to call `blender_export.bat` at least once! This will auto-extract `art\art.blend` and run `art\Exporter.py`, thereby baking, validating, and exporting all the assets and the level. When editing Exporter.py in either the blender editor, or in a text editor in the repo, you have to continually make sure blender's internal version of the script doesn't go out of date with the actual script on disk, by either saving consistently from blender to disk if you're editing from blender, or by reloading from disk in the blend file before each commit. From 718a89a3affb6b9e1737cb029952639c5c5c2160 Mon Sep 17 00:00:00 2001 From: Phillip Trudeau-Tavara Date: Wed, 23 Aug 2023 03:33:59 -0400 Subject: [PATCH 03/13] Oops teehee --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9076aa6..e3933f9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# [Dante's Cowboy - Wishlist now on Steam!](https://github.com/pmttavara/ph2/releases/download/latest/ph2ed_proto.zip) +# [Dante's Cowboy - Wishlist now on Steam!](https://store.steampowered.com/app/2501370/Dantes_Cowboy) A fantasy western RPG with an immersive and natural dynamic dialogue system powered by GPT. ![Western Frontier](https://upload.wikimedia.org/wikipedia/commons/thumb/3/32/Distribution_of_US_Rural_Population_during_1900.pdf/page1-1280px-Distribution_of_US_Rural_Population_during_1900.pdf.jpg) From d5cf3d9f905d7b05a25569f87f881dfbfcff9dea Mon Sep 17 00:00:00 2001 From: Phillip Trudeau-Tavara Date: Wed, 23 Aug 2023 04:25:00 -0400 Subject: [PATCH 04/13] Disable glGetError() and keep validation and asserts --- build_web_debug.bat | 11 ----------- main.c | 9 +++++++++ 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/build_web_debug.bat b/build_web_debug.bat index 3dca7e2..967701e 100644 --- a/build_web_debug.bat +++ b/build_web_debug.bat @@ -10,21 +10,10 @@ set FLAGS=-O0 -g -DDEVTOOLS set OUTPUT_FOLDER=build_web -if "%1" == "NO_VALIDATION" ( - echo Disabling graphics validation... - set FLAGS=%FLAGS% -DNDEBUG -) - call build_web_common.bat || goto :error @echo off -if "%1" == "NO_VALIDATION" ( - echo Validation turned off -) else ( - echo If you want to turn graphics validation off to make web debug build faster, provide a command line argument called "NO_VALIDATION" to this build script -) - goto :success :error diff --git a/main.c b/main.c index 34706c4..d6f8f2b 100644 --- a/main.c +++ b/main.c @@ -60,6 +60,15 @@ __declspec(dllexport) uint32_t AmdPowerXpressRequestHighPerformance = 0x00000001 #include "sokol_app.h" #pragma warning(push) #pragma warning(disable : 4191) // unsafe function calling +#ifdef WEB +# ifndef GL_EXT_PROTOTYPES +# define GL_GLEXT_PROTOTYPES +# endif +# include +# include +# undef glGetError +# define glGetError() (GL_NO_ERROR) +#endif #include "sokol_gfx.h" #pragma warning(pop) #include "sokol_time.h" From 68cdbaac08da1ec0e6a1d4a33cf34c62c95cfaea Mon Sep 17 00:00:00 2001 From: Phillip Trudeau-Tavara Date: Wed, 23 Aug 2023 05:27:07 -0400 Subject: [PATCH 05/13] Greatly improve & simplify assertions --- main.c | 3 --- utility.h | 33 +++++++-------------------------- 2 files changed, 7 insertions(+), 29 deletions(-) diff --git a/main.c b/main.c index d6f8f2b..7fb3802 100644 --- a/main.c +++ b/main.c @@ -53,9 +53,6 @@ __declspec(dllexport) uint32_t AmdPowerXpressRequestHighPerformance = 0x00000001 #endif -#define STRINGIZE(x) STRINGIZE2(x) -#define STRINGIZE2(x) #x - #include "buff.h" #include "sokol_app.h" #pragma warning(push) diff --git a/utility.h b/utility.h index dc00fab..8f76ffb 100644 --- a/utility.h +++ b/utility.h @@ -1,43 +1,24 @@ #pragma once #include -#include -#ifdef WEB -#include -#define game_debugbreak() raise(SIGTRAP) - -#define game_assert_4127_push -#define game_assert_4127_pop +#define STRINGIZE(x) STRINGIZE2(x) +#define STRINGIZE2(x) #x +#ifdef WEB +#define assert_impl(cond, str) ((cond) || (EM_ASM({ assert(0, UTF8ToString($0) + UTF8ToString($1)); }, (__func__), (str)), 0)) #elif defined(DESKTOP) -#define game_debugbreak() __debugbreak() - -#define game_assert_4127_push __pragma(warning(push)) __pragma(warning(disable:4127)) -#define game_assert_4127_pop __pragma(warning(pop)) - +#define assert_impl(cond, str) ((cond) || (fputs("Assertion failed: " __FUNCTION__ str "\n", stderr), __debugbreak(), 0)) #else #error "Don't know how to assert for current platform configuration" -#define game_debugbreak() (void)(0) #endif -static void assert_impl(const char *func, const char *file, long line, const char *expression) -{ - fprintf(stderr, "Assert fail in %s(%s:%ld):\n \"%s\"\n", func, file, line, expression); -} - #ifdef NDEBUG -#define game_assert(cond) game_assert_4127_push do { (void)0; } while (0) game_assert_4127_pop +#define game_assert(cond) ((void)0) #else -#define game_assert(cond) game_assert_4127_push do { \ - if (!(cond)) { \ - assert_impl(__func__, __FILE__, __LINE__, #cond); \ - game_debugbreak(); \ - } \ -} while (0) game_assert_4127_pop +#define game_assert(cond) assert_impl(cond, "(" __FILE__ ":" STRINGIZE(__LINE__) "): \"" #cond "\"") #endif - #ifdef assert #undef assert #endif From 92fc09d2d64c034320dd698c535e4f75b2a03a8a Mon Sep 17 00:00:00 2001 From: Phillip Trudeau-Tavara Date: Wed, 23 Aug 2023 05:46:28 -0400 Subject: [PATCH 06/13] Set sample count to 1 on web and 4 on desktop --- main.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/main.c b/main.c index 7fb3802..08e8d5a 100644 --- a/main.c +++ b/main.c @@ -21,11 +21,13 @@ #define DESKTOP #define WINDOWS #define SOKOL_GLCORE33 +#define SAMPLE_COUNT 4 #endif #if defined(__EMSCRIPTEN__) #define WEB #define SOKOL_GLES2 +#define SAMPLE_COUNT 1 // bumping this back to 4 is troublesome for web, because there's a mismatch in sample counts. Perhaps we must upgrade to gles3, in doing so, we should upgrade to the newest sokol gfx. #endif #define DRWAV_ASSERT game_assert @@ -2708,7 +2710,7 @@ void create_screenspace_gfx_state() .depth = { 0 }, - .sample_count = 1, + .sample_count = SAMPLE_COUNT, .layout = { .attrs = { @@ -2738,7 +2740,7 @@ void create_screenspace_gfx_state() .depth = { .pixel_format = SG_PIXELFORMAT_NONE, }, - .sample_count = 1, + .sample_count = SAMPLE_COUNT, .layout = { .attrs = { @@ -2770,7 +2772,7 @@ void create_screenspace_gfx_state() .wrap_u = SG_WRAP_CLAMP_TO_BORDER, .wrap_v = SG_WRAP_CLAMP_TO_BORDER, .border_color = SG_BORDERCOLOR_OPAQUE_WHITE, - .sample_count = 1, + .sample_count = SAMPLE_COUNT, .label = "outline-pass-render-target", }; state.outline_pass_image = sg_make_image(&desc); @@ -2782,7 +2784,7 @@ void create_screenspace_gfx_state() .label = "outline-pass", }); - desc.sample_count = 1; + desc.sample_count = SAMPLE_COUNT; desc.label = "threedee-pass-render-target"; state.threedee_pass_image = sg_make_image(&desc); @@ -4843,7 +4845,7 @@ Shadow_State init_shadow_state() { .wrap_u = SG_WRAP_CLAMP_TO_BORDER, .wrap_v = SG_WRAP_CLAMP_TO_BORDER, .border_color = SG_BORDERCOLOR_OPAQUE_WHITE, - .sample_count = 1, + .sample_count = SAMPLE_COUNT, .label = "shadow-map-color-image" }; shadows.color_img = sg_make_image(&img_desc); @@ -4867,7 +4869,7 @@ Shadow_State init_shadow_state() { .shader = sg_make_shader(threedee_mesh_shadow_mapping_shader_desc(sg_query_backend())), // Cull front faces in the shadow map pass // .cull_mode = SG_CULLMODE_BACK, - .sample_count = 1, + .sample_count = SAMPLE_COUNT, .depth = { .pixel_format = SG_PIXELFORMAT_DEPTH, .compare = SG_COMPAREFUNC_LESS_EQUAL, @@ -7453,7 +7455,7 @@ sapp_desc sokol_main(int argc, char* argv[]) .frame_cb = frame, .cleanup_cb = cleanup, .event_cb = event, - .sample_count = 1, // bumping this back to 4 is troublesome for web, because there's a mismatch in sample counts. Perhaps we must upgrade to gles3, in doing so, we should upgrade to the newest sokol gfx. + .sample_count = SAMPLE_COUNT, .width = 800, .height = 600, //.gl_force_gles2 = true, not sure why this was here in example, look into From 6c0a832f61621741c6f62f9411498ae738ff029b Mon Sep 17 00:00:00 2001 From: Phillip Trudeau-Tavara Date: Wed, 23 Aug 2023 05:56:32 -0400 Subject: [PATCH 07/13] Link win32 libs in code; add /nologo /diagnostics:caret /noimplib /noexp --- build_desktop_debug.bat | 2 +- main.c | 12 ++++++++---- run_codegen.bat | 4 ++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/build_desktop_debug.bat b/build_desktop_debug.bat index 6cda265..87d4c60 100644 --- a/build_desktop_debug.bat +++ b/build_desktop_debug.bat @@ -15,7 +15,7 @@ if "%should_do_blender_export%"=="1" ( call blender_export.bat || goto :error ) if "%should_do_codegen%"=="1" ( call run_codegen.bat || goto :error ) @REM start /B zig cc -DDEVTOOLS -Igen -Ithirdparty -lDbghelp -lGdi32 -lD3D11 -lOle32 -lwinhttp -gfull -gcodeview -o main_zig.exe main.c -cl /diagnostics:caret /DDEVTOOLS /Igen /Ithirdparty /Wall /FC /Zi /WX Dbghelp.lib winhttp.lib main.c || goto :error +cl /nologo /diagnostics:caret /DDEVTOOLS /Igen /Ithirdparty /Wall /FC /Zi /WX main.c /link /noimplib /noexp || goto :error goto :EOF diff --git a/main.c b/main.c index 08e8d5a..55a742a 100644 --- a/main.c +++ b/main.c @@ -43,8 +43,6 @@ #pragma warning(push, 3) #include -#include -#include #include // https://developer.download.nvidia.com/devzone/devcenter/gamegraphics/files/OptimusRenderingPolicies.pdf @@ -474,6 +472,7 @@ LPCWSTR windows_string(MD_String8 s) #ifdef DESKTOP #ifdef WINDOWS #pragma warning(push, 3) +#pragma comment(lib, "WinHttp") #include #include #pragma warning(pop) @@ -3751,9 +3750,11 @@ typedef enum typedef BUFF(char, 200) StacktraceElem; typedef BUFF(StacktraceElem, 16) StacktraceInfo; +#if 0 // #ifdef WINDOWS +#include +#pragma comment(lib, "DbgHelp") StacktraceInfo get_stacktrace() { -#ifdef WINDOWS StacktraceInfo to_return = {0}; void *stack[ARRLEN(to_return.data)] = {0}; int captured = CaptureStackBackTrace(0, ARRLEN(to_return.data), stack, 0); @@ -3787,10 +3788,13 @@ StacktraceInfo get_stacktrace() free(symbol); } return to_return; +} #else +StacktraceInfo get_stacktrace() +{ return (StacktraceInfo){0}; -#endif } +#endif typedef struct DrawParams { diff --git a/run_codegen.bat b/run_codegen.bat index 5d638b7..0465f88 100644 --- a/run_codegen.bat +++ b/run_codegen.bat @@ -12,11 +12,11 @@ if exist gen\ ( thirdparty\sokol-shdc.exe --input threedee.glsl --output gen\threedee.glsl.h --slang glsl100:hlsl5:metal_macos:glsl330 || goto :error @REM metadesk codegen -cl /Ithirdparty /W3 /Zi /WX codegen.c || goto :error +cl /nologo /diagnostics:caret /Ithirdparty /W3 /Zi /WX codegen.c || goto :error @REM zig cc -Ithirdparty -gfull -gcodeview codegen.c -o codegen.exe || goto error codegen || goto :error -@REM cl /Ithirdparty /Igen /W3 /Zi /WX maketraining.c || goto :error +@REM cl /nologo /diagnostics:caret /Ithirdparty /Igen /W3 /Zi /WX maketraining.c || goto :error @REM maketraining || goto :error goto :EOF From c3511ba954e1b1388b20cca881ea664d543830fc Mon Sep 17 00:00:00 2001 From: Phillip Trudeau-Tavara Date: Wed, 23 Aug 2023 06:06:40 -0400 Subject: [PATCH 08/13] Accept command line arguments in build_web_common --- build_desktop_debug.bat | 14 ++++++-------- build_web_common.bat | 10 +++++++++- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/build_desktop_debug.bat b/build_desktop_debug.bat index 87d4c60..6cd2744 100644 --- a/build_desktop_debug.bat +++ b/build_desktop_debug.bat @@ -3,16 +3,14 @@ @REM https://learn.microsoft.com/en-us/cpp/build/reference/compiler-options-listed-by-category?view=msvc-170 setlocal enableDelayedExpansion - -set "should_do_blender_export=0" -set "should_do_codegen=0" +set "do_blender_export=0" +set "do_codegen=0" for %%A in (%*) do ( - if "%%~A"=="blender_export" ( set "should_do_blender_export=1" ) - if "%%~A"=="codegen" ( set "should_do_codegen=1" ) + if "%%~A"=="blender_export" ( set "do_blender_export=1" ) + if "%%~A"=="codegen" ( set "do_codegen=1" ) ) - -if "%should_do_blender_export%"=="1" ( call blender_export.bat || goto :error ) -if "%should_do_codegen%"=="1" ( call run_codegen.bat || goto :error ) +if "%do_blender_export%"=="1" ( call blender_export.bat || goto :error ) +if "%do_codegen%"=="1" ( call run_codegen.bat || goto :error ) @REM start /B zig cc -DDEVTOOLS -Igen -Ithirdparty -lDbghelp -lGdi32 -lD3D11 -lOle32 -lwinhttp -gfull -gcodeview -o main_zig.exe main.c cl /nologo /diagnostics:caret /DDEVTOOLS /Igen /Ithirdparty /Wall /FC /Zi /WX main.c /link /noimplib /noexp || goto :error diff --git a/build_web_common.bat b/build_web_common.bat index a1d6560..94b70dc 100644 --- a/build_web_common.bat +++ b/build_web_common.bat @@ -1,4 +1,12 @@ -call run_codegen.bat || goto :error +setlocal enableDelayedExpansion +set "do_blender_export=0" +set "do_codegen=0" +for %%A in (%*) do ( + if "%%~A"=="blender_export" ( set "do_blender_export=1" ) + if "%%~A"=="codegen" ( set "do_codegen=1" ) +) +if "%do_blender_export%"=="1" ( call blender_export.bat || goto :error ) +if "%do_codegen%"=="1" ( call run_codegen.bat || goto :error ) copy marketing_page\favicon.ico %OUTPUT_FOLDER%\favicon.ico @REM copy main.c %OUTPUT_FOLDER%\main.c || goto :error From 56187771ae0db2a48c5369a8efa273ef4f9ea61b Mon Sep 17 00:00:00 2001 From: Phillip Trudeau-Tavara Date: Wed, 23 Aug 2023 06:09:38 -0400 Subject: [PATCH 09/13] Passthrough command line arguments to subscripts --- build_and_run_remedy.bat | 2 +- build_web_debug.bat | 2 +- build_web_release.bat | 5 +---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/build_and_run_remedy.bat b/build_and_run_remedy.bat index 73a550c..1e22d04 100644 --- a/build_and_run_remedy.bat +++ b/build_and_run_remedy.bat @@ -1,5 +1,5 @@ @echo off START /B remedybg.exe stop-debugging -call build_desktop_debug.bat +call build_desktop_debug.bat %* remedybg.exe start-debugging diff --git a/build_web_debug.bat b/build_web_debug.bat index 967701e..776749f 100644 --- a/build_web_debug.bat +++ b/build_web_debug.bat @@ -10,7 +10,7 @@ set FLAGS=-O0 -g -DDEVTOOLS set OUTPUT_FOLDER=build_web -call build_web_common.bat || goto :error +call build_web_common.bat %* || goto :error @echo off diff --git a/build_web_release.bat b/build_web_release.bat index 57ff6bf..ac6de06 100644 --- a/build_web_release.bat +++ b/build_web_release.bat @@ -5,13 +5,10 @@ pushd %~dp0% rmdir /S /q build_web_release mkdir build_web_release -call blender_export.bat || goto :error -call run_codegen.bat || goto :error - set FLAGS=-O0 -DNDEBUG set OUTPUT_FOLDER=build_web_release -call build_web_common.bat || goto :error +call build_web_common.bat %* codegen || goto :error goto :success From bfae0a25bcec600bac6af05cdad47146dbf0f5d9 Mon Sep 17 00:00:00 2001 From: Phillip Trudeau-Tavara Date: Wed, 23 Aug 2023 06:09:42 -0400 Subject: [PATCH 10/13] Create build_and_run_web.bat --- build_and_run_web.bat | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 build_and_run_web.bat diff --git a/build_and_run_web.bat b/build_and_run_web.bat new file mode 100644 index 0000000..757af34 --- /dev/null +++ b/build_and_run_web.bat @@ -0,0 +1,7 @@ +@echo off + +call build_web_debug.bat %* || goto :EOF +START "" "http://localhost:8000" +pushd %~dp0%\build_web +python -m http.server +popd From 8650329b7f712c64286342acbc2d3f8233e247b2 Mon Sep 17 00:00:00 2001 From: Phillip Trudeau-Tavara Date: Wed, 23 Aug 2023 06:20:53 -0400 Subject: [PATCH 11/13] Reduce console printouts --- build_web_common.bat | 2 +- run_codegen.bat | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build_web_common.bat b/build_web_common.bat index 94b70dc..be59b2e 100644 --- a/build_web_common.bat +++ b/build_web_common.bat @@ -11,7 +11,7 @@ if "%do_codegen%"=="1" ( call run_codegen.bat || goto :error ) copy marketing_page\favicon.ico %OUTPUT_FOLDER%\favicon.ico @REM copy main.c %OUTPUT_FOLDER%\main.c || goto :error -@echo on +@echo off emcc ^ -sEXPORTED_FUNCTIONS=_main,_end_text_input,_stop_controlling_input,_start_controlling_input,_read_from_save_data,_dump_save_data,_is_receiving_text_input^ -sEXPORTED_RUNTIME_METHODS=ccall,cwrap^ diff --git a/run_codegen.bat b/run_codegen.bat index 0465f88..1d66612 100644 --- a/run_codegen.bat +++ b/run_codegen.bat @@ -1,9 +1,9 @@ -@echo on +@echo off -echo Running codegen... +@REM echo Running codegen... if exist gen\ ( - echo "Codegen folder already exists, not deleting because that messes with vscode intellisense..." + @REM echo "Codegen folder already exists, not deleting because that messes with vscode intellisense..." ) else ( mkdir gen ) From 526856a112ba52166f1ecbf90bf7d78835ebbdbd Mon Sep 17 00:00:00 2001 From: Phillip Trudeau-Tavara Date: Wed, 23 Aug 2023 06:24:26 -0400 Subject: [PATCH 12/13] Support toggling fullscreen on web --- main.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 55a742a..c42d153 100644 --- a/main.c +++ b/main.c @@ -7233,9 +7233,31 @@ void event(const sapp_event *e) } #endif - if (e->type == SAPP_EVENTTYPE_KEY_DOWN && e->key_code == SAPP_KEYCODE_F11) + if (e->type == SAPP_EVENTTYPE_KEY_DOWN && + (e->key_code == SAPP_KEYCODE_F11 || + e->key_code == SAPP_KEYCODE_ENTER && ((e->modifiers & SAPP_MODIFIER_ALT) || (e->modifiers & SAPP_MODIFIER_SHIFT)))) { +#ifdef DESKTOP sapp_toggle_fullscreen(); +#else + EM_ASM({ + var elem = document.documentElement; + if (document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement) + { + if (document.exitFullscreen) document.exitFullscreen(); + else if (document.webkitExitFullscreen) document.webkitExitFullscreen(); + else if (document.mozCancelFullScreen) document.mozCancelFullScreen(); + else if (document.msExitFullscreen) document.msExitFullscreen(); + } + else + { + if (elem.requestFullscreen) elem.requestFullscreen(); + else if (elem.webkitRequestFullscreen) elem.webkitRequestFullscreen(); + else if (elem.mozRequestFullScreen) elem.mozRequestFullScreen(); + else if (elem.msRequestFullscreen) elem.msRequestFullscreen(); + } + }); +#endif } #ifdef DEVTOOLS From 12965a7818c9ed349a5ba7fd76d9413f8f22d24d Mon Sep 17 00:00:00 2001 From: Phillip Trudeau-Tavara Date: Wed, 23 Aug 2023 09:55:54 -0400 Subject: [PATCH 13/13] Change engine title strings to "Dante's Cowboy" --- main.c | 2 +- web_template.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index c42d153..0503d00 100644 --- a/main.c +++ b/main.c @@ -7485,7 +7485,7 @@ sapp_desc sokol_main(int argc, char* argv[]) .width = 800, .height = 600, //.gl_force_gles2 = true, not sure why this was here in example, look into - .window_title = "RPGPT", + .window_title = "Dante's Cowboy", .win32_console_attach = true, .win32_console_create = true, .icon.sokol_default = true, diff --git a/web_template.html b/web_template.html index 0bf028f..2b921c4 100644 --- a/web_template.html +++ b/web_template.html @@ -3,7 +3,7 @@ -AI RPG +Dante's Cowboy