enable cart hilight by keyboard
This commit is contained in:
parent
b000fd83c5
commit
507980f61f
2 changed files with 35 additions and 21 deletions
|
@ -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 )
|
|
@ -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 @@ BRK
|
|||
;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 @@ RTN
|
|||
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 )
|
||||
|
@ -500,6 +501,37 @@ RTN
|
|||
#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 )
|
||||
@spritesheet "xrxs.chr 00
|
||||
@fontsheet "zz.chr 00
|
||||
|
|
Loading…
Reference in a new issue