Added sketch erase

This commit is contained in:
Devine Lu Linvega 2024-05-29 09:56:31 -07:00
parent 1bebf69c68
commit 5aa87d7f8d
1 changed files with 25 additions and 20 deletions

View File

@ -18,9 +18,9 @@
( | meta ) ( | meta )
;meta #06 DEO2 ;meta #06 DEO2
( | theme ) ( | theme )
#f08f .System/r DEO2 #f00f .System/r DEO2
#f08f .System/g DEO2 #f00f .System/g DEO2
#f08f .System/b DEO2 #f00f .System/b DEO2
load-theme load-theme
( | size ) ( | size )
#00e0 .Screen/width DEO2 #00e0 .Screen/width DEO2
@ -74,12 +74,10 @@
POP POP
( | key ) ( | key )
DUP #1b NEQ ?{ toggle-sketch POP BRK } DUP #1b NEQ ?{ toggle-sketch POP BRK }
DUP #08 NEQ ?{ DUP #08 NEQ ?{ .selection/sketch LDZ ?{ erase }
.selection/sketch LDZ ?{ erase-sketch POP BRK } erase-sketch POP BRK }
erase } DUP #7f NEQ ?{ .selection/sketch LDZ ?{ delete }
DUP #7f NEQ ?{ erase-sketch POP BRK }
.selection/sketch LDZ ?{ erase-sketch POP BRK }
delete }
DUP #09 LTH ?{ DUP insert } DUP #09 LTH ?{ DUP insert }
POP BRK POP BRK
@ -119,20 +117,25 @@
@on-mouse-sketch ( -> ) @on-mouse-sketch ( -> )
[ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;mouse-icn <update-cursor> [ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;mouse-icn <update-cursor>
( | handle states ) ( | handle states )
[ LIT &last $1 ] .Mouse/state DEI [ LIT &last $1 ] .Mouse/state DEI DUP ,&last STR
( ) DUP #02 LTH ?{ ( ) DUP2 #0100 NEQ2 ?{ file-save }
( erase ) } ( ) DUP2 #0200 NEQ2 ?{ file-save }
DUP2 #0001 NEQ2 ?{ DUP2 #0200 NEQ2 ?{
.Mouse/x DEI2 ,&x1 STR2 ( from ) ,&x1 LDR2 ,&y1 LDR2
.Mouse/y DEI2 #0012 SUB2 ,&y1 STR2 } ( to ) .Mouse/x DEI2 .Mouse/y DEI2 #0012 SUB2
( paint ) #01 <paint-line>
<draw-sketch> }
DUP2 #00 NEQ #0001 NEQ2 ?{
.Mouse/x DEI2 DUP2 ,&x1 STR2
.Mouse/y DEI2 #0012 SUB2 DUP2 ,&y1 STR2
#01 set-pixel <draw-sketch> }
DUP2 #0101 NEQ2 ?{ DUP2 #0101 NEQ2 ?{
( from* ) [ LIT2 &x1 $2 ] [ LIT2 &y1 $2 ] ( from* ) [ LIT2 &x1 $2 ] [ LIT2 &y1 $2 ]
( to ) .Mouse/x DEI2 DUP2 ,&x1 STR2 ( to ) .Mouse/x DEI2 DUP2 ,&x1 STR2
.Mouse/y DEI2 #0012 SUB2 DUP2 ,&y1 STR2 .Mouse/y DEI2 #0012 SUB2 DUP2 ,&y1 STR2
( paint ) #01 <paint-line> ( paint ) #01 <paint-line>
<draw-sketch> } <draw-sketch> }
,&last STR POP2 BRK
POP BRK
@on-mouse-foot ( -> ) @on-mouse-foot ( -> )
[ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;mouse-icn <update-cursor> [ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;mouse-icn <update-cursor>
@ -195,7 +198,9 @@
JMP2r JMP2r
@erase-sketch ( -- ) @erase-sketch ( -- )
;&mcpy .System/expansion DEO2
!<redraw>
&mcpy [ 00 1500 0000 =sketch 00 ]
@get-row ( x* y* -- row* ) @get-row ( x* y* -- row* )
STH2k #03 SFT2 SWP2 #03 SFT2 SWP2 #001c MUL2 ADD2 #30 SFT2 STH2r #0007 AND2 ADD2 ;sketch ADD2 JMP2r STH2k #03 SFT2 SWP2 #03 SFT2 SWP2 #001c MUL2 ADD2 #30 SFT2 STH2r #0007 AND2 ADD2 ;sketch ADD2 JMP2r
@ -327,7 +332,7 @@
;notepad-path file-size #0000 EQU2 ?file-new ;notepad-path file-size #0000 EQU2 ?file-new
( | load file ) ( | load file )
;notepad-path .File/name DEO2 ;notepad-path .File/name DEO2
#8000 .File/length DEO2 #9500 .File/length DEO2
;mem .File/read DEO2 ;mem .File/read DEO2
JMP2r JMP2r
@ -343,7 +348,7 @@
@file-save ( -- ) @file-save ( -- )
;notepad-path .File/name DEO2 ;notepad-path .File/name DEO2
#8000 .File/length DEO2 #9500 .File/length DEO2
;mem .File/write DEO2 ;mem .File/write DEO2
JMP2r JMP2r