all repos — xrxs @ 507980f61f79311eddd76b599c331a7d22eca889

experimental networked application/game server with 9p

enable cart hilight by keyboard
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAmFh9J4ACgkQO3+8IhRO
Y5iiIw/9H5qga3YHvdr4srY+vTJYQKVgZBBXR4hZqJlyNMn8i6XGmhK5ql11j5EM
jOu/gFm4WIuBkuOXsUGkt4ov/a66ZfRhqbyb1kZHH06IDavPsdR2VoOsHA3g21Xc
Vrxr9THtRvEUBI+NbtrYvfDr6xyK1HDKvexMwsIpIw95KeKXPvrL4HodBKUcLK+0
+4eXuH7WNSHFRd1dzfQ97zOTplLurXs9aDOBtwT9lvzseqYd3fk+aWNqDybnJiP2
tER01wCAB/GAFl8m/F5YDS40ghmjTq2cJQg70ocQT4mLfUskalDfId1hv1I8BvRA
IUMJbN0BZKVf5UkrATjM3kiR1ntejwz2MNV9rkMiaAD+tZkP++HlmT6Hs9NifN9p
6IF0C2xN7CXX4gjngotdOj2lgYPodexC8vzZ9EM56A9PHqNf20AA7II78QW+GWKn
8KQ8PwjS6w2GUKKFKfVdNyIrIkFcSmrrVihTbvpwCxNqmvTuaQgw8SaSg4EwPlqa
wt8Ae+ZeVca+5pjEsU9rZeIOy9KXbB2031kDo7I1tLYkxabIETmwpN/phSAZRx3a
G43pR82kafdGhrAzFdvt2QxrkSuk5pSayU4iMMa08P5iKWOGtfA0+TSnp6upIFtV
Ud2a2KsiRTPcyBm3j4f68QZ90mMjbemR0YXSCgpEmgSgFsYULeo=
=QN6L
-----END PGP SIGNATURE-----
commit

507980f61f79311eddd76b599c331a7d22eca889

parent

b000fd83c5bc3fab7944c40655f4050b27bb4f4f

2 files changed, 35 insertions(+), 21 deletions(-)

jump to
D uxn-client/cart_select_notes.md

@@ -1,18 +0,0 @@

-# how to render lists - -1. start at top of list area -2. seek until ;list-offset \n have been read -3. drawstr until \n (if y index is hihglihgt index, draw highlighted) -4. increment y and reset x -5. if y > height/8 - 80, break - -# how to highlight list elements - -1. if .Mouse/x > 64 && < width - 64 && .Mouse/y > 40 && < height - 40 -2. index = ((.Mouse/y - 40)/8) + ;list-offset - -# on click - -1. take highlight index -2. seek listbuf until as many \n have been read -3. read until next \n into loadcmdbuf + len(load )
M uxn-client/xrxs.taluxn-client/xrxs.tal

@@ -48,10 +48,10 @@

@list-len $2 @list-offset $1 @list-elem-offset $1 -@list-elem $32 @list-top $1 @list-height $1 @select-index $1 +@ncarts $1 @cart $32 @realm $32

@@ -143,7 +143,8 @@ #2000 .File/length DEO2

;listbuf .File/load DEO2 .File/success DEI2 .list-len STZ2 INC .state STZ - ;get-select-idx-by-mouse .Mouse/vector DEO2 BRK + ;get-select-idx-by-mouse .Mouse/vector DEO2 + ;get-select-idx-by-key .Controller/vector DEO2 BRK &keep-state POP BRK

@@ -469,7 +470,7 @@ #00 OVR SWP DUP ROT ;word ADD2 STA

INC ,&word_clr JMP &end-clr POP2 #00 .list-elem-offset STZ &continue INC2 ,&while JMP - &end POP2 POP2 + &end .list-offset LDZ #01 SUB .ncarts STZ POP2 POP2 RTN @get-entry-color ( -- colorByte )

@@ -498,6 +499,37 @@ BRK

&done #ff .select-index STZ +BRK + +@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 + DUP #00 EQU ,&no-dec JCN + #01 SUB .select-index STZ + ,&no-up JMP + &no-dec + 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 + DUP .ncarts LDZ EQU ,&no-inc JCN + INC .select-index STZ + ,&no-down JMP + &no-inc + POP + &no-down + + POP BRK ( constants )