(button.tal) Because sometimes you just need a button
This commit is contained in:
parent
3e1183285a
commit
ff7c82f9e5
|
@ -0,0 +1,95 @@
|
||||||
|
|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
|
||||||
|
|80 @Controller &vector $2 &button $1 &key $1
|
||||||
|
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &chord $1 &pad $4 &scrolly &scrolly-hb $1 &scrolly-lb $1
|
||||||
|
|
||||||
|
|0100
|
||||||
|
|
||||||
|
@on-reset ( -> )
|
||||||
|
#5c0f .System/r DEO2
|
||||||
|
#6d0f .System/g DEO2
|
||||||
|
#6d0f .System/b DEO2
|
||||||
|
#0038 DUP2 .Screen/width DEO2
|
||||||
|
.Screen/height DEO2
|
||||||
|
;on-mouse .Mouse/vector DEO2
|
||||||
|
;button-chr <draw-button>
|
||||||
|
BRK
|
||||||
|
|
||||||
|
@on-frame ( -> )
|
||||||
|
[ LIT2 20 &time 00 ] INCk ,&time STR
|
||||||
|
EQU ?{ BRK }
|
||||||
|
#0000 .Screen/vector DEO2
|
||||||
|
;button-chr/up <draw-button>
|
||||||
|
[ LIT2 "! 18 ] DEO
|
||||||
|
BRK
|
||||||
|
|
||||||
|
@on-mouse ( -> )
|
||||||
|
[ LIT2 00 -Mouse/state ] DEI NEQ #42 ADD ;pointer-icn <update-pointer>
|
||||||
|
.Mouse/state DEI ?{ BRK }
|
||||||
|
.Mouse/x DEI2 .Mouse/y DEI2 within-button ?{ BRK }
|
||||||
|
<press-button>
|
||||||
|
( release mouse ) [ LIT2 00 -Mouse/state ] DEO
|
||||||
|
BRK
|
||||||
|
|
||||||
|
@<press-button> ( -- )
|
||||||
|
;button-chr/down <draw-button>
|
||||||
|
;on-frame .Screen/vector DEO2
|
||||||
|
#10 ;on-frame/time STA
|
||||||
|
JMP2r
|
||||||
|
|
||||||
|
@within-button ( x* y* -- f )
|
||||||
|
#0010 SUB2 #0018 LTH2 STH
|
||||||
|
#0010 SUB2 #0018 LTH2 STHr AND JMP2r
|
||||||
|
|
||||||
|
(
|
||||||
|
@|drawing )
|
||||||
|
|
||||||
|
@<draw-button> ( addr* -- )
|
||||||
|
[ LIT2 26 -Screen/auto ] DEO
|
||||||
|
#0010 DUP2 .Screen/x DEO2
|
||||||
|
.Screen/y DEO2
|
||||||
|
.Screen/addr DEO2
|
||||||
|
[ LIT2 81 -Screen/sprite ] DEOk DEOk DEO
|
||||||
|
JMP2r
|
||||||
|
|
||||||
|
@<update-pointer> ( color addr* -- )
|
||||||
|
[ LIT2 00 -Screen/auto ] DEO
|
||||||
|
;fill-icn .Screen/addr DEO2
|
||||||
|
#40 <draw-pointer>
|
||||||
|
.Mouse/x DEI2 ,<draw-pointer>/x STR2
|
||||||
|
.Mouse/y DEI2 ,<draw-pointer>/y STR2
|
||||||
|
.Screen/addr DEO2
|
||||||
|
|
||||||
|
@<draw-pointer> ( color -- )
|
||||||
|
[ LIT2 &x $2 ] .Screen/x DEO2
|
||||||
|
[ LIT2 &y $2 ] .Screen/y DEO2
|
||||||
|
.Screen/sprite DEO
|
||||||
|
JMP2r
|
||||||
|
|
||||||
|
(
|
||||||
|
@|assets )
|
||||||
|
|
||||||
|
@fill-icn [ ffff ffff ffff ffff ]
|
||||||
|
|
||||||
|
@pointer-icn [ 80c0 e0f0 f8e0 1000 ]
|
||||||
|
|
||||||
|
@button-chr &up [
|
||||||
|
0000 1f3f 3f3f 3f3f 001f 3f7f 7f7f 7f7f
|
||||||
|
0000 ffff ffff ffff 00ff ffff ffff ffff
|
||||||
|
0000 f8fc fcfc fcfc 00f8 fcfe fefe fefe
|
||||||
|
3f3f 3f3f 3f3f 3f3f 7f7f 7f7f 7f7f 7f7f
|
||||||
|
e7e7 e781 c3e7 ffff ffff ffff ffff ffff
|
||||||
|
fcfc fcfc fcfc fcfc fefe fefe fefe fefe
|
||||||
|
3f3f 3f3f 3f1f 0000 7f7f 7f5f 4020 1f00
|
||||||
|
ffff ffff ffff 0000 ffff ffff 0000 ff00
|
||||||
|
fcfc fcfc fcf8 0000 fefe fefa 0204 f800 ] &down [
|
||||||
|
0000 001f 3f3f 3f3f 0000 1f3f 7f7f 7f7f
|
||||||
|
0000 00ff ffff ffff 0000 ffff ffff ffff
|
||||||
|
0000 00f8 fcfc fcfc 0000 f8fc fefe fefe
|
||||||
|
3f3f 3f3f 3f3f 3f3f 7f7f 7f7f 7f7f 7f7f
|
||||||
|
ffe7 e7e7 81c3 e7ff ffff ffff ffff ffff
|
||||||
|
fcfc fcfc fcfc fcfc fefe fefe fefe fefe
|
||||||
|
3f3f 3f3f 3f1f 0000 7f7f 7f7f 5f20 1f00
|
||||||
|
ffff ffff ffff 0000 ffff ffff ff00 ff00
|
||||||
|
fcfc fcfc fcf8 0000 fefe fefe fa04 f800 ]
|
||||||
|
|
Loading…
Reference in New Issue