add networking, 3d improvements, reorganize src structure
This commit is contained in:
parent
39b604b333
commit
415d424057
122 changed files with 5358 additions and 721 deletions
127
pxl8.sh
127
pxl8.sh
|
|
@ -56,6 +56,45 @@ build_luajit() {
|
|||
fi
|
||||
}
|
||||
|
||||
build_server() {
|
||||
local mode="$1"
|
||||
if [[ -d "server" ]]; then
|
||||
print_info "Building server ($mode mode)"
|
||||
cd server
|
||||
if [[ "$mode" == "release" ]]; then
|
||||
cargo build --release > /dev/null 2>&1
|
||||
else
|
||||
cargo build > /dev/null 2>&1
|
||||
fi
|
||||
cd - > /dev/null
|
||||
print_info "Built server"
|
||||
fi
|
||||
}
|
||||
|
||||
start_server() {
|
||||
local mode="$1"
|
||||
local server_bin
|
||||
if [[ "$mode" == "release" ]]; then
|
||||
server_bin="server/target/release/pxl8-server"
|
||||
else
|
||||
server_bin="server/target/debug/pxl8-server"
|
||||
fi
|
||||
if [[ -f "$server_bin" ]]; then
|
||||
print_info "Starting server"
|
||||
./$server_bin &
|
||||
SERVER_PID=$!
|
||||
sleep 0.2
|
||||
fi
|
||||
}
|
||||
|
||||
stop_server() {
|
||||
if [[ -n "$SERVER_PID" ]]; then
|
||||
print_info "Stopping server"
|
||||
kill $SERVER_PID 2>/dev/null || true
|
||||
wait $SERVER_PID 2>/dev/null || true
|
||||
fi
|
||||
}
|
||||
|
||||
build_sdl() {
|
||||
if [[ ! -f "lib/SDL/build/libSDL3.so" ]] && [[ ! -f "lib/SDL/build/libSDL3.a" ]] && [[ ! -f "lib/SDL/build/libSDL3.dylib" ]]; then
|
||||
print_info "Building SDL3"
|
||||
|
|
@ -113,6 +152,7 @@ print_usage() {
|
|||
echo " --all Clean both build artifacts and dependencies"
|
||||
echo " --deps Clean only dependencies"
|
||||
echo " --release Build/run/clean in release mode (default: debug)"
|
||||
echo " --server Start game server before running (for networked games)"
|
||||
}
|
||||
|
||||
setup_sdl3() {
|
||||
|
|
@ -320,7 +360,7 @@ case "$COMMAND" in
|
|||
print_info "Compiler cache: ccache enabled"
|
||||
fi
|
||||
|
||||
INCLUDES="-Iclient/src/core -Iclient/src/math -Iclient/src/gfx -Iclient/src/sfx -Iclient/src/script -Iclient/src/hal -Iclient/src/world -Iclient/src/asset -Iclient/src/game -Ilib -Ilib/luajit/src -Ilib/linenoise -Ilib/miniz"
|
||||
INCLUDES="-Isrc/core -Isrc/math -Isrc/gfx -Isrc/sfx -Isrc/script -Isrc/hal -Isrc/world -Isrc/asset -Isrc/game -Isrc/net -Ilib -Ilib/luajit/src -Ilib/linenoise -Ilib/miniz"
|
||||
COMPILE_FLAGS="$CFLAGS $INCLUDES"
|
||||
DEP_COMPILE_FLAGS="$DEP_CFLAGS $INCLUDES"
|
||||
|
||||
|
|
@ -329,38 +369,42 @@ case "$COMMAND" in
|
|||
LIB_SOURCE_FILES="lib/linenoise/linenoise.c lib/miniz/miniz.c"
|
||||
|
||||
PXL8_SOURCE_FILES="
|
||||
client/src/core/pxl8.c
|
||||
client/src/core/pxl8_io.c
|
||||
client/src/core/pxl8_log.c
|
||||
client/src/core/pxl8_rng.c
|
||||
client/src/math/pxl8_math.c
|
||||
client/src/gfx/pxl8_anim.c
|
||||
client/src/gfx/pxl8_atlas.c
|
||||
client/src/gfx/pxl8_blit.c
|
||||
client/src/gfx/pxl8_3d_camera.c
|
||||
client/src/gfx/pxl8_colormap.c
|
||||
client/src/gfx/pxl8_cpu.c
|
||||
client/src/gfx/pxl8_dither.c
|
||||
client/src/gfx/pxl8_font.c
|
||||
client/src/gfx/pxl8_gfx.c
|
||||
client/src/gfx/pxl8_mesh.c
|
||||
client/src/gfx/pxl8_palette.c
|
||||
client/src/gfx/pxl8_particles.c
|
||||
client/src/gfx/pxl8_tilemap.c
|
||||
client/src/gfx/pxl8_tilesheet.c
|
||||
client/src/gfx/pxl8_transition.c
|
||||
client/src/sfx/pxl8_sfx.c
|
||||
client/src/script/pxl8_repl.c
|
||||
client/src/script/pxl8_script.c
|
||||
client/src/hal/pxl8_sdl3.c
|
||||
client/src/world/pxl8_bsp.c
|
||||
client/src/world/pxl8_gen.c
|
||||
client/src/world/pxl8_world.c
|
||||
client/src/asset/pxl8_ase.c
|
||||
client/src/asset/pxl8_cart.c
|
||||
client/src/asset/pxl8_save.c
|
||||
client/src/game/pxl8_gui.c
|
||||
client/src/game/pxl8_replay.c
|
||||
src/core/pxl8.c
|
||||
src/core/pxl8_bytes.c
|
||||
src/core/pxl8_io.c
|
||||
src/core/pxl8_log.c
|
||||
src/core/pxl8_rng.c
|
||||
src/math/pxl8_math.c
|
||||
src/gfx/pxl8_anim.c
|
||||
src/gfx/pxl8_atlas.c
|
||||
src/gfx/pxl8_blend.c
|
||||
src/gfx/pxl8_blit.c
|
||||
src/gfx/pxl8_3d_camera.c
|
||||
src/gfx/pxl8_colormap.c
|
||||
src/gfx/pxl8_cpu.c
|
||||
src/gfx/pxl8_dither.c
|
||||
src/gfx/pxl8_font.c
|
||||
src/gfx/pxl8_gfx.c
|
||||
src/gfx/pxl8_mesh.c
|
||||
src/gfx/pxl8_palette.c
|
||||
src/gfx/pxl8_particles.c
|
||||
src/gfx/pxl8_tilemap.c
|
||||
src/gfx/pxl8_tilesheet.c
|
||||
src/gfx/pxl8_transition.c
|
||||
src/sfx/pxl8_sfx.c
|
||||
src/script/pxl8_repl.c
|
||||
src/script/pxl8_script.c
|
||||
src/hal/pxl8_sdl3.c
|
||||
src/world/pxl8_bsp.c
|
||||
src/world/pxl8_gen.c
|
||||
src/world/pxl8_world.c
|
||||
src/asset/pxl8_ase.c
|
||||
src/asset/pxl8_cart.c
|
||||
src/asset/pxl8_save.c
|
||||
src/game/pxl8_gui.c
|
||||
src/game/pxl8_replay.c
|
||||
src/net/pxl8_net.c
|
||||
src/net/pxl8_protocol.c
|
||||
"
|
||||
|
||||
LUAJIT_LIB="lib/luajit/src/libluajit.a"
|
||||
|
|
@ -390,13 +434,13 @@ case "$COMMAND" in
|
|||
|
||||
NEEDS_REBUILD=false
|
||||
if [[ "$src_file" -nt "$obj_file" ]] || \
|
||||
[[ "client/src/core/pxl8_types.h" -nt "$obj_file" ]] || \
|
||||
[[ "client/src/core/pxl8_macros.h" -nt "$obj_file" ]]; then
|
||||
[[ "src/core/pxl8_types.h" -nt "$obj_file" ]] || \
|
||||
[[ "src/core/pxl8_macros.h" -nt "$obj_file" ]]; then
|
||||
NEEDS_REBUILD=true
|
||||
fi
|
||||
|
||||
if [[ "$src_file" == "client/src/script/pxl8_script.c" ]]; then
|
||||
for lua_file in client/src/lua/*.lua client/src/lua/pxl8/*.lua lib/fennel/fennel.lua; do
|
||||
if [[ "$src_file" == "src/script/pxl8_script.c" ]]; then
|
||||
for lua_file in src/lua/*.lua src/lua/pxl8/*.lua lib/fennel/fennel.lua; do
|
||||
if [[ -f "$lua_file" ]] && [[ "$lua_file" -nt "$obj_file" ]]; then
|
||||
NEEDS_REBUILD=true
|
||||
break
|
||||
|
|
@ -430,16 +474,25 @@ case "$COMMAND" in
|
|||
|
||||
CART=""
|
||||
EXTRA_ARGS=""
|
||||
RUN_SERVER=false
|
||||
for arg in "$@"; do
|
||||
if [[ "$arg" == "--release" ]]; then
|
||||
continue
|
||||
elif [[ "$arg" == "--repl" ]]; then
|
||||
EXTRA_ARGS="$EXTRA_ARGS --repl"
|
||||
elif [[ "$arg" == "--server" ]]; then
|
||||
RUN_SERVER=true
|
||||
elif [[ -z "$CART" ]]; then
|
||||
CART="$arg"
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ "$RUN_SERVER" == true ]]; then
|
||||
build_server "$MODE"
|
||||
start_server "$MODE"
|
||||
trap stop_server EXIT
|
||||
fi
|
||||
|
||||
if [[ -z "$CART" ]]; then
|
||||
"$BINDIR/pxl8" $EXTRA_ARGS
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue