mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-11-01 12:02:39 +00:00
88 lines
1.9 KiB
Text
88 lines
1.9 KiB
Text
( dev/controller/buttons )
|
|
|
|
%++ { #0001 ADD2 }
|
|
%-- { #0001 SUB2 }
|
|
|
|
( 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 ]
|
|
|80 @Controller [ &vector $2 &button $1 &key $1 ]
|
|
|
|
( variables )
|
|
|
|
|0000
|
|
|
|
@slime $1
|
|
|
|
( init )
|
|
|
|
|0100 ( -> )
|
|
|
|
( theme )
|
|
#0daf .System/r DEO2
|
|
#02ff .System/g DEO2
|
|
#035f .System/b DEO2
|
|
|
|
( vectors )
|
|
;on-frame .Screen/vector DEO2
|
|
|
|
( set origin )
|
|
.Screen/width DEI2 #0002 DIV2 .Screen/x DEO2
|
|
.Screen/height DEI2 #0002 DIV2 .Screen/y DEO2
|
|
|
|
;default_icn .Screen/addr DEO2
|
|
#31 .Screen/color DEO
|
|
#2a .slime STZ
|
|
|
|
BRK
|
|
|
|
@on-frame ( -> )
|
|
|
|
#2a .slime STZ
|
|
;default_icn .Screen/addr DEO2
|
|
|
|
( hold ctrl key to change slime color )
|
|
.Controller/button DEI #0f AND
|
|
DUP #01 NEQ ,&no-ctrl JCN #25 .slime STZ &no-ctrl
|
|
DUP #02 NEQ ,&no-alt JCN #2f .slime STZ &no-alt
|
|
POP
|
|
|
|
( clear ) #30 .Screen/color DEO
|
|
|
|
( detect movement )
|
|
.Controller/button DEI #f0 AND
|
|
DUP #04 SFT #01 AND #01 NEQ ,&no-up JCN
|
|
( move )
|
|
.Screen/y DEI2 -- .Screen/y DEO2
|
|
;up_icn .Screen/addr DEO2 &no-up
|
|
DUP #05 SFT #01 AND #01 NEQ ,&no-down JCN
|
|
( move )
|
|
.Screen/y DEI2 ++ .Screen/y DEO2
|
|
;down_icn .Screen/addr DEO2 &no-down
|
|
DUP #06 SFT #01 AND #01 NEQ ,&no-left JCN
|
|
( move )
|
|
.Screen/x DEI2 -- .Screen/x DEO2
|
|
;left_icn .Screen/addr DEO2 &no-left
|
|
DUP #07 SFT #01 AND #01 NEQ ,&no-right JCN
|
|
( move )
|
|
.Screen/x DEI2 ++ .Screen/x DEO2
|
|
;right_icn .Screen/addr DEO2 &no-right
|
|
POP
|
|
|
|
( draw face )
|
|
#31 .Screen/color DEO
|
|
|
|
( draw slime )
|
|
;slime_icn .Screen/addr DEO2
|
|
.slime LDZ .Screen/color DEO
|
|
|
|
BRK
|
|
|
|
@default_icn [ 3c7e ffdb ffe7 7e3c ]
|
|
@up_icn [ 2466 e7db ffff 7e3c ]
|
|
@down_icn [ 3c7e ffff dbe7 6624 ]
|
|
@left_icn [ 3c7e ef1f 1fef 7e3c ]
|
|
@right_icn [ 3c7e f7f8 f8f7 7e3c ]
|
|
@slime_icn [ 0000 183c 3c18 0000 ]
|
|
|