AAAAAAAAAAAAA

This commit is contained in:
Synthasmagoria 2026-09-01 23:24:03 +02:00
commit 8892592ae9
7 changed files with 9 additions and 17 deletions

View file

@ -45,7 +45,7 @@ files="$OUT_DIR/$WASM_OBJ_NAME $RAYLIB_PATH/wasm/libraylib.a $RAYLIB_PATH/wasm/l
flags="-O0 -sEXPORTED_RUNTIME_METHODS=['HEAPF32'] -sUSE_GLFW=3 -sWASM_BIGINT -sWARN_ON_UNDEFINED_SYMBOLS=0 --shell-file $INDEX_TEMPLATE_PATH --preload-file src/assets" flags="-O0 -sEXPORTED_RUNTIME_METHODS=['HEAPF32'] -sUSE_GLFW=3 -sWASM_BIGINT -sWARN_ON_UNDEFINED_SYMBOLS=0 --shell-file $INDEX_TEMPLATE_PATH --preload-file src/assets"
# For debugging: Add `-g` to `emcc` (gives better error callstack in chrome) # For debugging: Add `-g` to `emcc` (gives better error callstack in chrome)
emcc -g -o $OUT_DIR/index.html $files $flags emcc -o $OUT_DIR/index.html $files $flags
rm -f $OUT_DIR/$WASM_OBJ_NAME rm -f $OUT_DIR/$WASM_OBJ_NAME

View file

@ -1,5 +1,3 @@
#+build !wasm32, !wasm64p32
package main package main
import game ".." import game ".."

View file

@ -8,7 +8,7 @@ windows_library_dest="windows"
darwin_library_dest="darwin" darwin_library_dest="darwin"
wasm_library_dest="wasm" wasm_library_dest="wasm"
config_flags="\ CONFIG_FLAGS="\
-DSUPPORT_MODULE_RSHAPES=1 \ -DSUPPORT_MODULE_RSHAPES=1 \
-DSUPPORT_MODULE_RTEXTURES=1 \ -DSUPPORT_MODULE_RTEXTURES=1 \
-DSUPPORT_MODULE_RTEXT=1 \ -DSUPPORT_MODULE_RTEXT=1 \
@ -78,10 +78,10 @@ config_flags="\
if [[ -v 1 ]]; then if [[ -v 1 ]]; then
if [ "$1" = "DEBUG" ]; then if [ "$1" = "DEBUG" ]; then
MFLAGS="RAYLIB_BUILD_MODE=DEBUG" MAKE_FLAGS="RAYLIB_BUILD_MODE=DEBUG"
CFLAGS="-g" CFLAGS="-g"
elif [ "$1" = "RELEASE" ]; then elif [ "$1" = "RELEASE" ]; then
MFLAGS="RAYLIB_BUILD_MODE=RELEASE" MAKE_FLAGS="RAYLIB_BUILD_MODE=RELEASE"
CFLAGS="-Os" CFLAGS="-Os"
else else
echo "Usage: <script> <DEBUG/RELEASE>" echo "Usage: <script> <DEBUG/RELEASE>"
@ -101,7 +101,7 @@ source $emsdk_env
pushd raylib/src pushd raylib/src
echo "Compiling raylib static library for linux" echo "Compiling raylib static library for linux"
make --silent RAYLIB_CONFIG_FLAGS="$config_flags" $MFLAGS PLATFORM_OS=LINUX make --silent RAYLIB_CONFIG_FLAGS="$CONFIG_FLAGS" $MAKE_FLAGS PLATFORM_OS=LINUX -B
mv libraylib.a "../../${linux_library_dest}" mv libraylib.a "../../${linux_library_dest}"
make --silent clean make --silent clean
@ -111,7 +111,7 @@ make --silent clean
# make --silent clean # make --silent clean
echo "Compiling raylib static library for web" echo "Compiling raylib static library for web"
make --silent RAYLIB_CONFIG_FLAGS="$config_flags" $MFLAGS PLATFORM=PLATFORM_WEB make --silent RAYLIB_CONFIG_FLAGS="$CONFIG_FLAGS" $MAKE_FLAGS PLATFORM=PLATFORM_WEB -B
mv libraylib.web.a libraylib.a mv libraylib.web.a libraylib.a
mv libraylib.a "../../${wasm_library_dest}" mv libraylib.a "../../${wasm_library_dest}"
make --silent clean make --silent clean
@ -124,7 +124,7 @@ ar rcs ../${linux_library_dest}/libraygui.a raygui.o
rm raygui.o rm raygui.o
echo "Compiling raygui static library for web" echo "Compiling raygui static library for web"
emcc -c -Os -x c -DRAYGUI_IMPLEMENTATION -DPLATFORM_WEB -I../raylib/src raygui.h -o raygui_wasm.o emcc $CFLAGS -c -x c -DRAYGUI_IMPLEMENTATION -DPLATFORM_WEB -I../raylib/src raygui.h -o raygui_wasm.o
emar rcs ../${wasm_library_dest}/libraygui.a raygui_wasm.o emar rcs ../${wasm_library_dest}/libraygui.a raygui_wasm.o
rm raygui_wasm.o rm raygui_wasm.o
popd popd

View file

@ -34,7 +34,7 @@ shutdown :: proc() {
should_run :: proc() -> bool { should_run :: proc() -> bool {
when ODIN_OS != .JS { when ODIN_OS != .JS {
if program.window_should_close { if rl.WindowShouldClose() {
return false return false
} }
} }

View file

@ -510,9 +510,6 @@ program_update :: proc() {
} }
} }
} }
if rl.WindowShouldClose() {
program.window_should_close = true
}
case .Dialog: case .Dialog:
ui_overlay_elements = program_build_dialog_ui(&program.ui_overlay_context, program.dialog_type) ui_overlay_elements = program_build_dialog_ui(&program.ui_overlay_context, program.dialog_type)
if program.ui_overlay_queue_focus_first { if program.ui_overlay_queue_focus_first {
@ -552,9 +549,6 @@ program_update :: proc() {
program.animation.matrix_count = program.matrix_count program.animation.matrix_count = program.matrix_count
program.state = .Normal program.state = .Normal
} }
if rl.WindowShouldClose() {
program.state = .Normal
}
} }
clear(&program.mouse_draggables) clear(&program.mouse_draggables)

View file

@ -1,7 +1,6 @@
// Implementations of `read_entire_file` and `write_entire_file` using the libc // Implementations of `read_entire_file` and `write_entire_file` using the libc
// stuff emscripten exposes. You can read the files that get bundled by // stuff emscripten exposes. You can read the files that get bundled by
// `--preload-file assets` in `build_web` script. // `--preload-file assets` in `build_web` script.
#+build wasm32, wasm64p32 #+build wasm32, wasm64p32
package game package game

View file

@ -20,6 +20,7 @@ import "core:fmt"
context.allocator = emscripten_allocator() context.allocator = emscripten_allocator()
runtime.init_global_temporary_allocator(1*mem.Megabyte) runtime.init_global_temporary_allocator(1*mem.Megabyte)
// TODO (synthas): Do this if it works nicely
// Since we now use js_wasm32 we should be able to remove this and use // Since we now use js_wasm32 we should be able to remove this and use
// context.logger = log.create_console_logger(). However, that one produces // context.logger = log.create_console_logger(). However, that one produces
// extra newlines on web. So it's a bug in that core lib. // extra newlines on web. So it's a bug in that core lib.