diff options
author | epoch <epoch@hacking.allowed.org> | 2020-10-11 01:55:42 -0500 |
---|---|---|
committer | epoch <epoch@hacking.allowed.org> | 2020-10-11 01:55:42 -0500 |
commit | 91e1d05c3f73db1662b58e7387a017dd3b0d011d (patch) | |
tree | 308a95d1762688341b1b6197af492794810c8393 /share/hackvr | |
parent | 82b8d669d684952b7cb5b697197fed47ccdb6d72 (diff) | |
parent | fe9ad894000ff986cd642d23ac4762e97d5b1ccc (diff) | |
download | hackvr-91e1d05c3f73db1662b58e7387a017dd3b0d011d.tar.gz hackvr-91e1d05c3f73db1662b58e7387a017dd3b0d011d.zip |
Merge branch 'master' of ssh://21.41.41.1/hackvr into master
Diffstat (limited to 'share/hackvr')
-rwxr-xr-x | share/hackvr/examples/draw/draw.sh | 50 | ||||
-rwxr-xr-x | share/hackvr/examples/dungen/dunexplore.sh | 8 | ||||
-rwxr-xr-x | share/hackvr/examples/tictactoe/game.sh | 2 |
3 files changed, 39 insertions, 21 deletions
diff --git a/share/hackvr/examples/draw/draw.sh b/share/hackvr/examples/draw/draw.sh index 69589b2..e18a8b4 100755 --- a/share/hackvr/examples/draw/draw.sh +++ b/share/hackvr/examples/draw/draw.sh @@ -1,36 +1,48 @@ #!/usr/bin/env bash -echo "$USER move 0 0 -100" +echo "$USER move 5 7 -19" -for y in $(seq 1 1 48);do - for x in $(seq 1 1 48);do - echo ${x}_${y} addshape 2 4 $x $y 0 $[x] $[y+1] 0 $[x+1] $[y+1] 0 $[x+1] $[y] 0 +for y in $(seq 0 1 15);do + for x in $(seq 0 1 15);do + echo cell_${x}_${y} addshape 2 4 -.5 -.5 0 -.5 .5 0 .5 .5 0 .5 -.5 0 + #echo cell_${x}_${y} addshape 2 4 $x $y 0 $[x] $[y+1] 0 $[x+1] $[y+1] 0 $[x+1] $[y] 0 + echo cell_${x}_${y} move $x $y 0 done done ### color pallete -### 0-8 are ansi colors. +16 to make them not affected by "lighting" -for c in $(seq 0 8);do - echo color_${c} addshape $[c+16] 4 -2 ${c+2} 0 -1 ${c+2} 0 -1 $[c+3] 0 -2 $[c+3] 0 +### 0-8 are ansi colors. +for c in $(seq 0 16);do + echo color_${c} addshape $[c] 4 $[-2 - ($c / 8)] $[($c%8)+3] 0 $[-1 - ($c / 8)] $[($c%8)+3] 0 $[-1 - ($c / 8)] $[($c%8)+4] 0 $[-2 - ($c / 8)] $[($c%8)+4] 0 done -echo "derp" >&2 +#cat ${PREFIX}/share/hackvr/meshes/floppy.hackvr | grep '^[^ #]' | sed 's/^[^ ][^ ]*/save/g' +#echo save move -5 0 0 -color=3 -echo color_${color} addshape $[color+16] 4 -2 0 0 -2 1 0 -1 1 0 -1 0 0 - -while read source command target;do - printf "target: %s command: %s\n" "$target" "$command" >&2 +tee /dev/stderr | while read -r source command target;do if [ "$command" = "action" ];then + if echo "$target" | grep "^save" 2>&1 >/dev/null;then + echo "$USER export *" + date=$(date +%s) + echo "$USER ping $date" + while read -r line;do + if [ "$line" = "${USER} pong ${date}" ];then + break + else + printf "%s\n" "$line" >> ~/drawsave.hackvr + fi + done + fi if echo "$target" | grep "^color_" 2>&1 >/dev/null;then color=$(echo $target | cut -d_ -f2) echo deletegroup $target - echo color_${color}_current addshape $[color+16] 4 -2 -2 0 -2 -1 0 -1 -1 0 -1 -2 0 - else - echo "derp" >&2 - x=$(echo $target | cut -d_ -f1) - y=$(echo $target | cut -d_ -f2) + echo color_${color}_current addshape $[$color] 4 -2 0 0 -2 1 0 -1 1 0 -1 0 0 + elif echo "$target" | grep '^cell_' 2>&1 >/dev/null;then + x=$(echo $target | cut -d_ -f2) + y=$(echo $target | cut -d_ -f3) echo $target deletegroup $target - echo $target addshape $[color + 16] 4 $x $y 0 $x $[y+1] 0 $[x+1] $[y+1] 0 $[x+1] $y 0 | tee /dev/stderr + #echo $target addshape $[$color] 4 $x $y 0 $x $[y+1] 0 $[x+1] $[y+1] 0 $[x+1] $y 0 | tee /dev/stderr + echo $target addshape $[$color] 4 -.5 -.5 0 -.5 .5 0 .5 .5 0 .5 -.5 0 + printf "%s move %d %d 0" "$target" "$x" "$y" fi fi done diff --git a/share/hackvr/examples/dungen/dunexplore.sh b/share/hackvr/examples/dungen/dunexplore.sh index 6f71391..6fbd5c3 100755 --- a/share/hackvr/examples/dungen/dunexplore.sh +++ b/share/hackvr/examples/dungen/dunexplore.sh @@ -2,7 +2,13 @@ ### run me with hackvr_coproc #the $USER triangle we add first is to give us some sort of avatar to see where the camera is. #seed=1337 -echo $USER addshape 4 3 -1 0 -1 0 0 2 1 0 -1 ; echo $USER move 0 2 0 +red=1 +green=2 +blue=4 +echo $USER addshape 6 3 -1 0 -1 0 0 2 1 0 -1 ; echo $USER move 0 2 0 +echo world-x addshape $red 2 0 0 0 1 0 0 +echo world-y addshape $green 2 0 0 0 0 1 0 +echo world-z addshape $blue 2 0 0 0 0 0 1 ./dungen $seed | ./dun2hackvr while read group action target;do if [ "$action" = "action" ];then diff --git a/share/hackvr/examples/tictactoe/game.sh b/share/hackvr/examples/tictactoe/game.sh index 92192cc..a2adeb1 100755 --- a/share/hackvr/examples/tictactoe/game.sh +++ b/share/hackvr/examples/tictactoe/game.sh @@ -31,7 +31,7 @@ grep --line-buffered action \ cat "marker$turn" | offsetshape.sh $translatex "$(expr "$translatey" - 2 )" 0 grep "$group" $BOARDFILE | sed "s/$group/_marked/g" else - xmessage "what? $group" + printf "# clicked outside of the game board.\n" >&2 fi fi done |