use mouse to get selection index
This commit is contained in:
parent
1eb1aedf24
commit
88b6eb83de
1 changed files with 32 additions and 2 deletions
|
@ -51,6 +51,7 @@
|
||||||
@list-elem $32
|
@list-elem $32
|
||||||
@list-top $1
|
@list-top $1
|
||||||
@list-height $1
|
@list-height $1
|
||||||
|
@select-index $1
|
||||||
|
|
||||||
@cart $32
|
@cart $32
|
||||||
@realm $32
|
@realm $32
|
||||||
|
@ -141,7 +142,8 @@ BRK
|
||||||
#2000 .File/length DEO2
|
#2000 .File/length DEO2
|
||||||
;listbuf .File/load DEO2
|
;listbuf .File/load DEO2
|
||||||
.File/success DEI2 .list-len STZ2
|
.File/success DEI2 .list-len STZ2
|
||||||
INC .state STZ BRK
|
INC .state STZ
|
||||||
|
;get-select-idx-by-mouse .Mouse/vector DEO2 BRK
|
||||||
&keep-state POP
|
&keep-state POP
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
|
@ -437,7 +439,7 @@ RTN
|
||||||
[ ;word
|
[ ;word
|
||||||
.Screen/x DEI2
|
.Screen/x DEI2
|
||||||
.Screen/y DEI2
|
.Screen/y DEI2
|
||||||
#02 ] ;draw-string JSR2
|
;get-entry-color JSR2 ] ;draw-string JSR2
|
||||||
#0040 .Screen/x DEO2
|
#0040 .Screen/x DEO2
|
||||||
&no-draw
|
&no-draw
|
||||||
.list-offset LDZ INC .list-offset STZ
|
.list-offset LDZ INC .list-offset STZ
|
||||||
|
@ -451,6 +453,34 @@ RTN
|
||||||
&end POP2 POP2
|
&end POP2 POP2
|
||||||
RTN
|
RTN
|
||||||
|
|
||||||
|
@get-entry-color ( -- colorByte )
|
||||||
|
|
||||||
|
.list-offset LDZ
|
||||||
|
.select-index LDZ
|
||||||
|
|
||||||
|
NEQ ,&normal JCN
|
||||||
|
|
||||||
|
( selected )
|
||||||
|
#0c RTN
|
||||||
|
&normal
|
||||||
|
#02
|
||||||
|
RTN
|
||||||
|
|
||||||
|
@get-select-idx-by-mouse ( -> )
|
||||||
|
|
||||||
|
.Mouse/x DEI2 #0040 LTH2 ,&done JCN
|
||||||
|
.Mouse/x DEI2 .Screen/width DEI2 #0040 SUB2 GTH2 ,&done JCN
|
||||||
|
|
||||||
|
.Mouse/y DEI2 #0028 LTH2 ,&done JCN
|
||||||
|
.Mouse/y DEI2 .Screen/height DEI2 #0028 SUB2 GTH2 ,&done JCN
|
||||||
|
|
||||||
|
.Mouse/y DEI2 #0028 SUB2 8// TOB .list-top LDZ ADD .select-index STZ
|
||||||
|
BRK
|
||||||
|
|
||||||
|
&done
|
||||||
|
#ff .select-index STZ
|
||||||
|
BRK
|
||||||
|
|
||||||
( constants )
|
( constants )
|
||||||
@spritesheet "xrxs.chr 00
|
@spritesheet "xrxs.chr 00
|
||||||
@fontsheet "zz.chr 00
|
@fontsheet "zz.chr 00
|
||||||
|
|
Loading…
Reference in a new issue