79 lines
2.5 KiB
Scheme
79 lines
2.5 KiB
Scheme
(define COLOR_TRANSPARENT '(0.0 0.0 0.0 0.0))
|
|
(define COLOR_WHITE '(1.0 1.0 1.0 1.0))
|
|
(define COLOR_BLACK '(0.0 0.0 0.0 1.0))
|
|
|
|
(define style-default
|
|
(style-new #:text-color COLOR_WHITE
|
|
#:text-color-hovered COLOR_WHITE
|
|
#:text-color-clicked COLOR_WHITE
|
|
#:ghost-text-color '(1.0 1.0 1.0 0.5)
|
|
#:icon-color COLOR_WHITE
|
|
#:icon-color-hovered COLOR_WHITE
|
|
#:icon-color-clicked COLOR_WHITE
|
|
#:scrollbar-color COLOR_WHITE
|
|
#:scrollbar-color-hovered COLOR_WHITE
|
|
#:scrollbar-color-clicked COLOR_WHITE
|
|
#:border-color COLOR_WHITE
|
|
#:progress-color COLOR_WHITE
|
|
#:resize-handle-color COLOR_WHITE))
|
|
|
|
(define style-window
|
|
(style-new #:background-color '(0.2 0.2 0.2 1.0)
|
|
#:background-color-hovered '(0.2 0.2 0.2 1.0)
|
|
#:background-color-clicked '(0.3 0.3 0.3 1.0)
|
|
#:text-color COLOR_WHITE
|
|
#:text-color-hovered COLOR_WHITE
|
|
#:text-color-clicked COLOR_WHITE
|
|
#:border-color '(0.5 0.5 0.5 1.0)
|
|
#:resize-handle-color COLOR_WHITE
|
|
#:border-width 3))
|
|
|
|
(define style-container
|
|
(style-new #:background-color '(0.3 0.3 0.3 1.0)
|
|
#:background-color-hovered '(0.3 0.3 0.3 1.0)
|
|
#:background-color-clicked '(0.3 0.3 0.3 1.0)
|
|
#:border-color '(0.4 0.4 0.4 1.0)
|
|
#:border-width 2))
|
|
|
|
(define style-icon-button
|
|
(style-new #:icon-color COLOR_WHITE
|
|
#:icon-color-hovered '(1.0 1.0 0.0 1.0)
|
|
#:icon-color-clicked '(1.0 0.0 0.0 1.0)))
|
|
|
|
|
|
(define (widget-checkbox-icon-switch widget event)
|
|
(if (= (widget-get-icon widget) 1)
|
|
(widget-set-icon! widget 2)
|
|
(widget-set-icon! widget 1)))
|
|
|
|
;; The function is evaulated and returns a pointer, the game eats it
|
|
;; and adds it to the UI root. Boom.
|
|
(define (widget-checkbox text flag . args)
|
|
(apply
|
|
widget-new
|
|
(append
|
|
(list 'container #:horizontal #t #:layout-spacing 8)
|
|
args
|
|
(list
|
|
(widget-new 'plain #:style style-icon-button #:icon 1 #:aspect-ratio 1
|
|
#:on-click (lambda (w e) (widget-checkbox-icon-switch w e) (flags-switch flag)))
|
|
(widget-new 'label #:style style-default #:text text #:layout-weight 1)))))
|
|
|
|
(widget-new
|
|
'window
|
|
#:style style-window
|
|
#:text "Debug window"
|
|
#:w 350
|
|
#:layout-padding 8
|
|
#:vertical #f
|
|
#:horizontal #t
|
|
;; The rest is children.
|
|
(widget-new
|
|
'flowbox
|
|
#:style style-container
|
|
#:layout-padding 8
|
|
#:layout-spacing 8
|
|
#:horizontal #t
|
|
(widget-checkbox "Flight" "flight_enabled" #:layout-weight 0.5 #:h 20)
|
|
(widget-checkbox "Wireframe" "wireframe_enabled" #:layout-weight 0.5 #:h 20)))
|