summaryrefslogtreecommitdiff
path: root/apps/plugins/puzzles/icons/screenshot.sh
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/puzzles/icons/screenshot.sh')
-rwxr-xr-xapps/plugins/puzzles/icons/screenshot.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/apps/plugins/puzzles/icons/screenshot.sh b/apps/plugins/puzzles/icons/screenshot.sh
new file mode 100755
index 0000000..0e2a06e
--- /dev/null
+++ b/apps/plugins/puzzles/icons/screenshot.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+# Generate a screenshot from a puzzle save file. Takes the
+# following arguments, in order:
+#
+# - the name of the puzzle binary
+# - the name of the save file
+# - the name of the output image file
+# - (optionally) the proportion of the next move to redo before
+# taking the screenshot.
+#
+# This script requires access to an X server in order to run, but
+# seems to work fine under xvfb-run if you haven't got a real one
+# available (or if you don't want to use it for some reason).
+
+binary="$1"
+save="$2"
+image="$3"
+if test "x$4" != "x"; then
+ redo="--redo $4"
+else
+ redo=
+fi
+
+"$binary" $redo --screenshot "$image" --load "$save"