mirror of
https://github.com/a2-4am/pitch-dark.git
synced 2024-09-27 04:54:48 +00:00
106 lines
2.9 KiB
Plaintext
106 lines
2.9 KiB
Plaintext
;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 {
|
|
;------------------------------------------------------------------------------
|
|
; 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
|
|
;------------------------------------------------------------------------------
|
|
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 ($00),y
|
|
sta PARAM0
|
|
iny
|
|
lda ($00),y
|
|
sta PARAM1
|
|
.type=*+1
|
|
ldx #$FD ; set at runtime
|
|
jsr WeeGUI
|
|
ldx #WGViewSetRawTitle
|
|
lda #1
|
|
sta PARAM0
|
|
jmp WeeGUI
|
|
|
|
;------------------------------------------------------------------------------
|
|
; CreateTitleView
|
|
; creates the standard title bar on top row of screen
|
|
;
|
|
; in: none
|
|
; out: A,X clobbered
|
|
; title view selected
|
|
;------------------------------------------------------------------------------
|
|
CreateTitleView
|
|
ldx #WGCreateView ; create title bar on top line
|
|
lda #<viewTitle
|
|
sta PARAM0
|
|
lda #>viewTitle
|
|
sta PARAM1
|
|
jmp WeeGUI
|
|
|
|
;------------------------------------------------------------------------------
|
|
; PaintTitleView
|
|
; paints the title bar
|
|
;
|
|
; in: none
|
|
; out: all registers clobbered
|
|
; title view selected
|
|
;------------------------------------------------------------------------------
|
|
PaintTitleView
|
|
ldx #WGSelectView
|
|
lda #ID_TITLE
|
|
jsr WeeGUI
|
|
jsr INVERSE
|
|
ldx #WGPrint
|
|
lda #<.stringTitle
|
|
sta PARAM0
|
|
lda #>.stringTitle
|
|
sta PARAM1
|
|
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
|
|
}
|