From d466fdec7bf96eb6c4c57378b1bf03982897c89f Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Wed, 29 May 2024 09:09:20 -0700 Subject: [PATCH] Drawing primitives --- ...untitled10x10.chr => spritesheet10x10.chr} | Bin gui/notepad/src/notepad.tal | 39 ++++++++++++++++-- gui/notepad/untitled43x24.icn | Bin 5376 -> 0 bytes 3 files changed, 35 insertions(+), 4 deletions(-) rename gui/notepad/{untitled10x10.chr => spritesheet10x10.chr} (100%) delete mode 100644 gui/notepad/untitled43x24.icn diff --git a/gui/notepad/untitled10x10.chr b/gui/notepad/spritesheet10x10.chr similarity index 100% rename from gui/notepad/untitled10x10.chr rename to gui/notepad/spritesheet10x10.chr diff --git a/gui/notepad/src/notepad.tal b/gui/notepad/src/notepad.tal index 37786f0..409f7f8 100644 --- a/gui/notepad/src/notepad.tal +++ b/gui/notepad/src/notepad.tal @@ -10,7 +10,7 @@ @page $1 @collapsed $1 - @selection &a $2 &b $2 &length $2 + @selection &a $2 &b $2 &length $2 &sketch $1 |100 @@ -18,9 +18,9 @@ ( | meta ) ;meta #06 DEO2 ( | theme ) - #f0cf .System/r DEO2 - #f0cf .System/g DEO2 - #f0cf .System/b DEO2 + #f0ff .System/r DEO2 + #f00f .System/g DEO2 + #f00f .System/b DEO2 load-theme ( | size ) #00e0 .Screen/width DEO2 @@ -31,6 +31,7 @@ ;on-frame .Screen/vector DEO2 ;on-control .Controller/vector DEO2 ( | let's go! ) + #01 .selection/sketch STZ file-init #00 change-page BRK @@ -100,6 +101,7 @@ &unchanged BRK @on-mouse-body ( -> ) + .selection/sketch LDZ ?on-mouse-body-draw [ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;caret-icn [ LIT &last $1 ] .Mouse/state DEI DUP #02 LTH ?{ @@ -110,6 +112,11 @@ ,&last STR POP BRK +@on-mouse-body-draw ( -> ) + [ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;mouse-icn + .Mouse/x DEI2 .Mouse/y DEI2 #0012 SUB2 #01 set-pixel + BRK + @on-mouse-foot ( -> ) [ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;mouse-icn @@ -432,6 +439,30 @@ INC2 GTH2k ?&>l &end NIP2 JMP2r +( +@|sketch ) + +@get-row ( x* y* -- row* ) + STH2k #03 SFT2 SWP2 #03 SFT2 SWP2 #001c MUL2 ADD2 #30 SFT2 STH2r #0007 AND2 ADD2 ;sketch ADD2 JMP2r + +@set-pixel ( x* y* color -- ) + ?add-pixel + ( >> ) + +@remove-pixel ( x* y* -- ) + ( keep x* ) OVR2 NIP #07 AND STH + ( get byte ) get-row LDAk + ( mask ) #0107 STHr SUB #40 SFT SFT #ff EOR AND + ( save ) ROT ROT STA + JMP2r + +@add-pixel ( x* y* -- ) + ( keep x* ) OVR2 NIP #07 AND STH + ( get byte ) get-row LDAk + ( mask ) #0107 STHr SUB #40 SFT SFT ORA + ( save ) ROT ROT STA + JMP2r + ( @|drawing ) diff --git a/gui/notepad/untitled43x24.icn b/gui/notepad/untitled43x24.icn deleted file mode 100644 index 3a7e50d5dfc1b1a0eab537de902b9bb66e38d9d4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5376 zcmeHJu};G<5cS!vW1$K%GDO9n(2)TNe@Z@rfq~&hMn0jR;(-t8CoqD9C}+E_LX;?^ zgth{|A&$>?=X-bO#EfO+4CD;_qYMCWF6*a9EhUG)##?G#5)8nO8d_`0)8eUS+jwwn zT*g?7gk-06qljotk{@f79-Q;KYzF2A;<|N=3I-d-uqSXsMJ2AXXZc`a?&Bn+4NG05 z*SAGYuW`PMZ0RU2RNTLCV%Ousz6