0
0
Fork 0
mirror of https://git.sr.ht/~rabbits/uxn synced 2024-11-05 22:05:04 +00:00
uxn/projects/examples/devices/screen.blending.tal
2023-07-26 09:57:36 -07:00

65 lines
1.6 KiB
Tal

( screen blending modes )
|00 @System &catch $2 &expansion $2 &pad $2 &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
|0100
@on-reset ( -> )
( | theme )
#f07f .System/r DEO2
#f0d6 .System/g DEO2
#f0b2 .System/b DEO2
( | size )
#0080 .Screen/width DEO2
#008c .Screen/height DEO2
( | background )
#f2 .Screen/auto DEO
;check-icn .Screen/addr DEO2
#ee &times #02 .Screen/sprite DEO
INC DUP ?&times
POP
( | circles )
#1000
&l ( -- )
#00 OVR #03 AND #50 SFT2 #0008 ADD2 .Screen/x DEO2
#00 OVR #02 SFT #50 SFT2 #0008 ADD2 .Screen/y DEO2
DUP #80 ORA <draw-circle>
INC GTHk ?&l
POP2 BRK
@<draw-circle> ( color -- )
#01 .Screen/auto DEO
;circle-chr .Screen/addr DEO2
DUP .Screen/sprite DEO
DUP #10 ORA .Screen/sprite DEO
.Screen/x DEI2k #0010 SUB2 ROT DEO2
.Screen/y DEI2k #0008 ADD2 ROT DEO2
DUP #20 ORA .Screen/sprite DEO
DUP #30 ORA .Screen/sprite DEO
@<draw-hex> ( color -- )
.Screen/x DEI2k #000c SUB2 ROT DEO2
.Screen/y DEI2k #000c ADD2 ROT DEO2
#00 SWP #30 SFT ;font-icn ADD2 .Screen/addr DEO2
#05 .Screen/sprite DEO
JMP2r
@check-icn
[ 0306 0c18 3060 c081 ]
@circle-chr
[
071f 3c70 60e3 c7c7 0000 030f 1f1f 3f3f ]
@font-icn ( 0-f )
[
007c 8282 8282 827c 0030 1010 1010 1010
007c 8202 7c80 80fe 007c 8202 1c02 827c
000c 1424 4484 fe04 00fe 8080 7c02 827c
007c 8280 fc82 827c 007c 8202 1e02 0202
007c 8282 7c82 827c 007c 8282 7e02 827c
007c 8202 7e82 827e 00fc 8282 fc82 82fc
007c 8280 8080 827c 00fc 8282 8282 82fc
007c 8280 f080 827c 007c 8280 f080 8080 ]