Skip to content

GUI Layout

App: apps/gui_layout/

Demonstrates every Nuklear layout system in one window, with labeled sections and buttons to make column widths visible.

Terminal window
% ./plume3d gui_layout
Layout typeMethod(s)
Dynamic (equal columns)layoutRowDynamic(height, cols)
Static (fixed-width columns)layoutRowStatic(height, itemWidth, cols)
Manual row (ratio or pixel)layoutRowBegin / layoutRowPush / layoutRowEnd
Template (mixed column types)layoutRowTemplateBegin / Push* / End
Space (absolute rects)layoutSpaceBegin / layoutSpacePush / layoutSpaceEnd
Groups (scrollable sub-region)beginGroup / endGroup
// Ratio columns (30% label + 70% edit)
Gui.layoutRowBegin(1, 30, 2) // format=1 (ratio)
Gui.layoutRowPush(0.3)
Gui.label("Name:")
Gui.layoutRowPush(0.7)
_name = Gui.editString(_name, 64)
Gui.layoutRowEnd()
// Template: one dynamic + one static column
Gui.layoutRowTemplateBegin(30)
Gui.layoutRowTemplatePushDynamic()
Gui.layoutRowTemplatePushStatic(80)
Gui.layoutRowTemplateEnd()
// Space layout (absolute position within a 200-high region)
Gui.layoutSpaceBegin(0, 200, 3) // format=0 (static)
Gui.layoutSpacePush(10, 10, 80, 30)
Gui.buttonLabel("A")
Gui.layoutSpacePush(100, 50, 80, 30)
Gui.buttonLabel("B")
Gui.layoutSpaceEnd()
// Scrollable group
if (Gui.beginGroup("Items", 0)) {
for (i in 0...20) {
Gui.layoutRowDynamic(20, 1)
Gui.label("Item %(i)")
}
Gui.endGroup()
}
  • Gui — all layout methods.
  • GuibeginGroup, endGroup, groupGetScroll, groupSetScroll.