Routing mouse events

This commit is contained in:
Devine Lu Linvega 2023-04-25 21:44:57 -07:00
parent 78c787d9b2
commit beb280ddb1
1 changed files with 54 additions and 3 deletions

View File

@ -16,7 +16,7 @@
#00f8 .Screen/height DEO2 #00f8 .Screen/height DEO2
( unlock ) ( unlock )
;on-console .Console/vector DEO2 ;on-console .Console/vector DEO2
;on-mouse .Mouse/vector DEO2 ;on-mouse-body .Mouse/vector DEO2
draw-header draw-header
draw-footer draw-footer
@ -27,9 +27,11 @@ BRK
BRK BRK
@on-mouse ( -> ) @on-mouse-head ( -> )
[ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;caret-icn update-cursor [ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;mouse-icn update-cursor
trap-mouse
.Mouse/state DEI ?&on-mouse-down .Mouse/state DEI ?&on-mouse-down
@ -39,6 +41,51 @@ BRK
BRK BRK
@on-mouse-body ( -> )
[ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;caret-icn update-cursor
trap-mouse
.Mouse/state DEI ?&on-mouse-down
BRK
&on-mouse-down ( -> )
BRK
@on-mouse-foot ( -> )
[ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;mouse-icn update-cursor
trap-mouse
.Mouse/state DEI ?&on-mouse-down
BRK
&on-mouse-down ( -> )
BRK
(
@|core )
@trap-mouse ( -- )
.Mouse/y DEI2
DUP2 #0018 GTH2 ?&no-head
POP2 ;on-mouse-head .Mouse/vector DEO2 JMP2r
&no-head
DUP2 #00d6 LTH2 ?&no-foot
POP2 ;on-mouse-foot .Mouse/vector DEO2 JMP2r
&no-foot
POP2
;on-mouse-body .Mouse/vector DEO2
JMP2r
@update-cursor ( color addr* -- ) @update-cursor ( color addr* -- )
[ LIT2 15 -Screen/auto ] DEO [ LIT2 15 -Screen/auto ] DEO
@ -114,11 +161,15 @@ JMP2r
JMP2r JMP2r
@phex ( short* -- ) SWP phex/b &b ( byte -- ) DUP #04 SFT phex/c &c ( char -- ) #0f AND DUP #09 GTH #27 MUL ADD #30 ADD #18 DEO JMP2r
( (
@|assets ) @|assets )
@caret-icn [ @caret-icn [
c628 1010 1010 1010 1010 1010 1010 28c6 ] c628 1010 1010 1010 1010 1010 1010 28c6 ]
@mouse-icn [
80c0 e0f0 f8fc feff f8d8 8c0c 0606 0000 ]
@bar-icn @bar-icn
&a [ &a [
0000 007e 007e 007e 007e 007e 007e 0000 ] 0000 007e 007e 007e 007e 007e 007e 0000 ]