From 7ec89389c0423e316bbb6d345a42cfaf2f95e15c Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Sun, 11 Feb 2024 10:08:34 -0800 Subject: [PATCH] Added lock on touch --- gui/shaviankb/shaviankb.tal | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/gui/shaviankb/shaviankb.tal b/gui/shaviankb/shaviankb.tal index d62c4b7..d2976ba 100644 --- a/gui/shaviankb/shaviankb.tal +++ b/gui/shaviankb/shaviankb.tal @@ -7,14 +7,14 @@ |0000 - @hover $2 + @hover $2 @lock $1 |0100 @on-reset ( -> ) - #ad0f .System/r DEO2 - #ac0f .System/g DEO2 - #ab0f .System/b DEO2 + #e508 .System/r DEO2 + #e80b .System/g DEO2 + #d80b .System/b DEO2 #0130 .Screen/width DEO2 #00d0 .Screen/height DEO2 ;on-mouse .Mouse/vector DEO2 @@ -26,13 +26,22 @@ ( | within ) .Mouse/x DEI2 #0008 SUB2 #0120 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 ) get-mouse-key BRK +@on-mouse-release ( states* -> ) + .hover LDZ2 ;btn-hover-chr + [ LIT2 00 -lock ] STZ + POP2 BRK + @on-mouse-down ( -> ) - get-mouse-key + .lock LDZ ?{ + get-mouse-key + [ LIT2 01 -lock ] STZ } BRK ( @@ -85,27 +94,29 @@ ( ) STH2r LDA2 STH2r JMP2r -@ ( addr* -- ) +@ ( addr* color -- ) + STH .Screen/addr DEO2 [ LIT2 15 -Screen/auto ] DEO - [ LIT2 0a -Screen/sprite ] DEO + STHr .Screen/sprite DEO JMP2r @ ( a* b* c* frame* -- ) DUP2 ;btn-hover-chr EQU2 STH + DUP2 ;btn-press-chr EQU2 #10 SFT STH .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 ) - + #00 .Screen/x DEI2k #0002 SUB2 ROT DEO2 .Screen/y DEI2k #000c ADD2 ROT DEO2 ( | b ) - + #0a .Screen/x DEI2k #0002 SUB2 ROT DEO2 .Screen/y DEI2k #000c ADD2 ROT DEO2 ( | c ) - + #05 .Screen/x DEI2k #0006 ADD2 ROT DEO2 .Screen/y DEI2k #001c SUB2 ROT DEO2 JMP2r @@ -183,6 +194,6 @@ &c ( -- ) #0f AND DUP #09 GTH #27 MUL ADD [ LIT "0 ] ADD #18 DEO JMP2r - + ~assets.tal