all repos — xrxs @ cd3bcd1dbecdb1b3c286582768d043823653954c

experimental networked application/game server with 9p

fixing scroll logic and start implementing scrollbar
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAmFjRQoACgkQO3+8IhRO
Y5ithA//Xsjaf4++UEaJCEatD4rooMEFMb9PmzAQ9eQyfKlTGaIk/1KeyueNC8VQ
sLPK50oareFnXhzb5Y3mxBRAG6ahulB6otjhAzwijPRsygG+ylruO1vrnwlbHA/T
jqc3NQwMhEf2YwVZFHX6QARbfV5gfUdZnkgObaLfUTJ43xU1BLLK+35kITsJO39K
DT8sxJEn4diufNwTZDcKJriqOPOp41wMTczlHG1RFX9eLcX9JRMivRPn98H1uoHN
LLE+nxwqsHHAL6pHZOWHpnw0+vL+OGi1FUbJWZ+J41U4uyPLgba1mBr3ZhfDT4X2
VpuF1PzSCqLKtulpfXndS7wClxVNL1AMGIadaAtJiYiHS1D9uvPx7Cn72tGQd+6Z
kozEgEV9t+MloZj2sGqGBTeF7yS2YfaiX86IAN3YIQI3mOZnMTPckN6fSIYGL24L
6zFMHE6Fr8JV++uH1OLgQc1gPhM90rtc9zX3EFMZ/Ne5IU/0MDnnLU5NBSBNsnK4
L1OUfV+IUGQf3Zetriq4/TbOsC55gr2wSncEWxeH1/0E8UpPAkgY/olzylm5bI4g
+h8aliWUIeZQgrnyCstmsFk1syedQl+/wZPQhEfUkW3Q8Th0mSDyOanOjlMcuUxY
I89k3iKyiaaoZmUtwTASx1vN2/WVsR+wdYUZ/CJwq4zIXQ/5Cfw=
=1sN6
-----END PGP SIGNATURE-----
commit

cd3bcd1dbecdb1b3c286582768d043823653954c

parent

8788fbef7966786c378f6720dae08784dcf1b313

3 files changed, 149 insertions(+), 26 deletions(-)

jump to
M uxn-client/n/cartsuxn-client/n/carts

@@ -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
M uxn-client/xrxs.taluxn-client/xrxs.tal

@@ -14,7 +14,7 @@ %8** { #30 SFT2 } %8// { #03 SFT2 }

%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 @@ CENTER-X OVR2 ;strlen JSR2 #20 SFT2 SUB2

#0010 #02 ] ;draw-string JSR2 ;render-cart-list JSR2 + ;draw-scrollbar JSR2 ;draw-pointer JSR2 POP BRK

@@ -198,11 +214,13 @@ CENTER-X OVR2 ;strlen JSR2 #20 SFT2 SUB2

#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 @@ #40 .Screen/sprite DEO

#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 @@ .logo-coords/y LDZ2 #0021 LTH2 ,&no-scoot-y JCN

.logo-coords/y LDZ2 #01 SFT2 .logo-coords/y STZ2 &no-scoot-y + RTN @draw-uxn-logo ( -> )

@@ -320,6 +340,7 @@ DUP2 .Screen/x DEO2

#84 .Screen/sprite DEO #0008 ADD2 ,&whilebottom JMP &endbottom POP2 POP2 #0008 ADD2 ,&whilembottom JMP &endmbottom POP2 POP2 + RTN

@@ -338,9 +359,10 @@ ,&y LDR2 .Screen/y DEO2

#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 @@ ,&x LDR2 #0001 ADD2 ,&x STR2 ,&ulscan JMP &endulscan

,&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 @@ #03 .Screen/pixel DEO

,&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 @@ ,&x LDR2 #0001 ADD2 ,&x STR2 ,&urscan JMP &endurscan

,&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 @@ ;get-entry-color JSR2 #02 EQU ,&end JCN

&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 @@ INC ,&word_clr JMP &end-clr POP2

#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 @@ ( selected )

#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 @@ BRK

&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 @@ POP

&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 @@ ;set-button-state-by-key .Controller/vector DEO2

;set-button-state-by-mouse .Mouse/vector DEO2 &no-a-btn POP + BRK @set-button-state-by-key ( -> )

@@ -627,6 +719,7 @@ ;get-select-idx-by-mouse .Mouse/vector DEO2

;get-select-idx-by-key .Controller/vector DEO2 #04 .state STZ &no-action + BRK @set-button-state-by-mouse ( -> )

@@ -746,6 +839,10 @@ @yes-btn $192

@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