diff options
Diffstat (limited to 'experiments')
-rwxr-xr-x | experiments/draw/fill | 28 | ||||
-rw-r--r-- | experiments/draw/lib.sh | 48 | ||||
-rwxr-xr-x | experiments/draw/sequence | 31 | ||||
-rwxr-xr-x | experiments/pixel-sequence/draw | 59 |
4 files changed, 107 insertions, 59 deletions
diff --git a/experiments/draw/fill b/experiments/draw/fill new file mode 100755 index 0000000..c0278f3 --- /dev/null +++ b/experiments/draw/fill @@ -0,0 +1,28 @@ +#!/bin/sh +cd "$(dirname "$0")" +. ./lib.sh + +msg_clear +pen +big + +bottom_screen 24 34 + +xdotool mousedown 1 +sleep 0.02 +xdotool mousemove_relative -- 0 -18 +sleep 0.02 + +for line in $(seq 22) ; do + xdotool mousemove_relative -- 230 0 + sleep 0.02 + xdotool mousemove_relative -- 0 2 + sleep 0.02 + xdotool mousemove_relative -- -230 0 + sleep 0.02 + xdotool mousemove_relative -- 0 2 + sleep 0.02 +done + +xdotool mouseup 1 + diff --git a/experiments/draw/lib.sh b/experiments/draw/lib.sh new file mode 100644 index 0000000..90e5689 --- /dev/null +++ b/experiments/draw/lib.sh @@ -0,0 +1,48 @@ +WINDOW="$(xdotool search --onlyvisible --maxdepth 2 --class melonDS | head -n1)" +[ -z "$WINDOW" ] && exit 1 + +eval "$(xdotool getwindowgeometry --shell "$WINDOW")" + +sleep 0.5 + +bottom_screen() { + xdotool mousemove $X $Y + # skip menu bar + xdotool mousemove_relative 0 20 + # skip top screen + xdotool mousemove_relative 0 192 + + xdotool mousemove_relative -- $1 $2 +} + +tap() { + xdotool mousedown 1 + sleep 0.02 + xdotool mouseup 1 + sleep 0.02 +} + +eraser() { + bottom_screen 8 60 + tap +} + +pen() { + bottom_screen 8 44 + tap +} + +small() { + bottom_screen 8 92 + tap +} + +big() { + bottom_screen 8 76 + tap +} + +msg_clear() { + bottom_screen 240 170 + tap +} diff --git a/experiments/draw/sequence b/experiments/draw/sequence new file mode 100755 index 0000000..6000fed --- /dev/null +++ b/experiments/draw/sequence @@ -0,0 +1,31 @@ +#!/bin/sh +cd "$(dirname "$0")" +. ./lib.sh + +pattern=' +10101010 +1100110011001100 +11110000111100001111000011110000 +1111111100000000111111110000000011111111000000001111111100000000 +' +pattern="$(echo "$pattern" | tr -d '\n')" +length="$(echo "$pattern" | wc -c)" +pattern="$(echo "$pattern" | sed 's/./\0 /g')" + +msg_clear +pen +small + +# message top left +bottom_screen 82 18 + +for pixel in $pattern ; do + # shift mouse 1 pixel right + xdotool mousemove_relative 1 0 + + # skip 0's in $pattern + [ $pixel -ne 1 ] && continue + + tap +done + diff --git a/experiments/pixel-sequence/draw b/experiments/pixel-sequence/draw deleted file mode 100755 index 3561865..0000000 --- a/experiments/pixel-sequence/draw +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/sh - -WINDOW="$(xdotool search --onlyvisible --maxdepth 2 --class melonDS | head -n1)" -[ -z "$WINDOW" ] && exit 1 - -eval "$(xdotool getwindowgeometry --shell "$WINDOW")" - -sleep 0.5 - -bottom_screen() { - xdotool mousemove $X $Y - # skip menu bar - xdotool mousemove_relative 0 20 - # skip top screen - xdotool mousemove_relative 0 192 - - xdotool mousemove_relative -- $1 $2 -} -tap() { - xdotool mousedown 1 - sleep 0.02 - xdotool mouseup 1 - sleep 0.02 -} - -pattern=' -10101010 -1100110011001100 -11110000111100001111000011110000 -1111111100000000111111110000000011111111000000001111111100000000 -' -pattern="$(echo "$pattern" | tr -d '\n')" -length="$(echo "$pattern" | wc -c)" -pattern="$(echo "$pattern" | sed 's/./\0 /g')" - -# clear -bottom_screen 240 170 -tap - -# pen -bottom_screen 8 44 -tap -# small -bottom_screen 8 92 -tap - -# message top left -bottom_screen 82 18 - -for pixel in $pattern ; do - # shift mouse 1 pixel right - xdotool mousemove_relative 1 0 - - # skip 0's in $pattern - [ $pixel -ne 1 ] && continue - - tap -done - |