uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit edd0f0e4e7525864c3186506bf35c8e0a6d93430
parent 71f20d49c383c6e2cf193a407d9b3ff7c7635c11
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date:   Wed, 15 Jan 2025 16:54:14 -0800

(button.tal) Making OOP, final

Diffstat:
Mprojects/examples/gui/button.tal | 35++++++++++++++++-------------------
1 file changed, 16 insertions(+), 19 deletions(-)

diff --git a/projects/examples/gui/button.tal b/projects/examples/gui/button.tal @@ -16,8 +16,10 @@ ( | size ) #0058 DUP2 .Screen/width DEO2 .Screen/height DEO2 - ;on-mouse .Mouse/vector DEO2 - button/<redraw> + ( >> ) + +@on-mouse ( -> ) + focus/<update> BRK @meta $1 @@ -26,10 +28,6 @@ ( auth ) "By 20 "Devine 20 "Lu 20 "Linvega 0a ( date ) "15 20 "Jan 20 "2025 $2 -@on-mouse ( -> ) - focus/<update> - BRK - ( @|focus ) @@ -59,29 +57,28 @@ BRK @button/on-frame ( -> ) - [ LIT2 18 &down $1 ] INCk ,&down STR - EQU ?{ BRK } - /<release> + [ LIT &timer $1 ] INCk ,&timer STR + ?{ /<release> } BRK @button/<press> ( -- ) ;&on-frame .Screen/vector DEO2 ;&on-mouse-lock focus/<set> - #00 ,&down STR - [ LIT2 "! 18 ] DEO + [ LIT2 e8 _&timer ] STR + ( emit ) [ LIT2 "! 18 ] DEO JMP2r @button/<release> ( -- ) #0000 .Screen/vector DEO2 - ;&on-mouse focus/<set> + focus/<update> + [ LIT2 00 -Mouse/state ] DEO JMP2r @button/<redraw> ( -- ) - ;button/up-chr button/<draw> .Mouse/vector DEI2 ( | handlers ) - DUP2 ;button/on-mouse-lock NEQ2 ?{ POP2 ;&down-chr !button/<draw> } - DUP2 ;button/on-mouse NEQ2 ?{ POP2 ;&hover-chr !button/<draw> } + DUP2 ;&on-mouse-lock NEQ2 ?{ POP2 ;&down-chr !/<draw> } + DUP2 ;&on-mouse NEQ2 ?{ POP2 ;&hover-chr !/<draw> } POP2 ;&up-chr ( >> ) @@ -121,10 +118,6 @@ ( @|assets ) -@fill-icn [ - ffff ffff ffff ffff ffff ffff ffff ffff - ffff ffff ffff ffff ffff ffff ffff ffff ] - @cursor/sprite-chr [ 0000 0000 0000 0817 0000 0000 0000 0008 0000 0000 0000 00c0 0000 0000 0000 0000 @@ -168,3 +161,7 @@ ffff ffff ffff 0000 ffff ffff ffff ff00 fcfc fcfc fcf8 0000 fefe fefe fefc f800 ] +@fill-icn [ + ffff ffff ffff ffff ffff ffff ffff ffff + ffff ffff ffff ffff ffff ffff ffff ffff ] +