28 lines
1.2 KiB
Fennel
28 lines
1.2 KiB
Fennel
(local pxl8 (require :pxl8))
|
|
|
|
(fn render [state]
|
|
(var new-state {})
|
|
(when state.show-debug-ui
|
|
(let [window-open (pxl8.ui_window_begin "Debug Menu (F8)" 10 10 256 128)]
|
|
(when window-open
|
|
(pxl8.ui_layout_row 1 0 0)
|
|
(pxl8.ui_label (string.format "FPS: %.0f" (or state.fps 0)))
|
|
(let [(changed new-val) (pxl8.ui_checkbox "Wireframe" state.wireframe)]
|
|
(when changed (set new-state.wireframe new-val)))
|
|
(let [(changed new-val) (pxl8.ui_checkbox "Auto-rotate" state.auto-rotate)]
|
|
(when changed (set new-state.auto-rotate new-val)))
|
|
(let [(changed new-val) (pxl8.ui_checkbox "Orthographic" state.orthographic)]
|
|
(when changed (set new-state.orthographic new-val)))
|
|
(let [(changed new-val) (pxl8.ui_checkbox "Texture" state.use-texture)]
|
|
(when changed (set new-state.use-texture new-val)))
|
|
(when state.use-texture
|
|
(pxl8.ui_indent 20)
|
|
(let [(changed new-val) (pxl8.ui_checkbox "Affine mapping" state.affine)]
|
|
(when changed (set new-state.affine new-val)))
|
|
(pxl8.ui_indent -20))
|
|
(pxl8.ui_window_end))
|
|
(when (not window-open)
|
|
(set new-state.show-debug-ui false))))
|
|
new-state)
|
|
|
|
{: render}
|