clicking wip

This commit is contained in:
~d6 2024-07-13 20:45:22 -04:00
parent d4ab9ccd47
commit 598f00bc03
1 changed files with 34 additions and 17 deletions

View File

@ -186,7 +186,7 @@
@on-mouse ( -> brk )
on-move
( on-click-down )
on-click-down
( on-click-up )
.Mouse/state DEI .prev-mouse-state STZ
BRK
@ -201,8 +201,13 @@
.Mouse/x DEI2 .prev-mouse-x LDZ2 NEQ2 ?&redraw
.Mouse/y DEI2 .prev-mouse-y LDZ2 NEQ2 ?&redraw
JMP2r
&redraw #00 .Screen/auto DEO
clear-prev-mouse draw-curr-mouse JMP2r
&redraw ( #00 .Screen/auto DEO )
!draw-mouse
( clear-prev-mouse draw-curr-mouse JMP2r )
@draw-mouse ( -> )
#00 .Screen/auto DEO
clear-prev-mouse !draw-curr-mouse
@clear-prev-mouse ( -> )
.prev-mouse-x LDZ2 .Screen/x DEO2
@ -219,24 +224,36 @@
@on-click-down ( -> )
.Mouse/state DEI ( state^ )
.prev-mouse-state LDZ #ff EOR AND ( down^ )
#01 AND ( TODO: support more than one button )
?&click JMP2r ( TODO: check particular button )
&click
( find-mouse-over-card
ORAk ?&found POP2 JMP2r
&found
raise-cards .card-is-held STZ
!draw-cards ) JMP2r
#01 AND ?{ JMP2r } !maybe-select-card
@maybe-select-card ( -> )
.Mouse/x DEI2 .Mouse/y DEI2
maybe-select-stock ?&done
&done JMP2r
@top-stock ( -> zp^ )
.stock #34 OVR ADD SWP
&loop LDZk ?&ok !&done &ok INC GTHk ?&loop &done NIP #01 SUB JMP2r
@maybe-select-stock ( x* y* -> bool^ )
top-stock STH ( [z^] )
OVR2 #0008 LTH2 ?&no1 ( x* y* [z^] ; x<8 )
SWP2 #0017 GTH2 ?&no2 ( y* [z^] ; x>=16 )
#00 STHkr .stock SUB #03 SFT2 ( y* d* [z^] )
SWP2 STH2 ( d* [z^ y*] )
#0020 ( d* max=32-d* [z^ y*] )
#0008 ROT2 SUB2 ( max* min=8-d* [z^ y*] )
STH2kr GTH2 ?&no3 ( max* [z^ y*] )
STH2r LTH2 ?&no4 ( [z^] )
STHr LDZk #80 EOR SWP STZ ( ; z<-z^0x80 )
draw-stock #01 JMP2r ( 1^ )
&no1 POP2 &no2 POP2 POPr #00 JMP2r ( 0^ )
&no3 POP2 POP2r &no4 POPr #00 JMP2r ( 0^ )
@on-click-up ( -> )
.Mouse/state DEI #ff EOR ( not-state^ )
.prev-mouse-state LDZ AND ( up^ )
#01 AND ( TODO: support more than one button )
?&unclick JMP2r ( TODO: check particular button )
&unclick
( #00 .card-is-held STZ
draw-background draw-cards )
JMP2r
#01 AND ?{ JMP2r } JMP2r ( TODO: anything to do here? )
( @on-key ( -> brk )
on-press on-release