From e0428951902411bb4b2cef005d4deb253b5fa643 Mon Sep 17 00:00:00 2001 From: Travis Shears Date: Wed, 2 Jul 2025 15:13:45 +0200 Subject: [PATCH] save drawing to file --- one_line.txt | Bin 0 -> 5456 bytes one_line_canvas.tal | 16 ++++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 one_line.txt diff --git a/one_line.txt b/one_line.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c94cb4e2e83463a4682f22d19835bd495228b4e GIT binary patch literal 5456 zcmeIuTMB|e00q!?qBCRpCQZX8+DJrL^dQg%wVcqNLbQbb`iP))wv9gSS;Bb^zs`H` zazFIaKIxTn=*ph-j&{TD%2}(7ouBmuPlxG9M46vEg;~&<8f&o;d-HG^ZFs^nE_oHz zVeQp!Z58dUwq|oSVPiJ#O@k!J1L+^#i*?f*(kN?XMHbpZUzrOV literal 0 HcmV?d00001 diff --git a/one_line_canvas.tal b/one_line_canvas.tal index 8b2e8d8..2c0a766 100644 --- a/one_line_canvas.tal +++ b/one_line_canvas.tal @@ -1,7 +1,9 @@ |00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1 |10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1 |20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 +|80 @Controller/vector $2 &button $1 &key $1 |90 @Mouse/vector $2 &x $2 &y $2 &state $5 &scrolly &scrolly-hb $1 &scrolly-lb $1 +|a0 @File/vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 @@ -33,6 +35,13 @@ ( set pxs-pt to start of pixels ) ;pxs ;pxs-pt STA2 ;on-mouse .Mouse/vector DEO2 + ;on-controller .Controller/vector DEO2 + BRK + +@on-controller + .Controller/key DEI + ( if "e" key is pressed ) + #65 EQU ?write-drawing-file-to-disk BRK @add-px-to-drawing @@ -79,6 +88,13 @@ &end JMP2r +@write-drawing-file-to-disk + ;/filename .File/name DEO2 + #1550 .File/length DEO2 + ;pxs .File/write DEO2 + JMP2r + &filename "one_line.txt $1 + @on-mouse ( -> ) .Mouse/x DEI2 .x STZ2 .Mouse/y DEI2 .y STZ2