Used __builtin_wasm_memory_size(0) instead of having the Javascript code call init_mem with the initial page count. Added a simple <div> below the canvas that can hold any number of labels that can be filled/updated through jsSetLabel which lives in a new file misc_functions.js.

This commit is contained in:
2025-09-02 16:05:53 -07:00
parent f45c2d88e0
commit 04028b29d3
10 changed files with 117 additions and 30 deletions

View File

@@ -158,6 +158,11 @@ WASM_EXPORT(App_Initialize) bool App_Initialize()
PrintLine_D("GL_VERSION: \"%s\"", jsGlGetParameterString(scratch, GL_VERSION));
PrintLine_D("GL_VENDOR: \"%s\"", jsGlGetParameterString(scratch, GL_VENDOR));
#if 1
SetLabelPrint("glVersionLabel", "GL_VERSION: %s", jsGlGetParameterString(scratch, GL_VERSION));
SetLabelPrint("glVendorLabel", "GL_VENDOR: %s", jsGlGetParameterString(scratch, GL_VENDOR));
#endif
jsGlEnable(GL_BLEND);
jsGlBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
jsGlBlendEquation(GL_FUNC_ADD);
@@ -401,6 +406,9 @@ WASM_EXPORT(App_UpdateAndRender) bool App_UpdateAndRender(r64 programTimeR64)
jsGlDrawArrays(GL_TRIANGLES, 0, 6);
}
SetLabelPrint("offsetLabel", "Offset: %f", OscillateBy(programTime, -1.0f, 1.0f, 15000, 0));
SetLabelPrint("memoryLabel", "Mem: %u pages", stdCurrentPageCount);
#if 1
{
r32 offsetX = -0.4f;