mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-12-22 16:30:27 +00:00
(pond.tal) Starting new demo
This commit is contained in:
parent
3a901ed0be
commit
d6c14dd24d
1 changed files with 95 additions and 0 deletions
95
projects/examples/demos/pond.tal
Normal file
95
projects/examples/demos/pond.tal
Normal file
|
@ -0,0 +1,95 @@
|
|||
( pond.tal )
|
||||
|
||||
|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
|
||||
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &modx $2 &mody $2
|
||||
|
||||
|000
|
||||
|
||||
@color $1
|
||||
@circle [ &xc $2 &yc $2 &x $2 &y $2 &r $2 &d $2 ]
|
||||
|
||||
|100
|
||||
|
||||
@on-reset ( -> )
|
||||
( | theme )
|
||||
#c2c2 DUP2 .System/r DEO2
|
||||
DUP2 .System/g DEO2
|
||||
.System/b DEO2
|
||||
|
||||
;on-mouse .Mouse/vector DEO2
|
||||
BRK
|
||||
|
||||
@on-mouse ( -> )
|
||||
#c1 ;touch-chr/down ;touch-chr .Mouse/state DEI ?{ SWP2 }
|
||||
POP2 <update-cursor>
|
||||
.Mouse/state DEI ?{ BRK }
|
||||
( | touch )
|
||||
.Mouse/x DEI2 .Mouse/y DEI2 #0010 #01 draw-circle
|
||||
|
||||
BRK
|
||||
|
||||
@<update-cursor> ( color addr* -- )
|
||||
;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 16 -Screen/auto ] DEO
|
||||
[ LIT2 &x $2 ] .Screen/x DEO2
|
||||
[ LIT2 &y $2 ] .Screen/y DEO2
|
||||
.Screen/sprite DEOk DEO
|
||||
JMP2r
|
||||
|
||||
%LTS2 { #8000 ADD2 SWP2 #8000 ADD2 GTH2 }
|
||||
%GTS2 { #8000 ADD2 SWP2 #8000 ADD2 LTH2 }
|
||||
|
||||
@<draw-circle> ( xc* yc* r color -- )
|
||||
|
||||
( load ) .color STZ .circle/r STZ2 .circle/yc STZ2 .circle/xc STZ2
|
||||
#0000 .circle/x STZ2 .circle/r LDZ2 .circle/y STZ2
|
||||
.circle/r LDZ2 #10 SFT2 .circle/d STZ2
|
||||
( draw ) ;&seg JSR2
|
||||
&loop
|
||||
( incr ) .circle/x LDZ2 INC2 .circle/x STZ2
|
||||
.circle/d LDZ2 #0001 LTS2 ,&else JCN
|
||||
( decr ) .circle/y LDZ2 #0001 SUB2 .circle/y STZ2
|
||||
.circle/x LDZ2 .circle/y LDZ2 SUB2 #20 SFT2 .circle/d LDZ2 ADD2 .circle/d STZ2
|
||||
;&end JMP2
|
||||
&else
|
||||
.circle/x LDZ2 #20 SFT2 .circle/d LDZ2 ADD2 .circle/d STZ2
|
||||
&end
|
||||
( draw ) ;&seg JSR2
|
||||
.circle/y LDZ2 .circle/x LDZ2 #0001 SUB2 GTS2 ,&loop JCN
|
||||
JMP2r
|
||||
&seg
|
||||
.circle/xc LDZ2 .circle/x LDZ2 ADD2 .Screen/x DEO2 .circle/yc LDZ2 .circle/y LDZ2 ADD2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO
|
||||
.circle/xc LDZ2 .circle/x LDZ2 SUB2 .Screen/x DEO2 .circle/yc LDZ2 .circle/y LDZ2 ADD2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO
|
||||
.circle/xc LDZ2 .circle/x LDZ2 ADD2 .Screen/x DEO2 .circle/yc LDZ2 .circle/y LDZ2 SUB2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO
|
||||
.circle/xc LDZ2 .circle/x LDZ2 SUB2 .Screen/x DEO2 .circle/yc LDZ2 .circle/y LDZ2 SUB2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO
|
||||
.circle/xc LDZ2 .circle/y LDZ2 ADD2 .Screen/x DEO2 .circle/yc LDZ2 .circle/x LDZ2 ADD2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO
|
||||
.circle/xc LDZ2 .circle/y LDZ2 SUB2 .Screen/x DEO2 .circle/yc LDZ2 .circle/x LDZ2 ADD2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO
|
||||
.circle/xc LDZ2 .circle/y LDZ2 ADD2 .Screen/x DEO2 .circle/yc LDZ2 .circle/x LDZ2 SUB2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO
|
||||
.circle/xc LDZ2 .circle/y LDZ2 SUB2 .Screen/x DEO2 .circle/yc LDZ2 .circle/x LDZ2 SUB2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO
|
||||
|
||||
JMP2r
|
||||
|
||||
|
||||
@touch-chr [
|
||||
0000 0000 0814 1417 0000 0000 0008 0808
|
||||
0000 0000 0000 00c0 0000 0000 0000 0000
|
||||
1010 2010 1008 0700 0f0f 1f0f 0f07 0000
|
||||
2010 1010 2020 c000 c0e0 e0e0 c0c0 0000 ]
|
||||
&down [
|
||||
0000 0000 0000 0817 0000 0000 0000 0008
|
||||
0000 0000 0000 00c0 0000 0000 0000 0000
|
||||
1010 2010 1008 0700 0f0f 1f0f 0f07 0000
|
||||
2010 1010 2020 c000 c0e0 e0e0 c0c0 0000 ]
|
||||
|
||||
@fill-icn [
|
||||
ffff ffff ffff ffff ffff ffff ffff ffff
|
||||
ffff ffff ffff ffff ffff ffff ffff ffff ]
|
||||
|
Loading…
Reference in a new issue