Improved repaint

This commit is contained in:
Devine Lu Linvega 2024-07-24 11:30:30 -07:00
parent 42882d1fe5
commit 0c7a4fd713
1 changed files with 84 additions and 46 deletions

View File

@ -3,7 +3,7 @@
|00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $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 $1 &chord $1 &pad $4 &scrolly &scrolly-hb $1 &scrolly-lb $1
|90 @Mouse &vector $2 &x $2 &y $1 &ylb $1 &state $1 &chord $1 &pad $4 &scrolly &scrolly-hb $1 &scrolly-lb $1
|c0 @DateTime &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1
|000
@ -12,6 +12,7 @@
@bar &height $1
@remaining-seconds $2
@last-second $1
@height $2
|100
@ -19,21 +20,21 @@
( | meta )
;meta #06 DEO2
( | theme )
#05ff .System/r DEO2
#0bdf .System/g DEO2
#0abf .System/b DEO2
#b0ff .System/r DEO2
#f0df .System/g DEO2
#c0bf .System/b DEO2
( | vector )
;on-frame .Screen/vector DEO2
;on-mouse .Mouse/vector DEO2
( | screen size )
#0048 .Screen/width DEO2
#0100 .Screen/height DEO2
#0248 .Screen/width DEO2
#0110 .Screen/height DEO2
.DateTime/second DEI .last-second STZ
<draw-border>
<draw-bar>
<redraw>
BRK
@on-frame ( -> )
BRK
.Mouse/state DEI ?{
.remaining-seconds LDZ2 #0000 EQU2 ?{
.DateTime/second DEI DUP .last-second LDZ EQU ?{
@ -46,26 +47,11 @@
BRK
@on-mouse ( -> )
( | clear old cursor )
.cursor/x LDZ2 .Screen/x DEO2
.cursor/y LDZ2 .Screen/y DEO2
#00 .Screen/auto DEO
#40 .Screen/sprite DEO
( | draw cursor )
.Mouse/x DEI2 DUP2 .cursor/x STZ2
.Screen/x DEO2
.Mouse/y DEI2 DUP2 .cursor/y STZ2
.Screen/y DEO2
;arrow-icn .Screen/addr DEO2
#42 .Screen/sprite DEO
.Mouse/state DEI #00 EQU ?{
.Mouse/y DEI2 NIP #08 SUB DUP #f0 GTH ?{
#f0 OVRk SUB DUP .bar/height STZ
#00 SWP #0007 MUL2
( very rough! should be 7.5 ) .remaining-seconds STZ2
<draw-bar> }
POP }
BRK
#4100 [ LIT2 00 -Mouse/state ] DEI NEQ #30 SFT2 ;hand-icn ADD2 <update-cursor>
.Mouse/state DEI ?{ BRK }
( | down )
.Mouse/ylb DEI #10 SUB DUP #f0 GTH ?{ #00 OVR <set-distance> }
POP BRK
@meta 00
( name ) "Tea 20 "Timer 0a
@ -74,28 +60,46 @@
( date ) "12 20 "Jan 20 "2024 $1
( elements ) 00
(
@|core )
@<set-distance> ( distance* -- )
DUP2 .height EQU2k ?{
STZ2
#0007 MUL2 .remaining-seconds STZ2 !<redraw-bar> }
POP2 POP2 JMP2r
(
@|drawing )
@<redraw> ( -- )
( <draw-border> <draw-bar> ) JMP2r
@<redraw-bar> ( -- )
;fill-icn .Screen/addr DEO2
( | top )
#0010 .Screen/x DEO2
#0010 .Screen/y DEO2
[ LIT2 f1 -Screen/auto ] DEO
[ LIT2 03 -Screen/sprite ] DEOk DEOk DEOk DEO
( | bottom )
#0010 .Screen/x DEO2
#0090 .Screen/y DEO2
[ LIT2 d1 -Screen/auto ] DEO
[ LIT2 03 -Screen/sprite ] DEOk DEOk DEOk DEO
( >> )
@<draw-bar> ( -- )
#0008 DUP2 .Screen/x DEO2
.Screen/y DEO2
;fill-icn .Screen/addr DEO2
#32 .Screen/auto DEO
.bar/height LDZ #f0 OVRk SUB
&>w ( -- )
DUP #08 LTH ?{
#01 .Screen/sprite DEO
#08 SUB !&>w }
DUP #00 EQU ?{
( partial row ) DUP #00 SWP ;fill-icn SWP2 SUB2 .Screen/addr DEO2
#07 .Screen/sprite DEO }
POP #00f8 .Screen/y DEI2 NEQ2 ?{ JMP2r }
;fill-icn .Screen/addr DEO2
&>w2 ( -- )
#03 .Screen/sprite DEO
.Screen/y DEI2 #00f8 NEQ2 ?&>w2
POP JMP2r
#0010 .Screen/x DEO2
( | all )
[ LIT2 32 -Screen/auto ] DEO
;line-icn .Screen/addr DEO2
[ LIT2r 05 -Screen/sprite ] .height LDZ2 #0010 ADD2 #0010
&>l ( -- )
DUP2 .Screen/y DEO2
DEOkr
INC2 GTH2k ?&>l
POP2 POP2 POP2r JMP2r
@<draw-border> ( -- )
#0000 DUP2 .Screen/x DEO2
@ -127,9 +131,41 @@
INC GTHk ?&>w2
JMP2r
@<update-cursor> ( color addr* -- )
[ LIT2 00 -Screen/auto ] DEO
;fill-icn .Screen/addr DEO2
#40 <draw-cursor>
.Screen/addr DEO2
.Mouse/x DEI2 ,<draw-cursor>/x STR2
.Mouse/y DEI2 ,<draw-cursor>/y STR2
( >> )
@<draw-cursor> ( color -- )
[ LIT2 &x $2 ] .Screen/x DEO2
[ LIT2 &y $2 ] .Screen/y DEO2
.Screen/sprite DEO
JMP2r
(
@|stdlib )
@<phex> ( short* -: )
SWP /b
&b ( byte -: )
DUP #04 SFT /c
&c ( byte -: )
#0f AND DUP #09 GTH #27 MUL ADD [ LIT "0 ] ADD #18 DEO
JMP2r
(
@|assets )
@pointer-icn [ 80c0 e0f0 f8e0 1000 ]
&drag [ c381 0000 0000 81c3 ]
@hand-icn [ 4040 787c fcfc 7c38 ]
&down [ 0000 787c fcfc 7c38 ]
@arrow-icn [ 80c0 e0f0 f8fc f0c0 ]
@tick-icn [ f000 0000 0000 0000 ]
@ -138,6 +174,8 @@
@fill-icn [ ffff ffff ffff ffff ]
@line-icn [ ff00 0000 0000 0000 ]
@digits ( Emmaline by damieng )
[
0000 0000 0000 0000 3864 e2e2 e264 3800