Skip to content

GUI Toggles

App: apps/gui_toggles/

Demonstrates the three selection-state widgets: checkbox for independent toggles, radio for exclusive group selection, and selectableLabel for list selection.

Terminal window
% ./plume3d gui_toggles
  • Checkboxes — four independent toggles (shadows, vsync, fullscreen, debug). Each is stored in its own Bool variable and updated each frame.
  • Radio buttons — quality level (Low/Medium/High/Ultra). Implemented as four radio calls sharing an integer index; only one can be active at a time.
  • Selectable labels — an item list (_items) where clicking sets _selectedItem. Shows both align and selected parameters.
// Independent checkbox
_shadows = Gui.checkbox("Enable Shadows", _shadows)
_vsync = Gui.checkbox("VSync", _vsync)
// Exclusive radio group (compare against index)
if (Gui.radio("Low", _quality == 0)) _quality = 0
if (Gui.radio("Medium", _quality == 1)) _quality = 1
if (Gui.radio("High", _quality == 2)) _quality = 2
if (Gui.radio("Ultra", _quality == 3)) _quality = 3
// Selectable label list (align=17 = NK_TEXT_LEFT)
for (i in 0..._items.count) {
if (Gui.selectableLabel(_items[i], 17, _selectedItem == i)) {
_selectedItem = i
}
}
Gui.label("Selected: %(_selectedItem >= 0 ? _items[_selectedItem] : "none")")
  • Guicheckbox, radio.
  • GuiselectableLabel.