diff --git a/game.py b/game.py index 573a0ad..2f9a4d1 100755 --- a/game.py +++ b/game.py @@ -195,7 +195,7 @@ def main() -> NoReturn: collected_42 = True i = 0 collect_sfx() - show_frame(frame, to_stdout=True) + show_frame(frame, to_stdout=(not sys.stdout.isatty())) i += 1 if __name__ == '__main__': diff --git a/start_game.sh b/start_game.sh index 8600d6f..09def37 100755 --- a/start_game.sh +++ b/start_game.sh @@ -3,12 +3,15 @@ # st -f 'SauceCodePro Nerd Font Mono:size=10' -e sh -c '{ ./game.py | 2>/dev/null ffmpeg -y -f rawvideo -s 640x480 -pix_fmt bgr24 -i - -map 0:V:0 -filter:v "format=gray,hflip" -c:v libx265 -preset ultrafast -tune zerolatency -crf 30 -f nut - | TERM=xterm-mono CACA_DRIVER=ncurses DISPLAY= mpv --really-quiet --no-cache --no-config --vo=caca --untimed --profile=low-latency - || { echo Error 1>&2; read X; }; }' # st -f 'SauceCodePro Nerd Font Mono:size=10' -e sh -c '{ ./game.py | 2>/dev/null ffmpeg -y -f rawvideo -s 640x480 -pix_fmt bgr24 -i - -map 0:V:0 -filter:v "format=gray,hflip" -c:v libx264 -preset ultrafast -tune zerolatency -crf 30 -f nut - | TERM=xterm-mono CACA_DRIVER=ncurses DISPLAY= mpv --really-quiet --no-cache --no-config --vo=tct --untimed --profile=low-latency - || { echo Error 1>&2; read X; }; }' +export TERM_FONT='SauceCodePro Nerd Font Mono' +export TERM_FONT_SIZE='10' +export OUT_TERM='xterm-mono' xterm \ -bg black \ -fg white \ -s -fullscreen \ - -fa 'SauceCodePro Nerd Font Mono' \ - -fs 8 \ + -fa "${TERM_FONT}" \ + -fs "${TERM_FONT_SIZE}" \ -e '{ ./game.py | 2>/dev/null ffmpeg -y \ @@ -24,7 +27,7 @@ xterm \ -crf 30 \ -f nut \ - | - TERM=xterm-mono CACA_DRIVER=ncurses DISPLAY= mpv \ + TERM='"'${OUT_TERM}'"' CACA_DRIVER=ncurses DISPLAY= mpv \ --really-quiet \ --no-cache \ --no-config \ @@ -32,5 +35,5 @@ xterm \ --untimed \ --profile=low-latency \ - \ - || { echo Error 1>&2; read X; }; + || { echo "There was an error" 1>&2; read X; }; }'