#!/bin/bash
#
# Stage a spritesheet image in the sandbox, as `spritesheet.png`.
#
# A `json kind=sprite` block names its sheet, and the loader really opens it --
# that is the whole point of running the documented format through the real
# loader. The chapter should not have to show a base64 PNG to get there, so the
# fixture comes from here instead.
#
# 576x384, a 12x8 grid of 48x48 frames. tests/assets/spritesheet.png is the same
# image the sprite suite uses.
#
# $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: spritesheet.sh <repository-root>" >&2
    exit 2
fi

cp "${ROOT}/tests/assets/spritesheet.png" spritesheet.png || exit 1
