kind of have a working scrollbar now

This commit is contained in:
Iris Lightshard 2021-10-10 16:03:48 -06:00
parent cd3bcd1dbe
commit bd123b825a
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398
2 changed files with 40 additions and 23 deletions

View file

@ -26,7 +26,11 @@ even moar
need
lotsof
entries
to
test
thebiz
andthefunk
for
da
funky
biznizz
and bizniss
and buznets
and whimsy
and also combs

View file

@ -553,29 +553,41 @@ RTN
.Screen/width DEI2 #0048 SUB2 .Screen/x DEO2
#0028 .Screen/y DEO2
( how many cells to highlight
.ncarts LDZ .list-height LDZ #01 ADD LTH ,&set-max JCN
.ncarts LDZ .list-height LDZ SUB STH ,&start-loop JMP )
&set-max
&trough-only
;scrollbar-trough .Screen/addr DEO2
.list-height LDZ #00
&while-trough-only EQUk ,&end-trough-only JCN
#81 .Screen/sprite DEO
INC-Y
INC ,&while-trough-only JMP &end-trough-only POP2
.ncarts LDZ .list-height LDZ LTH ,&no-handle JCN
,&start-loop JMP
&no-handle
RTN
&start-loop
#0028 .Screen/y DEO2
( store the number of carts per tile of the scroll bar )
.ncarts LDZ .list-height LDZ SUB .list-height LDZ MOD INC
STH
.list-height LDZ #00
&while EQUk ,&end JCN
( trough top
DUP .list-top GTH ,&handle
;scrollbar-trough .Screen/addr DEO2
,&draw JMP
&handle
DUP .list-top LDZ .list-height LDZ ADD #03 SFT GTH ,&trough-bottom JCN
;scrollbar .Screen/addr DEO2
,&draw JMP )
&trough-bottom
;scrollbar-trough .Screen/addr DEO2
&draw
#81 .Screen/sprite DEO
( trough top )
DUP INC .list-top LDZ GTH ,&handle JCN
INC
INC-Y
INC ,&while JMP &end POP2
,&while JMP
&handle
DUP .list-top LDZ .list-height LDZ ADD STHrk SUB LTH #00 EQU ,&trough-bottom JCN
;scrollbar .Screen/addr DEO2
#81 .Screen/sprite DEO
&trough-bottom
INC-Y
INC ,&while JMP &end POP2 POPr
RTN
@ -613,12 +625,14 @@ RTN
BRK
@try-scroll-up-mouse ( -> )
.ncarts LDZ .list-height LDZ LTH ,&no-scroll-up JCN
.list-top LDZ #00 EQU ,&no-scroll-up JCN
.list-top LDZ #01 SUB .list-top STZ
&no-scroll-up
RTN
@try-scroll-down-mouse ( -> )
.ncarts LDZ .list-height LDZ LTH ,&no-scroll-down JCN
.list-top LDZ .list-height LDZ ADD .ncarts LDZ #01 ADD EQU ,&no-scroll-down JCN
.list-top LDZ INC .list-top STZ
&no-scroll-down
@ -676,7 +690,6 @@ BRK
.btn-state LDZ #ff EQU ,&from-null JCN
.btn-state LDZ #00 EQU ,&from-no JCN
( from yes )
.Controller/button DEI #80 NEQ ,&check-action JCN
#00 .btn-state STZ
@ -714,7 +727,7 @@ BRK
BRK
&check-b-button
.Controller/button DEI #02 NEQ ,&no-action
.Controller/button DEI #02 NEQ ,&no-action JCN
;get-select-idx-by-mouse .Mouse/vector DEO2
;get-select-idx-by-key .Controller/vector DEO2
#04 .state STZ