fixing scroll logic and start implementing scrollbar
This commit is contained in:
parent
8788fbef79
commit
cd3bcd1dbe
3 changed files with 149 additions and 26 deletions
|
@ -3,4 +3,30 @@ dexe
|
|||
noodle
|
||||
orca
|
||||
left
|
||||
|
||||
ustrat
|
||||
katbug
|
||||
soul grind
|
||||
hyperkaos
|
||||
niju
|
||||
pokiminz
|
||||
yeet
|
||||
funk
|
||||
what
|
||||
is
|
||||
this
|
||||
bizzzz
|
||||
how
|
||||
many
|
||||
should
|
||||
i
|
||||
put
|
||||
here?
|
||||
moar
|
||||
even moar
|
||||
need
|
||||
lotsof
|
||||
entries
|
||||
to
|
||||
test
|
||||
thebiz
|
||||
andthefunk
|
||||
|
|
Binary file not shown.
|
@ -14,7 +14,7 @@
|
|||
%TOS { #00 SWP } %TOB { SWP POP }
|
||||
|
||||
%NEXT-TILE { DUP2 #0010 ADD2 }
|
||||
%GET-USABLE-HEIGHT { .Screen/height DEI2 #0050 #03 SFT2 SWP POP }
|
||||
%GET-USABLE-HEIGHT { .Screen/height DEI2 #0050 SUB2 #03 SFT2 SWP POP }
|
||||
|
||||
%RTN { JMP2r }
|
||||
|
||||
|
@ -70,13 +70,15 @@
|
|||
( load individual sprites from the main sheet )
|
||||
;spritesheet .File/name DEO2
|
||||
#0100 .File/length DEO2
|
||||
|
||||
|
||||
( logos )
|
||||
#0000 .File/offset-ls DEO2
|
||||
;uxn-logo .File/load DEO2
|
||||
|
||||
#0200 .File/offset-ls DEO2
|
||||
;xrxs-logo .File/load DEO2
|
||||
|
||||
( buttons )
|
||||
#00c0 .File/length DEO2
|
||||
#0400 .File/offset-ls DEO2
|
||||
;yes-btn .File/load DEO2
|
||||
|
@ -90,6 +92,20 @@
|
|||
#06c0 .File/offset-ls DEO2
|
||||
;no-btn-active .File/load DEO2
|
||||
|
||||
( scrollbar )
|
||||
#0010 .File/length DEO2
|
||||
#0800 .File/offset-ls DEO2
|
||||
;scroll-down-btn .File/load DEO2
|
||||
|
||||
#0810 .File/offset-ls DEO2
|
||||
;scroll-up-btn .File/load DEO2
|
||||
|
||||
#0820 .File/offset-ls DEO2
|
||||
;scrollbar .File/load DEO2
|
||||
|
||||
#0830 .File/offset-ls DEO2
|
||||
;scrollbar-trough .File/load DEO2
|
||||
|
||||
( load zz font )
|
||||
;fontsheet .File/name DEO2
|
||||
#0000 .File/offset-ls DEO2
|
||||
|
@ -113,7 +129,6 @@ BRK
|
|||
|
||||
@on-frame ( -> )
|
||||
|
||||
|
||||
.ticker LDZ #01 ADD
|
||||
DUP .anim-speed LDZ EQU ,&next-render JCN
|
||||
.ticker STZ
|
||||
|
@ -179,6 +194,7 @@ BRK
|
|||
#0010
|
||||
#02 ] ;draw-string JSR2
|
||||
;render-cart-list JSR2
|
||||
;draw-scrollbar JSR2
|
||||
;draw-pointer JSR2
|
||||
POP
|
||||
BRK
|
||||
|
@ -198,11 +214,13 @@ BRK
|
|||
#0010
|
||||
#02 ] ;draw-string JSR2
|
||||
;render-cart-list JSR2
|
||||
;draw-scrollbar JSR2
|
||||
;draw-confirm-buttons JSR2
|
||||
;draw-pointer JSR2
|
||||
POP
|
||||
BRK
|
||||
&state6 POP
|
||||
|
||||
BRK
|
||||
|
||||
@clear-screen ( -> )
|
||||
|
@ -219,11 +237,12 @@ BRK
|
|||
#0008 ADD2 ,&whiley JMP &endy POP2 POP2
|
||||
#0008 ADD2 ,&whilex JMP &endx POP2 POP2
|
||||
|
||||
RTN
|
||||
RTN
|
||||
&x $2
|
||||
&y $2
|
||||
|
||||
@scoot-logos ( -> )
|
||||
|
||||
.logo-coords/x LDZ2 #0021 LTH2 ,&no-scoot-x JCN
|
||||
.logo-coords/x LDZ2 #01 SFT2
|
||||
.logo-coords/x STZ2
|
||||
|
@ -233,6 +252,7 @@ BRK
|
|||
.logo-coords/y LDZ2 #01 SFT2
|
||||
.logo-coords/y STZ2
|
||||
&no-scoot-y
|
||||
|
||||
RTN
|
||||
|
||||
@draw-uxn-logo ( -> )
|
||||
|
@ -320,6 +340,7 @@ RTN
|
|||
#84 .Screen/sprite DEO
|
||||
#0008 ADD2 ,&whilebottom JMP &endbottom POP2 POP2
|
||||
#0008 ADD2 ,&whilembottom JMP &endmbottom POP2 POP2
|
||||
|
||||
RTN
|
||||
|
||||
|
||||
|
@ -338,9 +359,10 @@ RTN
|
|||
#03 .Screen/pixel DEO
|
||||
,&x LDR2 #0001 ADD2 ,&x STR2 ,&dlscan JMP &enddlscan
|
||||
,&y LDR2 #0004 ADD2 ,&y STR2 ,&whileld JMP &endld
|
||||
|
||||
RTN
|
||||
&x $2
|
||||
&y $2
|
||||
&x $2
|
||||
&y $2
|
||||
|
||||
@draw-tl-scanlines
|
||||
#0028 ,&y STR2
|
||||
|
@ -357,8 +379,8 @@ RTN
|
|||
,&y LDR2 #0004 ADD2 ,&y STR2 ,&whilelu JMP &endlu
|
||||
|
||||
RTN
|
||||
&x $2
|
||||
&y $2
|
||||
&x $2
|
||||
&y $2
|
||||
|
||||
@draw-br-scanlines ( -> )
|
||||
CENTER-Y ,&y STR2
|
||||
|
@ -374,8 +396,8 @@ RTN
|
|||
,&x LDR2 #0001 ADD2 ,&x STR2 ,&drscan JMP &enddrscan
|
||||
,&y LDR2 #0004 ADD2 ,&y STR2 ,&whilerd JMP &endrd
|
||||
RTN
|
||||
&x $2
|
||||
&y $2
|
||||
&x $2
|
||||
&y $2
|
||||
|
||||
@draw-tr-scanlines
|
||||
#0028 ,&y STR2
|
||||
|
@ -392,8 +414,8 @@ RTN
|
|||
,&y LDR2 #0004 ADD2 ,&y STR2 ,&whileru JMP &endru
|
||||
|
||||
RTN
|
||||
&x $2
|
||||
&y $2
|
||||
&x $2
|
||||
&y $2
|
||||
|
||||
|
||||
@draw-pointer ( -> )
|
||||
|
@ -443,10 +465,12 @@ RTN
|
|||
|
||||
@shouldnt-draw-word ( -- flag )
|
||||
|
||||
.list-offset LDZ .list-top LDZ LTH
|
||||
#00 .list-offset LDZ #00 .list-top LDZ #00 .list-height LDZ ADD2 LTH2
|
||||
ORA #01 NEQ
|
||||
.list-offset LDZ .list-top LDZ LTH ,&no JCN
|
||||
.list-offset LDZ .list-top LDZ .list-height LDZ ADD #01 SUB GTH ,&no JCN
|
||||
#00 RTN
|
||||
|
||||
&no
|
||||
#01
|
||||
RTN
|
||||
|
||||
@finish-line ( -> )
|
||||
|
@ -455,7 +479,7 @@ RTN
|
|||
|
||||
&while
|
||||
.Screen/x DEI2
|
||||
.Screen/width DEI2 #0040 SUB2
|
||||
.Screen/width DEI2 #0048 SUB2
|
||||
|
||||
EQU2 ,&end JCN
|
||||
#0c .Screen/sprite DEO
|
||||
|
@ -507,6 +531,7 @@ RTN
|
|||
#00 .list-elem-offset STZ
|
||||
&continue INC2 ,&while JMP
|
||||
&end .list-offset LDZ #01 SUB .ncarts STZ POP2 POP2
|
||||
|
||||
RTN
|
||||
|
||||
@get-entry-color ( -- colorByte )
|
||||
|
@ -520,12 +545,54 @@ RTN
|
|||
#0c RTN
|
||||
&normal
|
||||
#02
|
||||
|
||||
RTN
|
||||
|
||||
@draw-scrollbar ( -> )
|
||||
|
||||
.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
|
||||
|
||||
&start-loop
|
||||
.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
|
||||
INC-Y
|
||||
INC ,&while JMP &end POP2
|
||||
|
||||
RTN
|
||||
|
||||
@get-select-idx-by-mouse ( -> )
|
||||
|
||||
.Mouse/wheel DEI #00 EQU ,&no-scroll JCN
|
||||
.Mouse/wheel DEI #01 NEQ ,&scroll-down JCN
|
||||
( scroll-up )
|
||||
;try-scroll-up-mouse JSR2
|
||||
,&no-scroll JMP
|
||||
|
||||
&scroll-down
|
||||
;try-scroll-down-mouse JSR2
|
||||
|
||||
&no-scroll
|
||||
.Mouse/x DEI2 #0040 LTH2 ,&done JCN
|
||||
.Mouse/x DEI2 .Screen/width DEI2 #0040 SUB2 GTH2 ,&done JCN
|
||||
.Mouse/x DEI2 .Screen/width DEI2 #0048 SUB2 GTH2 ,&done JCN
|
||||
|
||||
.Mouse/y DEI2 #0028 LTH2 ,&done JCN
|
||||
.Mouse/y DEI2 .Screen/height DEI2 #0028 SUB2 GTH2 ,&done JCN
|
||||
|
@ -542,17 +609,44 @@ RTN
|
|||
|
||||
&done
|
||||
#ff .select-index STZ
|
||||
|
||||
BRK
|
||||
|
||||
@try-scroll-up-mouse ( -> )
|
||||
.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 ( -> )
|
||||
.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
|
||||
RTN
|
||||
|
||||
|
||||
@try-scroll-up ( -> )
|
||||
.select-index LDZ
|
||||
DUP .list-top LDZ NEQ ,&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 ( -> )
|
||||
.select-index LDZ
|
||||
DUP .list-top LDZ .list-height LDZ ADD #01 SUB NEQ ,&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
|
||||
RTN
|
||||
|
||||
@get-select-idx-by-key ( -> )
|
||||
|
||||
.Controller/button DEI
|
||||
|
||||
DUP #10 NEQ ,&no-up JCN
|
||||
.select-index LDZ
|
||||
DUP .list-top LDZ NEQ ,&no-scroll-up JCN
|
||||
.list-top LDZ #01 SUB .list-top STZ
|
||||
&no-scroll-up
|
||||
;try-scroll-up JSR2
|
||||
DUP #00 EQU ,&no-dec JCN
|
||||
#01 SUB .select-index STZ
|
||||
,&no-up JMP
|
||||
|
@ -561,10 +655,7 @@ BRK
|
|||
&no-up
|
||||
|
||||
DUP #20 NEQ ,&no-down JCN
|
||||
.select-index LDZ
|
||||
DUP .list-top LDZ .list-height LDZ ADD NEQ ,&no-scroll-down JCN
|
||||
.list-top LDZ INC .list-top STZ
|
||||
&no-scroll-down
|
||||
;try-scroll-down JSR2
|
||||
DUP .ncarts LDZ EQU ,&no-inc JCN
|
||||
INC .select-index STZ
|
||||
,&no-down JMP
|
||||
|
@ -578,6 +669,7 @@ BRK
|
|||
;set-button-state-by-mouse .Mouse/vector DEO2
|
||||
&no-a-btn
|
||||
POP
|
||||
|
||||
BRK
|
||||
|
||||
@set-button-state-by-key ( -> )
|
||||
|
@ -627,6 +719,7 @@ BRK
|
|||
;get-select-idx-by-key .Controller/vector DEO2
|
||||
#04 .state STZ
|
||||
&no-action
|
||||
|
||||
BRK
|
||||
|
||||
@set-button-state-by-mouse ( -> )
|
||||
|
@ -746,6 +839,10 @@ RTN
|
|||
@no-btn $192
|
||||
@yes-btn-active $192
|
||||
@no-btn-active $192
|
||||
@scroll-up-btn $16
|
||||
@scroll-down-btn $16
|
||||
@scrollbar $16
|
||||
@scrollbar-trough $16
|
||||
@cursor [ 80c0 e0f0 f8e0 1000 ]
|
||||
@font $768
|
||||
|
||||
|
|
Loading…
Reference in a new issue