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