- Painting code for button contents, in both states, with titles

This commit is contained in:
Quinn Dunki 2014-09-05 17:14:37 -07:00
parent f13f4b1ee2
commit 9924d41080
4 changed files with 62 additions and 23 deletions

View File

@ -9,4 +9,4 @@ Known issues
To Do:
------
- Make scanning support lower case
- Make WGFillRect support 1 height and 1 width

17
gui.s
View File

@ -24,23 +24,6 @@ main:
;jmp tortureTestRects
jsr WGClearScreen
jsr WGInverse
lda #<testStr
sta PARAM0
lda #>testStr
sta PARAM1
jsr WGPrint
ldx #0
ldy #1
jsr WGSetCursor
lda #<testStr2
sta PARAM0
lda #>testStr2
sta PARAM1
jsr WGPrint
jmp loop
lda #<testView
sta PARAM0

Binary file not shown.

66
views.s
View File

@ -284,6 +284,24 @@ WGPaintView_checkPlot:
bra WGPaintView_done
WGPaintView_button:
jsr paintButton
WGPaintView_done:
RESTORE_ZPS
RESTORE_ZPP
RESTORE_AY
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; paintButton
; Paints the contents of a button
; Y: Index into view records of button to paint
;
paintButton:
SAVE_AX
SAVE_ZPS
lda WG_VIEWRECORDS+13,y ; Prep the title string
sta PARAM0
lda WG_VIEWRECORDS+12,y
@ -296,20 +314,58 @@ WGPaintView_button:
lsr
sec
sbc SCRATCH1
sta WG_LOCALCURSORX
sta SCRATCH1 ; Cache this for left margin rendering
lda #0 ; Position and print title
sta WG_LOCALCURSORX
lda #0
sta WG_LOCALCURSORY
jsr WGSyncGlobalCursor
lda WG_VIEWRECORDS+9,y ; Is button highlighted?
and #$80
bne paintButton_titleSelected
jsr WGNormal
lda #' '+$80
bra paintButton_titleMarginLeft
paintButton_titleSelected:
jsr WGInverse
lda #' '
paintButton_titleMarginLeft:
ldx #0
paintButton_titleMarginLeftLoop:
cpx SCRATCH1
bcs paintButton_title ; Left margin finished
jsr WGPlot
inc WG_CURSORX
inc WG_LOCALCURSORX
inx
jmp paintButton_titleMarginLeftLoop
paintButton_title:
jsr WGPrint
ldx WG_VIEWRECORDS+2,y
stx SCRATCH1 ; Loop until right edge of button is reached
ldx WG_LOCALCURSORX
WGPaintView_done:
paintButton_titleMarginRightLoop:
cpx SCRATCH1
bcs paintButton_done ; Right margin finished
jsr WGPlot
inc WG_CURSORX
inc WG_LOCALCURSORX
inx
jmp paintButton_titleMarginRightLoop
paintButton_done:
RESTORE_ZPS
RESTORE_ZPP
RESTORE_AY
RESTORE_AX
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; WGEraseView
; Erases the current view (including decoration)