-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
72 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash -xe | ||
|
||
# Opens a live-reloading preview of the world | ||
# | ||
# Prerequisites: | ||
# -------------- | ||
# Install inotify-wait: | ||
# | ||
# sudo apt install inotify-tools | ||
# | ||
# Usage: | ||
# -------------- | ||
# Once the VS Code editor tabs are opened, one can press | ||
# CTRL+\ (backslash) with the image selected to split the | ||
# editor pane horizontally. | ||
# One may then navigate to the left-pane's copy of the image | ||
# preview with CTRL+PageUp, and then | ||
# CTRL+w will close the redundant image preview. | ||
|
||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
cd $SCRIPT_DIR/.. | ||
|
||
|
||
SCENARIO_PATH=${1?"Usage: $0 SCENARIO_PATH"} | ||
|
||
IMG_WIDTH=200 | ||
IMG_HEIGHT=150 | ||
|
||
IMG_OUTPUT_PATH=output.png | ||
RENDER_IMG_COMMAND="stack exec swarm-scene -- $SCENARIO_PATH --fail-blank --dest $IMG_OUTPUT_PATH --png --width $IMG_WIDTH --height $IMG_HEIGHT" | ||
|
||
stack build --fast swarm:swarm-scene | ||
|
||
$RENDER_IMG_COMMAND | ||
code --reuse-window $SCENARIO_PATH && code --reuse-window $IMG_OUTPUT_PATH | ||
|
||
while inotifywait -e close_write $SCENARIO_PATH; do $RENDER_IMG_COMMAND; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters