Added lock on touch

This commit is contained in:
Devine Lu Linvega 2024-02-11 10:08:34 -08:00
parent 69ac77c567
commit 7ec89389c0
1 changed files with 24 additions and 13 deletions

View File

@ -7,14 +7,14 @@
|0000 |0000
@hover $2 @hover $2 @lock $1
|0100 |0100
@on-reset ( -> ) @on-reset ( -> )
#ad0f .System/r DEO2 #e508 .System/r DEO2
#ac0f .System/g DEO2 #e80b .System/g DEO2
#ab0f .System/b DEO2 #d80b .System/b DEO2
#0130 .Screen/width DEO2 #0130 .Screen/width DEO2
#00d0 .Screen/height DEO2 #00d0 .Screen/height DEO2
;on-mouse .Mouse/vector DEO2 ;on-mouse .Mouse/vector DEO2
@ -26,13 +26,22 @@
( | within ) ( | within )
.Mouse/x DEI2 #0008 SUB2 #0120 LTH2 ?{ BRK } .Mouse/x DEI2 #0008 SUB2 #0120 LTH2 ?{ BRK }
.Mouse/y DEI2 #0008 SUB2 #00c0 LTH2 ?{ BRK } .Mouse/y DEI2 #0008 SUB2 #00c0 LTH2 ?{ BRK }
.Mouse/state DEI ?on-mouse-down [ LIT2 &last 00 -Mouse/state ] DEI #00 NEQ DUP ,&last STR
DUP2 #0100 EQU2 ?on-mouse-release
NIP ?on-mouse-down
( | hover ) ( | hover )
get-mouse-key <set-hover> get-mouse-key <set-hover>
BRK BRK
@on-mouse-release ( states* -> )
.hover LDZ2 ;btn-hover-chr <draw-key-id>
[ LIT2 00 -lock ] STZ
POP2 BRK
@on-mouse-down ( -> ) @on-mouse-down ( -> )
get-mouse-key <set-press> .lock LDZ ?{
get-mouse-key <set-press>
[ LIT2 01 -lock ] STZ }
BRK BRK
( (
@ -85,27 +94,29 @@
( ) STH2r LDA2 STH2r <draw-key> ( ) STH2r LDA2 STH2r <draw-key>
JMP2r JMP2r
@<draw-glyph> ( addr* -- ) @<draw-glyph> ( addr* color -- )
STH
.Screen/addr DEO2 .Screen/addr DEO2
[ LIT2 15 -Screen/auto ] DEO [ LIT2 15 -Screen/auto ] DEO
[ LIT2 0a -Screen/sprite ] DEO STHr .Screen/sprite DEO
JMP2r JMP2r
@<draw-key> ( a* b* c* frame* -- ) @<draw-key> ( a* b* c* frame* -- )
DUP2 ;btn-hover-chr EQU2 STH DUP2 ;btn-hover-chr EQU2 STH
DUP2 ;btn-press-chr EQU2 #10 SFT STH
<draw-button> <draw-button>
.Screen/x DEI2k #0002 SUB2 ROT DEO2 .Screen/x DEI2k #0002 SUB2 ROT DEO2
.Screen/y DEI2k #0024 STHr SUB SUB2 ROT DEO2 .Screen/y DEI2k #0024 STHr SUB STHr SUB SUB2 ROT DEO2
( | a ) ( | a )
<draw-glyph> #00 <draw-glyph>
.Screen/x DEI2k #0002 SUB2 ROT DEO2 .Screen/x DEI2k #0002 SUB2 ROT DEO2
.Screen/y DEI2k #000c ADD2 ROT DEO2 .Screen/y DEI2k #000c ADD2 ROT DEO2
( | b ) ( | b )
<draw-glyph> #0a <draw-glyph>
.Screen/x DEI2k #0002 SUB2 ROT DEO2 .Screen/x DEI2k #0002 SUB2 ROT DEO2
.Screen/y DEI2k #000c ADD2 ROT DEO2 .Screen/y DEI2k #000c ADD2 ROT DEO2
( | c ) ( | c )
<draw-glyph> #05 <draw-glyph>
.Screen/x DEI2k #0006 ADD2 ROT DEO2 .Screen/x DEI2k #0006 ADD2 ROT DEO2
.Screen/y DEI2k #001c SUB2 ROT DEO2 .Screen/y DEI2k #001c SUB2 ROT DEO2
JMP2r JMP2r
@ -183,6 +194,6 @@
&c ( -- ) &c ( -- )
#0f AND DUP #09 GTH #27 MUL ADD [ LIT "0 ] ADD #18 DEO #0f AND DUP #09 GTH #27 MUL ADD [ LIT "0 ] ADD #18 DEO
JMP2r JMP2r
~assets.tal ~assets.tal