36 lines
1.2 KiB
Bash
36 lines
1.2 KiB
Bash
|
|
#!/bin/bash
|
||
|
|
#
|
||
|
|
# Stage the JRPG tutorial's own assets in the sandbox.
|
||
|
|
#
|
||
|
|
# Same job as sidescroller.sh, and the same reason: docs/21-tutorial-jrpg.md
|
||
|
|
# shows the reader real sprite and character files out of
|
||
|
|
# docs/tutorials/assets/jrpg, and a beginner following the chapter types what is
|
||
|
|
# on the page -- so what is on the page has to be a file that loads.
|
||
|
|
#
|
||
|
|
# Two directories are staged, because the checker looks in two places:
|
||
|
|
#
|
||
|
|
# ./ a `json kind=sprite` block's spritesheet path is resolved
|
||
|
|
# relative to the sprite file, which lives in the sandbox root
|
||
|
|
# ./sprites tools/docs_checkjson.c loads everything here through
|
||
|
|
# akgl_sprite_load_json before it touches a `kind=character`
|
||
|
|
# block, since a character resolves its sprites by name
|
||
|
|
#
|
||
|
|
# $1 is the repository root. The caller runs this with the sandbox as the
|
||
|
|
# working directory.
|
||
|
|
|
||
|
|
set -u
|
||
|
|
|
||
|
|
ROOT="${1:-}"
|
||
|
|
if [ -z "${ROOT}" ]; then
|
||
|
|
echo "usage: jrpg.sh <repository-root>" >&2
|
||
|
|
exit 2
|
||
|
|
fi
|
||
|
|
|
||
|
|
ASSETS="${ROOT}/docs/tutorials/assets/jrpg"
|
||
|
|
|
||
|
|
cp "${ASSETS}"/*.png . || exit 1
|
||
|
|
|
||
|
|
mkdir -p sprites || exit 1
|
||
|
|
cp "${ASSETS}"/*.png sprites/ || exit 1
|
||
|
|
cp "${ASSETS}"/sprite_*.json sprites/ || exit 1
|