pitch-dark/src/ui.common.a
2018-04-01 18:26:54 -04:00

79 lines
1.9 KiB
Plaintext

;license:MIT
;(c) 2018 by 4am
;
; User interface - common views and paint routines across screens
;
; Public functions
; - CreateRadio
; - CreateCheckbox
; - CreateButton
; - PaintTitleBar
;
;------------------------------------------------------------------------------
; CreateRadio/CreateCheckbox/CreateButton
; creates a WeeGUI UI control with the 'raw title' option set
;
; in: stack contains 2 bytes of parameters:
; +1 [word] pointer to WeeGUI view configuration block
; out: $00/$01 clobbered
; all registers clobbered
;------------------------------------------------------------------------------
!zone {
CreateRadio
ldx #WGCreateRadio
!byte $2C ; hide next 2 bytes
CreateCheckbox
ldx #WGCreateCheckbox
!byte $2C ; hide next 2 bytes
CreateButton
ldx #WGCreateButton
stx .type
+PARAMS_ON_STACK 2
ldy #$01
lda (PARAM),y
sta PARAM0
iny
lda (PARAM),y
sta PARAM1
.type=*+1
ldx #$FD ; SMC
jsr WeeGUI
ldx #WGViewSetRawTitle
lda #1
sta PARAM0
jmp WeeGUI
}
;------------------------------------------------------------------------------
; PaintTitleBar
; paints the title bar
;
; in: none
; out: all registers and flags clobbered
;------------------------------------------------------------------------------
!zone {
PaintTitleBar
ldy #79
- sty PARAM0
stz PARAM1
ldx #WGSetGlobalCursor
jsr WeeGUI
ldx #WGPlot
lda .stringTitle,y
jsr WeeGUI
dey
bpl -
ldx #WGSyncGlobalCursor
jmp WeeGUI
.stringTitle
!raw " "
!byte 16
!raw "itch "
!byte 4
!raw "ark ",0
}