43 lines
1.5 KiB
Bash
43 lines
1.5 KiB
Bash
#!/usr/bin/env bash
|
|
# Render the stand-in sprite proof scene under a headless weston (llvmpipe)
|
|
# virtual display so the in-engine screenshot capture works. Mirrors the
|
|
# RENDER_MODE=weston path in scripts/autoplay/run_ap3.sh.
|
|
#
|
|
# Output: copies user://screenshots/standin_sprite_proof.png to
|
|
# tools/standin-sprites/standin_sprite_proof.png (and stdout path).
|
|
set -uo pipefail
|
|
|
|
REPO="$HOME/Code/@projects/@magic-civilization"
|
|
# Args: [scene_basename] [png_basename] [width] [height]
|
|
SCENE_NAME="${1:-standin_sprite_proof}"
|
|
PNG_NAME="${2:-$SCENE_NAME}"
|
|
W="${3:-1280}"
|
|
H="${4:-820}"
|
|
SCENE="res://engine/scenes/tests/${SCENE_NAME}.tscn"
|
|
SOCKET="standin-proof-$$"
|
|
LOGDIR="$(mktemp -d)"
|
|
|
|
weston --backend=headless --socket="$SOCKET" --width="$W" --height="$H" \
|
|
>"$LOGDIR/weston.log" 2>&1 &
|
|
WESTON_PID=$!
|
|
trap 'kill "$WESTON_PID" 2>/dev/null || true' EXIT
|
|
sleep 1
|
|
|
|
cd "$REPO/src/game"
|
|
timeout 90 flatpak run --user \
|
|
--filesystem=home \
|
|
--socket=wayland \
|
|
--env=WAYLAND_DISPLAY="$SOCKET" \
|
|
--filesystem=xdg-run/"$SOCKET" \
|
|
org.godotengine.Godot --path . --rendering-method gl_compatibility \
|
|
"$SCENE" 2>&1 | grep -iE "standin_sprite_proof|MISSING" | head
|
|
|
|
UD="$HOME/.var/app/org.godotengine.Godot/data/godot/app_userdata/Magic Civilization/screenshots/${PNG_NAME}.png"
|
|
DEST="$REPO/tools/standin-sprites/${PNG_NAME}.png"
|
|
if [ -f "$UD" ]; then
|
|
cp "$UD" "$DEST"
|
|
echo "PROOF_OK: $DEST"
|
|
else
|
|
echo "PROOF_MISSING: screenshot not produced (see $LOGDIR/weston.log)"
|
|
exit 1
|
|
fi
|