add proper fnl modules to demo
This commit is contained in:
parent
9bb9fa5f5b
commit
47c4f2045c
14 changed files with 510 additions and 240 deletions
32
demo/mod/debug_ui.fnl
Normal file
32
demo/mod/debug_ui.fnl
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
(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}
|
||||
Loading…
Add table
Add a link
Reference in a new issue