basic buttons

This commit is contained in:
~d6 2024-07-31 21:21:06 -04:00
parent 2eef1803e3
commit 59fc847a5f
2 changed files with 78 additions and 1 deletions

BIN
buttons.chr Normal file

Binary file not shown.

View File

@ -58,6 +58,7 @@
&y0 $2 ( starting y coord )
&x1 $2 ( ending x coord )
&y1 $2 ] ( ending y coord )
@audio $1 ( is audio enabled? )
|0100
@ -98,6 +99,9 @@
auto-move
JMP2r
@quit ( -> brk )
#010f DEO BRK ( TODO: save game? save stats? )
@dump-byte ( byte^ -- )
DUP #04 SFT ,&hex JSR #0f AND ,&hex JMP
&hex #30 ADD DUP #39 GTH #27 MUL ADD .Console/w DEO
@ -151,6 +155,7 @@
@draw ( -> )
draw-background
draw-buttons
draw-decorations
draw-stock
draw-waste
@ -216,6 +221,24 @@
#36 .Screen/auto DEO ( ; s/auto<-0x36 )
#80 .Screen/sprite DEOk DEOk DEO JMP2r ( ; draw 4x3 tiles )
@draw-button ( x* y* addr* -> )
.Screen/addr DEO2
.Screen/y DEO2
.Screen/x DEO2
#36 .Screen/auto DEO
#8a .Screen/sprite DEO JMP2r
@audio-button-addr ( -> addr* )
.audio LDZ ?&on ;audio-off-button JMP2r
&on ;audio-on-button JMP2r
@draw-buttons ( -> )
#0008 #00b4 ;restart-button draw-button
#0030 #00b4 ;quit-button draw-button
#0058 #00b4 audio-button-addr draw-button
#0080 #00b4 ;about-button draw-button
JMP2r
@draw-decorations ( -> )
#00e8 #0098 ;sprites !draw-bear
@ -481,11 +504,12 @@
.Mouse/state DEI ( state^ )
.prev/mouse-state LDZ #ff EOR AND ( down^ )
#01 AND ?&ok JMP2r &ok
maybe-select-button ?&skip
maybe-select-stock ?&skip
maybe-select-waste ?&found
( TODO: maybe-select-foundation )
maybe-select-tableau ?&found
( not found ) .dragging #05 !initialize
( not found, end drag ) .dragging #05 !initialize
&found clear-prev-mouse !draw-curr-hold
&skip JMP2r
@ -695,6 +719,29 @@
&cancel ( i^ top^ row^ [n*] )
POP2 POP POP2r #00 JMP2r ( 0^ )
@maybe-select-button ( -> bool^ )
.Mouse/y DEI2
DUP2 #00b4 LTH2 ?&no
DUP2 #00bb GTH2 ?&no
POP2 .Mouse/x DEI2
DUP2 #0008 LTH2 ?&no
DUP2 #0028 LTH2 ?&restart
DUP2 #0030 LTH2 ?&no
DUP2 #0050 LTH2 ?&quit
DUP2 #0058 LTH2 ?&no
DUP2 #0078 LTH2 ?&audio
DUP2 #0080 LTH2 ?&no
DUP2 #00a0 LTH2 ?&about
&no POP2 #00 JMP2r
&restart POP2 reset #01 JMP2r
&quit POP2 quit #01 JMP2r
&audio POP2 toggle-audio #01 JMP2r
&about POP2 #010e DEO #01 JMP2r
@toggle-audio ( -> )
#0001 .audio LDZ JMP SWP POP .audio STZ
draw-buttons ( !draw-curr-mouse ) JMP2r
@min ( x^ y^ -> min[x,y]^ )
LTHk JMP SWP POP JMP2r
@ -776,3 +823,33 @@
~cards.tal
@sprites ~sprites.tal
@restart-button
7f ff ff ff ff ff ff 7f 7f ce d5 cc d5 d6 ff 7f
ff ff ff ff ff ff ff ff ff 62 df 67 fb 47 ff ff
ff ff ff ff ff ff ff ff ff 36 6a 62 6a 6a ff ff
fe ff ff ff ff ff ff fe fe 63 b7 77 b7 b7 ff fe
@quit-button
7f ff ff ff ff ff ff 7f 7f ff ff ff ff ff ff 7f
ff ff ff ff ff ff ff ff ff cd b5 b5 b5 cc f7 ff
ff ff ff ff ff ff ff ff ff 51 5b 5b 5b 5b ff ff
fe ff ff ff ff ff ff fe fe ff ff ff ff ff ff fe
@audio-off-button
7f ff ff ff ff ff ff 7f 7f da aa 8a aa a8 ff 7f
ff ff ff ff ff ff ff ff ff 9b aa aa aa 9b ff ff
ff ff ff ff ff ff ff ff ff 3e d5 dd d5 3e ff ff
fe ff ff ff ff ff ff fe fe c9 5b 49 5b db ff fe
@audio-on-button
7f ff ff ff ff ff ff 7f 7f da aa 8a aa a8 ff 7f
ff ff ff ff ff ff ff ff ff 9b aa aa aa 9b ff ff
ff ff ff ff ff ff ff ff ff 3e d5 dd d5 3e ff ff
fe ff ff ff ff ff ff fe fe cf 57 57 57 d7 ff fe
@about-button
7f ff ff ff ff ff ff 7f 7f fe fd fc fd fd ff 7f
ff ff ff ff ff ff ff ff ff ce 55 4d 55 4e ff ff
ff ff ff ff ff ff ff ff ff d4 56 56 56 c6 ff ff
fe ff ff ff ff ff ff fe fe 7f ff ff ff ff ff fe