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 need
lotsof lotsof
entries entries
to for
test da
thebiz funky
andthefunk 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 .Screen/width DEI2 #0048 SUB2 .Screen/x DEO2
#0028 .Screen/y 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 &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 .list-height LDZ #00
&while EQUk ,&end JCN &while EQUk ,&end JCN
( trough top ( trough top )
DUP .list-top GTH ,&handle DUP INC .list-top LDZ GTH ,&handle JCN
;scrollbar-trough .Screen/addr DEO2 INC
,&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
INC-Y 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 RTN
@ -613,12 +625,14 @@ RTN
BRK BRK
@try-scroll-up-mouse ( -> ) @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 #00 EQU ,&no-scroll-up JCN
.list-top LDZ #01 SUB .list-top STZ .list-top LDZ #01 SUB .list-top STZ
&no-scroll-up &no-scroll-up
RTN RTN
@try-scroll-down-mouse ( -> ) @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 .list-height LDZ ADD .ncarts LDZ #01 ADD EQU ,&no-scroll-down JCN
.list-top LDZ INC .list-top STZ .list-top LDZ INC .list-top STZ
&no-scroll-down &no-scroll-down
@ -676,7 +690,6 @@ BRK
.btn-state LDZ #ff EQU ,&from-null JCN .btn-state LDZ #ff EQU ,&from-null JCN
.btn-state LDZ #00 EQU ,&from-no JCN .btn-state LDZ #00 EQU ,&from-no JCN
( from yes ) ( from yes )
.Controller/button DEI #80 NEQ ,&check-action JCN .Controller/button DEI #80 NEQ ,&check-action JCN
#00 .btn-state STZ #00 .btn-state STZ
@ -714,7 +727,7 @@ BRK
BRK BRK
&check-b-button &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-mouse .Mouse/vector DEO2
;get-select-idx-by-key .Controller/vector DEO2 ;get-select-idx-by-key .Controller/vector DEO2
#04 .state STZ #04 .state STZ