| 1 | #!/usr/bin/env bash |
| 2 | set -euo pipefail |
| 3 | ROOT="$(cd "$(dirname "$0")/.." && pwd)" |
| 4 | BUILD_FILE="$ROOT/build/game.js" |
| 5 | SRC_DIR="$ROOT/src" |
| 6 | |
| 7 | printf "Build started, output file: %s\n" "$BUILD_FILE" |
| 8 | rm -f "$BUILD_FILE" |
| 9 | |
| 10 | FILES=( |
| 11 | "$SRC_DIR/textureColumn.js" |
| 12 | "$SRC_DIR/ppda/depthDecode.js" |
| 13 | "$SRC_DIR/ppda/viewFrame.js" |
| 14 | "$SRC_DIR/ppda/compositor.js" |
| 15 | "$SRC_DIR/ppda/loadPpda.js" |
| 16 | "$SRC_DIR/ppda/atlasRuntime.js" |
| 17 | "$SRC_DIR/levels.js" |
| 18 | "$SRC_DIR/tiles.js" |
| 19 | "$SRC_DIR/world.js" |
| 20 | "$SRC_DIR/player.js" |
| 21 | "$SRC_DIR/npc.js" |
| 22 | "$SRC_DIR/raycastScene.js" |
| 23 | "$SRC_DIR/main.js" |
| 24 | ) |
| 25 | |
| 26 | for file in "${FILES[@]}" |
| 27 | do |
| 28 | if [[ ! -f "$file" ]] |
| 29 | then |
| 30 | printf "Missing source file: %s\n" "$file" >&2 |
| 31 | exit 1 |
| 32 | fi |
| 33 | printf "\n/*\n * Start File:\n * %s\n */ \n" "$file" >> "$BUILD_FILE" |
| 34 | printf "Building %s\n" "$file" |
| 35 | cat "$file" >> "$BUILD_FILE" |
| 36 | printf "\n/*\n * End File:\n * %s\n */ \n" "$file" >> "$BUILD_FILE" |
| 37 | done |
| 38 | printf "DONE\n" |