Web build works

This commit is contained in:
Synthasmagoria 2026-09-09 16:14:51 +02:00
commit 462f0daf76
3 changed files with 143084 additions and 4 deletions

View file

@ -1,4 +1,7 @@
- Centered justification in UI
- Make web build
- Zoom sensitivity
- Web build
- Web read/write
- Remove default project load error message on startup
- When there is no matrix it should still draw the rectangle
- Keyboard input doesnt work on web
- Resizing doesn't work on web

View file

@ -1,5 +1,6 @@
#!/bin/bash -eu
PROJECT_NAME="transformation_visualizer"
ASSETS_DIR="src/assets"
RAYLIB_PATH="src/libraries/raylib"
EMSCRIPTEN_SDK_DIR="$HOME/programs/emsdk"
@ -21,6 +22,7 @@ else
fi
WASM_OBJ_NAME="transformation_visualizer.wasm.obj"
rm -r $OUT_DIR
mkdir -p $OUT_DIR
export EMSDK_QUIET=1
@ -32,7 +34,7 @@ export EMSDK_QUIET=1
# The emcc call will be fed the actual raylib library file. That stuff will end
# up in env.o
ODIN_DEFINES="-define:RAYLIB_WASM_LIB=env.o -define:RAYGUI_WASM_LIB=env.o"
odin build src/web/ -target:js_wasm32 -build-mode:obj $ODIN_DEFINES $ODIN_FLAGS -out:$OUT_DIR/$WASM_OBJ_NAME
odin build src/web/ -target:js_wasm32 -target-features:simd128 -build-mode:obj $ODIN_DEFINES $ODIN_FLAGS -out:$OUT_DIR/$WASM_OBJ_NAME
ODIN_PATH=$(odin root)
@ -42,12 +44,14 @@ files="$OUT_DIR/$WASM_OBJ_NAME $RAYLIB_PATH/wasm/libraylib.a $RAYLIB_PATH/wasm/l
# index_template.html contains the javascript code that calls the procedures in
# source/main_web/main_web.odin
# TODO (synthas): Investigate why emcc's emscripten flag causes a linker error on itch.io
EMCC_SETTINGS="-sEXPORTED_RUNTIME_METHODS=['HEAPF32'] -sUSE_GLFW=3 -sWASM_BIGINT -sWARN_ON_UNDEFINED_SYMBOLS=0"
flags="-Os $EMCC_SETTINGS --shell-file $INDEX_TEMPLATE_PATH --preload-file src/assets"
flags="-O2 $EMCC_SETTINGS --shell-file $INDEX_TEMPLATE_PATH --preload-file src/assets"
# For debugging: Add `-g` to `emcc` (gives better error callstack in chrome)
emcc -o $OUT_DIR/index.html $files $flags
rm -f $OUT_DIR/$WASM_OBJ_NAME
zip -r $OUT_DIR/${PROJECT_NAME}.zip $OUT_DIR
echo "Web build created in ${OUT_DIR}"

143073
dump.txt Normal file

File diff suppressed because it is too large Load diff