Vendor odin.js
This commit is contained in:
parent
a8b35c7e3d
commit
3d27deb8f4
3 changed files with 2293 additions and 13 deletions
19
build_web.sh
19
build_web.sh
|
|
@ -5,7 +5,7 @@ ASSETS_DIR="src/assets"
|
|||
RAYLIB_PATH="src/libraries/raylib"
|
||||
EMSCRIPTEN_SDK_DIR="$HOME/programs/emsdk"
|
||||
OUT_DIR="build/web"
|
||||
INDEX_TEMPLATE_PATH="src/web/index_template.html"
|
||||
WEB_SOURCE_PATH="src/web"
|
||||
|
||||
if [[ -v 1 ]]; then
|
||||
if [ "$1" = "DEBUG" ]; then
|
||||
|
|
@ -38,20 +38,13 @@ export EMSDK_QUIET=1
|
|||
ODIN_DEFINES="-define:RAYLIB_WASM_LIB=env.o -define:RAYGUI_WASM_LIB=env.o"
|
||||
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)
|
||||
cp ${WEB_SOURCE_PATH}/odin.js $OUT_DIR
|
||||
|
||||
cp $ODIN_PATH/core/sys/wasm/js/odin.js $OUT_DIR
|
||||
|
||||
files="$OUT_DIR/$WASM_OBJ_NAME $RAYLIB_PATH/wasm/libraylib.a $RAYLIB_PATH/wasm/libraygui.a"
|
||||
|
||||
# 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="$EMCC_FLAGS $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
|
||||
# TODO (synthas): Investigate why emcc's size optimization flag causes a linker error on itch.io
|
||||
EMCC_SETTINGS="-sEXPORTED_RUNTIME_METHODS=['HEAPF32'] -sUSE_GLFW=3 -sWARN_ON_UNDEFINED_SYMBOLS=0"
|
||||
EMCC_FILES="$OUT_DIR/$WASM_OBJ_NAME $RAYLIB_PATH/wasm/libraylib.a $RAYLIB_PATH/wasm/libraygui.a"
|
||||
emcc -o $OUT_DIR/index.html $EMCC_FLAGS $EMCC_FILES $EMCC_SETTINGS --shell-file $WEB_SOURCE_PATH/index_template.html --preload-file src/assets
|
||||
|
||||
rm -f $OUT_DIR/$WASM_OBJ_NAME
|
||||
zip -r $OUT_DIR/${PROJECT_NAME}.zip $OUT_DIR
|
||||
|
|
|
|||
|
|
@ -3347,6 +3347,9 @@ int GuiValueBoxFloat(Rectangle bounds, const char *text, char *textValue, float
|
|||
if (GuiGetTextWidth(textValue) < bounds.width)
|
||||
{
|
||||
int key = GUI_INPUT_KEY;
|
||||
if (key != 0) {
|
||||
key = key;
|
||||
}
|
||||
if (((key >= 48) && (key <= 57)) ||
|
||||
(key == '.') ||
|
||||
((keyCount == 0) && (key == '+')) || // NOTE: Sign can only be in first position
|
||||
|
|
|
|||
2284
src/web/odin.js
Normal file
2284
src/web/odin.js
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue