Major refactor:

* Removed any hotreload functionality to simplify the code-base, may introduce it back again if there's a need to redesign the UI as it was used for dynamic prototyping.
* Split the code base into two packages: generator and frontend. The 'generator' package is reponsible for the functionality of making the atlases, etc... while the frontend is pure the immediate mode UI implemented with raygui and application globals
* New build scripts, windows only for now.
This commit is contained in:
Stefan Stefanov 2024-08-30 18:05:56 +03:00
parent 84db74586b
commit 3f1c523ad9
35 changed files with 397 additions and 1023 deletions

2
scripts/build_atlas.bat Normal file
View file

@ -0,0 +1,2 @@
@echo off
odin build src/frontend -define:RAYLIB_SHARED=true -out:build/yaap-debug.exe -debug

View file

@ -0,0 +1,2 @@
@echo off
odin build src/frontend -define:RAYLIB_SHARED=true -out:build/yaap.exe -o:speed

2
scripts/build_cli.bat Normal file
View file

@ -0,0 +1,2 @@
@echo off
odin build examples/aseprite_odin_generator.odin -file -define:RAYLIB_SHARED=true -out:build/yaap-cli-debug.exe -debug

View file

@ -0,0 +1,2 @@
@echo off
odin build examples/aseprite_odin_generator.odin -file -define:RAYLIB_SHARED=true -out:build/yaap-cli.exe -o:speed

View file

@ -1,2 +0,0 @@
@echo off
odin build src/main_release -define:RAYLIB_SHARED=true -out:build/game_debug.exe -debug

View file

@ -1,3 +0,0 @@
#!/usr/bin/env bash
odin build src/main_release -out:build/game_debug.bin -no-bounds-check -debug

View file

@ -1,2 +0,0 @@
@echo off
odin build src/aseprite_odin_generator -define:RAYLIB_SHARED=true -out:build_generator/aseprite_odin_generator.exe -debug

View file

@ -1,21 +0,0 @@
@echo off
rem Build game.dll
odin build src -show-timings -use-separate-modules -define:RAYLIB_SHARED=true -build-mode:dll -out:build/game.dll -strict-style -vet-unused -vet-using-stmt -vet-using-param -vet-style -vet-semicolon -debug
IF %ERRORLEVEL% NEQ 0 exit /b 1
rem If game.exe already running: Then only compile game.dll and exit cleanly
QPROCESS "game.exe">NUL
IF %ERRORLEVEL% EQU 0 exit /b 1
rem build game.exe
odin build src/main_hot_reload -use-separate-modules -out:build/game.exe -strict-style -vet-using-stmt -vet-using-param -vet-style -vet-semicolon -debug
IF %ERRORLEVEL% NEQ 0 exit /b 1
rem copy raylib.dll from odin folder to here
if not exist "raylib.dll" (
echo "Please copy raylib.dll from <your_odin_compiler>/vendor/raylib/windows/raylib.dll to the same directory as game.exe"
exit /b 1
)
exit /b 0

View file

@ -1,47 +0,0 @@
#!/usr/bin/env bash
VET="-strict-style -vet-unused -vet-using-stmt -vet-using-param -vet-style -vet-semicolon"
# NOTE: this is a recent addition to the Odin compiler, if you don't have this command
# you can change this to the path to the Odin folder that contains vendor, eg: "~/Odin".
ROOT=$(odin root)
if [ ! $? -eq 0 ]; then
echo "Your Odin compiler does not have the 'odin root' command, please update or hardcode it in the script."
exit 1
fi
set -eu
# Figure out the mess that is dynamic libraries.
case $(uname) in
"Darwin")
case $(uname -m) in
"arm64") LIB_PATH="macos-arm64" ;;
*) LIB_PATH="macos" ;;
esac
DLL_EXT=".dylib"
EXTRA_LINKER_FLAGS="-Wl,-rpath $ROOT/vendor/raylib/$LIB_PATH"
;;
*)
DLL_EXT=".so"
EXTRA_LINKER_FLAGS="'-Wl,-rpath=\$ORIGIN/linux'"
# Copy the linux libraries into the project automatically.
if [ ! -d "linux" ]; then
mkdir linux
cp -r $ROOT/vendor/raylib/linux/libraylib*.so* linux
fi
;;
esac
# Build the game.
odin build src -use-separate-modules -extra-linker-flags:"$EXTRA_LINKER_FLAGS" -show-timings -define:RAYLIB_SHARED=true -build-mode:dll -out:build/game_tmp$DLL_EXT -debug $VET
# Need to use a temp file on Linux because it first writes an empty `game.so`, which the game will load before it is actually fully written.
mv ./build/game_tmp$DLL_EXT ./build/game$DLL_EXT
# Do not build the game.bin if it is already running.
if ! pgrep game.bin > /dev/null; then
odin build src/main_hot_reload -use-separate-modules -out:build/game.bin $VET -debug
fi

View file

@ -1,2 +0,0 @@
@echo off
odin build src/main_release -define:RAYLIB_SHARED=true -out:build/game_release.exe -no-bounds-check -o:speed -strict-style -vet-unused -vet-using-stmt -vet-using-param -vet-style -vet-semicolon -subsystem:windows

View file

@ -1,3 +0,0 @@
#!/usr/bin/env bash
odin build src/main_release -out:build/game_release.bin -no-bounds-check -o:speed -strict-style -vet-unused -vet-using-stmt -vet-using-param -vet-style -vet-semicolon

14
scripts/setup.bat Normal file
View file

@ -0,0 +1,14 @@
@echo off
mkdir build
FOR /F "tokens=*" %%g IN ('odin root') do (SET ODIN_ROOT=%%g)
echo %ODIN_ROOT%
@REM If it fails to find your odin root folder, copy the raylib.dll manually into the build folder, it's a runtime requirement
copy %ODIN_ROOT%\vendor\raylib\windows\raylib.dll build\raylib.dll
pushd vendors\dialog
call .\build.bat
popd