33 lines
1.4 KiB
Text
33 lines
1.4 KiB
Text
|
|
(local pxl8 (require :pxl8))
|
||
|
|
|
||
|
|
(fn render [state]
|
||
|
|
(var new-state {})
|
||
|
|
(when state.show-debug-ui
|
||
|
|
(let [window-h (if state.use-texture 210 180)
|
||
|
|
window-open (pxl8.ui_window_begin "Debug Menu (F8)" 10 10 250 window-h)]
|
||
|
|
(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 (and new-val state.init-texture)
|
||
|
|
(state.init-texture))))
|
||
|
|
(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}
|