refactor WGCreateRadio

This commit is contained in:
4am 2018-03-03 09:31:01 -05:00
parent 053690ba47
commit 366d765998
2 changed files with 36 additions and 79 deletions

115
views.s
View File

@ -105,56 +105,9 @@ WGCreateView_done:
; SH: String pointer (MSB) ; SH: String pointer (MSB)
; ;
WGCreateCheckbox: WGCreateCheckbox:
SAVE_AXY pha
lda #VIEW_STYLE_CHECK
ldy #0 bra WGCreate1x1_common
lda (PARAM0),y ; Find our new view record
pha ; Cache view ID so we can select when we're done
asl
asl
asl
asl ; Records are 16 bytes wide
tax
iny
lda (PARAM0),y
sta WG_VIEWRECORDS+0,x ; Screen X
iny
lda (PARAM0),y
sta WG_VIEWRECORDS+1,x ; Screen Y
lda #1
sta WG_VIEWRECORDS+2,x ; Initialize screen width
sta WG_VIEWRECORDS+3,x ; Initialize screen height
sta WG_VIEWRECORDS+7,x ; Initialize view width
sta WG_VIEWRECORDS+8,x ; Initialize view height
lda #VIEW_STYLE_CHECK
sta WG_VIEWRECORDS+4,x ; Style
stz WG_VIEWRECORDS+5,x ; Initialize scrolling
stz WG_VIEWRECORDS+6,x
stz WG_VIEWRECORDS+9,x ; Initialize state
stz WG_VIEWRECORDS+10,x ; Initialize callback
stz WG_VIEWRECORDS+11,x
iny
lda (PARAM0),y
sta WG_VIEWRECORDS+12,x ; Title
iny
lda (PARAM0),y
sta WG_VIEWRECORDS+13,x
pla
jsr WGSelectView ; Leave this as the active view
WGCreateCheckbox_done:
RESTORE_AXY
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; WGCreateRadio ; WGCreateRadio
@ -170,59 +123,63 @@ WGCreateCheckbox_done:
; SH: String pointer (MSB) ; SH: String pointer (MSB)
; ;
WGCreateRadio: WGCreateRadio:
SAVE_AXY pha
lda #VIEW_STYLE_RADIO
WGCreate1x1_common:
sta WGCreate1x1_style+1
SAVE_XY
ldy #0 ldy #0
lda (PARAM0),y ; Find our new view record lda (PARAM0),y ; Find our new view record
pha ; Cache view ID so we can select when we're done pha ; Cache view ID so we can select when we're done
asl asl
asl asl
asl asl
asl ; Records are 16 bytes wide asl ; Records are 16 bytes wide
tax tax
iny iny
lda (PARAM0),y lda (PARAM0),y
sta WG_VIEWRECORDS+0,x ; Screen X sta WG_VIEWRECORDS+0,x ; Screen X
iny iny
lda (PARAM0),y lda (PARAM0),y
sta WG_VIEWRECORDS+1,x ; Screen Y sta WG_VIEWRECORDS+1,x ; Screen Y
lda #1 lda #1
sta WG_VIEWRECORDS+2,x ; Initialize screen width sta WG_VIEWRECORDS+2,x ; Initialize screen width
sta WG_VIEWRECORDS+3,x ; Initialize screen height sta WG_VIEWRECORDS+3,x ; Initialize screen height
sta WG_VIEWRECORDS+7,x ; Initialize view width sta WG_VIEWRECORDS+7,x ; Initialize view width
sta WG_VIEWRECORDS+8,x ; Initialize view height sta WG_VIEWRECORDS+8,x ; Initialize view height
lda #VIEW_STYLE_RADIO WGCreate1x1_style:
sta WG_VIEWRECORDS+4,x ; Style lda #$FF ; Self-modifying code!
sta WG_VIEWRECORDS+4,x ; Style
stz WG_VIEWRECORDS+5,x ; Initialize scrolling stz WG_VIEWRECORDS+5,x ; Initialize scrolling
stz WG_VIEWRECORDS+6,x stz WG_VIEWRECORDS+6,x
stz WG_VIEWRECORDS+9,x ; Initialize state stz WG_VIEWRECORDS+9,x ; Initialize state
stz WG_VIEWRECORDS+10,x ; Initialize callback stz WG_VIEWRECORDS+10,x ; Initialize callback
stz WG_VIEWRECORDS+11,x stz WG_VIEWRECORDS+11,x
iny iny
lda (PARAM0),y lda (PARAM0),y
sta WG_VIEWRECORDS+12,x ; Title sta WG_VIEWRECORDS+12,x ; Title
iny iny
lda (PARAM0),y lda (PARAM0),y
sta WG_VIEWRECORDS+13,x sta WG_VIEWRECORDS+13,x
pla pla
jsr WGSelectView ; Leave this as the active view jsr WGSelectView ; Leave this as the active view
WGCreateRadio_done: RESTORE_XY
RESTORE_AXY pla
rts rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; WGCreateProgress ; WGCreateProgress
; Creates a new progress bar ; Creates a new progress bar

Binary file not shown.