diff options
author | epoch <epoch@hacking.allowed.org> | 2019-05-18 02:27:35 -0500 |
---|---|---|
committer | epoch <epoch@hacking.allowed.org> | 2019-05-18 02:27:35 -0500 |
commit | 85eafd1ea7ad12a983f99fd9c9c8affcec8d43aa (patch) | |
tree | 8edce2761c3f096a91543e306adf078c42049043 /share/hackvr/examples/wordsearch | |
parent | 750473faa49be1a3490d8336190ee920014d8169 (diff) | |
download | hackvr-85eafd1ea7ad12a983f99fd9c9c8affcec8d43aa.tar.gz hackvr-85eafd1ea7ad12a983f99fd9c9c8affcec8d43aa.zip |
renamed Makefile to GNUmakefile because I use GNU specific stuff
Diffstat (limited to 'share/hackvr/examples/wordsearch')
-rwxr-xr-x | share/hackvr/examples/wordsearch/game.sh | 37 | ||||
-rwxr-xr-x | share/hackvr/examples/wordsearch/run | 8 |
2 files changed, 45 insertions, 0 deletions
diff --git a/share/hackvr/examples/wordsearch/game.sh b/share/hackvr/examples/wordsearch/game.sh new file mode 100755 index 0000000..0505760 --- /dev/null +++ b/share/hackvr/examples/wordsearch/game.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +## you might want to edit these to suit your tastes. +width=10 +height=$width +words_per_puzzle=$[width+2] +x=$[-10 * $width / 2] +y=$[10 * $width / 2] +z=0 +clicked="" +wordlist=/usr/share/dict/words +echo derp +wordsearch -w <(shuf $wordlist | grep '^.\{1,'"$width"'\}$' | head -n $words_per_puzzle | tee /dev/stderr) --columns $width --rows $height --text | tail -n+4 | head -n $height | while read -r line;do + echo "$line" | tr -d ' ' | fold -w 1 | while read letter;do + name="_${x}_${y}" + printf "%s addshape 2 4 %s %s %s %s %s %s %s %s %s %s %s %s\n" \ + "$name" \ + $[$x-2] $[$y-3] $z \ + $[$x+8] $[$y-3] $z \ + $[$x+8] $[$y+7] $z \ + $[$x-2] $[$y+7] $z + echo $letter | makelabel.sh "$name" $x $y $z + x=$[$x+10] + done + y=$[$y-10] +done +while read group action args;do + if [ $action = action ];then + if grep "$args" <<< "$clicked" 2>&1 >/dev/null;then + clicked=$(grep -v '^'"$args"'$' <<< "$clicked") + printf "%s move 0 0 0\n" "$args" + else + clicked="$clicked"$'\n'"$args" + printf "%s move 0 0 -5\n" "$args" + fi +# xmessage -nearmouse "$args" + fi +done diff --git a/share/hackvr/examples/wordsearch/run b/share/hackvr/examples/wordsearch/run new file mode 100755 index 0000000..48d107c --- /dev/null +++ b/share/hackvr/examples/wordsearch/run @@ -0,0 +1,8 @@ +#!/bin/sh +# just need to get some way for these to coproc +if ! which wordsearch >/dev/null;then + echo "we need wordsearch installed to generate the puzzle" + echo "please read: https://github.com/jamis/wordsearch" + exit 1 +fi +socat exec:hackvr exec:./game.sh |