0
0
Fork 0
mirror of https://git.sr.ht/~rabbits/uxn synced 2024-12-03 02:57:25 +00:00
uxn/projects/examples/demos/dvd.tal

57 lines
1.4 KiB
Tal
Raw Normal View History

2022-03-14 16:55:31 +00:00
( DVD Bounce )
2021-05-24 21:36:15 +00:00
2022-03-25 16:49:51 +00:00
|00 @System &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
2021-04-21 19:00:31 +00:00
|0000
2021-04-21 19:00:31 +00:00
2023-09-29 18:01:13 +00:00
@dvd &x $2 &y $2
2021-04-21 19:00:31 +00:00
2023-09-29 18:01:13 +00:00
|0100
2023-09-29 18:01:13 +00:00
@on-reset ( -> )
( | theme )
2022-03-25 16:49:51 +00:00
#4cfd .System/r DEO2
#4cf3 .System/g DEO2
#dcf2 .System/b DEO2
2023-09-29 18:01:13 +00:00
( | vectors )
;on-frame .Screen/vector DEO2
2023-09-29 18:01:13 +00:00
( | starting position )
2022-03-14 16:55:31 +00:00
.Screen/width DEI2 #01 SFT2 .dvd/x STZ2
.Screen/height DEI2 #01 SFT2 .dvd/y STZ2
2023-09-29 18:01:13 +00:00
( | set collisions )
2022-03-25 16:49:51 +00:00
.Screen/width DEI2 #0020 SUB2 ;on-frame/hit-hor STA2
.Screen/height DEI2 #0010 SUB2 ;on-frame/hit-ver STA2
2023-09-29 18:01:13 +00:00
( | drawing mode )
[ LIT2 36 -Screen/auto ] DEO
2023-09-29 18:01:13 +00:00
#01 draw-dvd BRK
2021-04-21 19:00:31 +00:00
@on-frame ( -> )
#00 draw-dvd
2023-09-29 18:01:13 +00:00
( | x )
2022-03-25 16:49:51 +00:00
.dvd/x LDZ2
2023-12-18 22:44:36 +00:00
( left ) ORAk ?{ #0001 ,&x STR2 }
2023-09-29 18:01:13 +00:00
( right ) DUP2 [ LIT2 &hit-hor $2 ] NEQ2 ?{ #ffff ,&x STR2 }
[ LIT2 &x 0001 ] ADD2 .dvd/x STZ2
( | y )
2022-03-25 16:49:51 +00:00
.dvd/y LDZ2
2023-12-18 22:44:36 +00:00
( top ) ORAk ?{ #0001 ,&y STR2 }
2023-09-29 18:01:13 +00:00
( bottom ) DUP2 [ LIT2 &hit-ver $2 ] NEQ2 ?{ #ffff ,&y STR2 }
[ LIT2 &y 0001 ] ADD2 .dvd/y STZ2
#01 draw-dvd BRK
2021-04-21 19:00:31 +00:00
@draw-dvd ( color -- )
2023-09-29 18:01:13 +00:00
;dvd-icn .Screen/addr DEO2
2022-01-09 21:07:48 +00:00
.dvd/x LDZ2 .Screen/x DEO2
.dvd/y LDZ2 .Screen/y DEO2
2023-12-18 22:44:36 +00:00
.Screen/sprite DEOk DEO
2023-09-29 18:01:13 +00:00
JMP2r
2021-04-21 19:00:31 +00:00
2023-09-29 18:01:13 +00:00
@dvd-icn ( 4 x 2 )
[
2021-04-21 19:00:31 +00:00
001f 3f38 3838 787f 00fe fe7e 7777 e3c3
000f 1f3b 7b77 e7c7 00fc fe8f 8707 0efc
7f00 000f ff7f 0700 0301 00ff f0f8 ff00
8700 00ff 7f7f ff00 f000 00e0 fcfc 8000 ]