feat(web): proper viewport scaling, instant load, and file downloads
Make the Emscripten build behave like the desktop app for loading, window scaling, and exporting. All changes are #ifdef __EMSCRIPTEN__-gated or no-op on desktop, so native behavior is unchanged. Scaling: - Drop FLAG_WINDOW_HIGHDPI on web. The emscripten-GLFW shim forces a fixed pixel canvas style (!important) when HiDPI-aware, overriding the shell's 100vw/100vh CSS so the canvas can't fill the page; raylib's own resize/window callbacks also disagree about dividing by devicePixelRatio, desyncing the framebuffer from the reported screen size. - Sync raylib's window size to window.innerWidth/innerHeight each frame via SetWindowSize (guarded against no-op churn). This keeps screen size, GL viewport, and projection consistent, so the UI fills the viewport and reflows on resize like the desktop window. Loading: - Compute the full-resolution STFT synchronously when a file loads instead of the desktop overview-then-deferred-high-res path, which relied on many main-loop iterations yielding to the browser and appeared to stall partway. - Allow the wasm heap to grow (INITIAL_MEMORY + ALLOW_MEMORY_GROWTH) so longer recordings fit now that everything is computed up front. Exports: - Add Platform_OfferFileToUser(): no-op on desktop (file is already on disk); on web it reads the just-written file from MEMFS and triggers a browser download, then unlinks the temp copy. Wired into PNG and WAV export, which now show just the filename in the status message. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
+3
-1
@@ -79,7 +79,9 @@ done
|
||||
# Linker flags
|
||||
# The font lives at resources/fonts/DejaVuSansMono.ttf and is loaded relative to
|
||||
# the resources dir at runtime, so the resources@resources preload covers it.
|
||||
LDFLAGS="-s USE_GLFW=3 -s ASYNCIFY -s TOTAL_MEMORY=67108864 -s FORCE_FILESYSTEM=1 --preload-file resources@resources --shell-file $SCRIPT_DIR/web_shell.html -s NO_EXIT_RUNTIME=1"
|
||||
# INITIAL_MEMORY + ALLOW_MEMORY_GROWTH: the web build now computes the full STFT
|
||||
# up front, so the heap must be able to grow for longer recordings.
|
||||
LDFLAGS="-s USE_GLFW=3 -s ASYNCIFY -s INITIAL_MEMORY=67108864 -s ALLOW_MEMORY_GROWTH=1 -s FORCE_FILESYSTEM=1 --preload-file resources@resources --shell-file $SCRIPT_DIR/web_shell.html -s NO_EXIT_RUNTIME=1"
|
||||
|
||||
if [ "$BUILD_TYPE" = "debug" ]; then
|
||||
LDFLAGS="$LDFLAGS -g -O0 -s ASSERTIONS=1"
|
||||
|
||||
Reference in New Issue
Block a user