0
0
Fork 0
mirror of https://git.sr.ht/~rabbits/uxn synced 2024-11-27 16:23:02 +00:00
uxn/projects/examples/gui/wallpaper.usm
2021-04-26 20:16:41 +01:00

63 lines
1.1 KiB
Text

( devices )
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &color $1 ]
( variables )
|0000
@scroll [ &x $2 &y $2 &wait $1 ]
|0100 ( -> )
#90ff .System/r DEO2 #9000 .System/g DEO2 #900f .System/b DEO2
#08e0 .Screen/width DEI2 #0001 SFT2 SUB2 .scroll/x POK2
#09b0 .scroll/y POK2
;frame .Screen/vector DEO2
#30 .scroll/wait POK
BRK
@frame ( -> )
#ffff
&loop
DUP2 ,row JSR
#0001 ADD2
DUP2 .Screen/height DEI2 LTH2 ,&loop JNZ
POP2
.scroll/wait PEK ,&noscroll JNZ
.scroll/y PEK2 #0001 ADD2 .scroll/y POK2
BRK
&noscroll
.scroll/wait PEK #01 SUB .scroll/wait POK
BRK
@row ( y* -- )
DUP2 .Screen/y DEO2
.scroll/y PEK2 ADD2
.Screen/width DEI2
&loop
#0001 SUB2
OVR2 OVR2 .scroll/x PEK2 ADD2 EOR2 DUP2 #0013 DIV2 #0013 MUL2 SUB2
DUP #00 EQU ,&draw JNZ
DUP #05 EQU ,&draw JNZ
POP2
&rest
DUP2 ORA ,&loop JNZ
POP2 POP2
JMP2r
#15 .Screen/color DEO
JMP2r
&draw
OVR2 .Screen/x DEO2
#05 ADD .Screen/color DEO
.Screen/y DEI2
DUP2 #0001 ADD2 .Screen/y DEO2
#00 .Screen/color DEO
.Screen/y DEO2
POP
,&rest JMP