#!/bin/bash # # Stage the sidescroller tutorial's own assets in the sandbox. # # docs/20-tutorial-sidescroller.md shows the reader a real sprite file and a real # character file out of docs/tutorials/assets/sidescroller. Those are worth # running through the loader exactly as printed rather than through a generic # fixture, because 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: sidescroller.sh " >&2 exit 2 fi ASSETS="${ROOT}/docs/tutorials/assets/sidescroller" cp "${ASSETS}"/*.png . || exit 1 mkdir -p sprites || exit 1 cp "${ASSETS}"/*.png sprites/ || exit 1 cp "${ASSETS}"/sprite_*.json sprites/ || exit 1