pitch-dark/src/ui.common.a

102 lines
2.8 KiB
Plaintext
Raw Normal View History

2018-03-01 16:06:00 +00:00
;license:MIT
;(c) 2018 by 4am
;
; User interface - common views and paint routines across screens
;
; Public functions
; - CreateRadio
; - CreateCheckbox
; - CreateButton
; - CreateTitleView
; - PaintTitleView
;
; ROM routines
INVERSE = $FE80
NORMAL = $FE84
; View IDs (application-specific, acceptable range 0..15, no duplicates)
ID_TITLE = 0
!zone {
2018-03-27 21:17:47 +00:00
;------------------------------------------------------------------------------
; 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
;------------------------------------------------------------------------------
2018-03-01 16:06:00 +00:00
CreateRadio
ldx #WGCreateRadio
!byte $2C ; hide next 2 bytes
CreateCheckbox
ldx #WGCreateCheckbox
!byte $2C ; hide next 2 bytes
CreateButton
ldx #WGCreateButton
2018-03-26 18:57:06 +00:00
stx .type
+PARAMS_ON_STACK 2
2018-03-01 16:06:00 +00:00
ldy #$01
lda ($00),y
sta PARAM0
iny
lda ($00),y
sta PARAM1
2018-03-26 18:57:06 +00:00
.type=*+1
2018-03-28 15:48:47 +00:00
ldx #$FD ; SMC
2018-03-01 16:06:00 +00:00
jsr WeeGUI
ldx #WGViewSetRawTitle
lda #1
sta PARAM0
jmp WeeGUI
2018-03-27 21:17:47 +00:00
;------------------------------------------------------------------------------
; CreateTitleView
; creates the standard title bar on top row of screen
;
; in: none
; out: A,X clobbered
; title view selected
;------------------------------------------------------------------------------
2018-03-01 16:06:00 +00:00
CreateTitleView
ldx #WGCreateView ; create title bar on top line
2018-03-29 02:49:51 +00:00
+LDADDR viewTitle
+STAY PARAM0
2018-03-01 16:06:00 +00:00
jmp WeeGUI
2018-03-27 21:17:47 +00:00
;------------------------------------------------------------------------------
; PaintTitleView
; paints the title bar
;
; in: none
; out: all registers clobbered
; title view selected
;------------------------------------------------------------------------------
2018-03-01 16:06:00 +00:00
PaintTitleView
ldx #WGSelectView
lda #ID_TITLE
jsr WeeGUI
jsr INVERSE
ldx #WGPrint
2018-03-29 02:49:51 +00:00
+LDADDR .stringTitle
+STAY PARAM0
2018-03-01 16:06:00 +00:00
jsr WeeGUI
jmp NORMAL
viewTitle
!byte ID_TITLE ; view ID
!byte 0 ; style
!byte 0 ; left
!byte 0 ; top
!byte 80 ; visible width
!byte 1 ; visible height
!byte 80 ; width
!byte 1 ; height
.stringTitle
!raw " Pitch Dark ",0
2018-03-26 20:28:20 +00:00
}