Gen UI Library
ImGui widget library providing reusable UI components for the gen editor framework.
ImGui widget library providing reusable UI components for the gen editor framework.
Overview
The ui library module supplies styled buttons, icons, column layouts, and label utilities used across all gen editor windows. It loads icon textures from the gen assets folder and provides consistent color theming.
Module Table: M
| Field | Type | Description |
|---|---|---|
M.colorNav | ImVec4 | Navigation highlight color (blue-ish) |
M.colorOff | ImVec4 | Disabled/off color |
M.cbutOff | ImVec4 | Button off color (dim) |
M.cbutOn | ImVec4 | Button on color (bright) |
Functions
| Function | Signature | Description |
|---|---|---|
M.columnRight(width, border) | (number, boolean?) | Sets up a 2-column layout with right column at specified width |
M.buttonTxt(key, txt, dim, c, cbg, shift, center) | (string, string, ImVec2?, ImVec4?, table|ImVec4?, ImVec2?, boolean?) | Renders a text-overlay button using an icon background |
M.buttonImg(kv, src, dim, c, cbg, scale, shift) | (string|table, string, ImVec2?, ImVec4?, ImVec4?, vec3?, ImVec2?) | Renders an icon image button with optional scaling |
M.check(lbl, key, val) | (string, string, boolean?) | Checkbox widget bound to env.ui[key] |
M.sliderC(lbl, key, mm, isint, format) | (string, string, table, boolean?, string?) | Two-column slider (label left, slider right via NextColumn) |
M.slider(lbl, key, mm, isint, format) | (string, string, table, boolean?, string?) | Inline slider widget |
M.check_(lbl, key) | (string, string) | Checkbox variant reading value from env.ui[key] |
M.combo(lbl, key, list, isel) | (string, string, table, number?) | Combo/dropdown widget |
M.table(id, data, cb, adim, ahead, cbsort) | (string, table?, function, table, table?, function?) | ImGui table with optional sortable headers. Calls cb(k,v) per row |
M.listBox(row, dim, lineH) | (table, any, number) | List box with star favorites and two-column layout |
M.tree2ui(htree) | (table?) | Renders hint/hotkey tree as inline pill-style labels |
M.tree2ui_(htree) | (table?) | Alternative hint tree renderer with vertical spacing and background rects |
Color Constants
| Constant | Value | Usage |
|---|---|---|
colorOn | (0.5, 0.7, 0.5, 1) | Active/enabled state |
colorOff | (0.5, 0.5, 0.5, 0.7) | Inactive/disabled state |
bgActive | (0.3, 0.3, 0.3, 1) | Active background |
Icons
Icons are loaded from /lua/ge/extensions/editor/gen/assets/_icon/:
| Key | File | UV Coords |
|---|---|---|
car | car.png | Full image |
folder | folder.png | Full image |
link | link.png | Vertical crop (0.2–0.8) |
mglass | mglass.png | Full image |
graph | graph.png | Full image (slight overflow) |
star | star.png | Padded (0.1–0.9) |
window3 | window3.png | Padded (0.1–0.9) |
Usage Example
local UI = require('/lua/ge/extensions/editor/gen/lib/ui')
-- Create a right-aligned column layout
UI.columnRight(200)
-- Render a styled text button
UI.buttonTxt('myButton', 'Click Me', nil, UI.colorNav)
-- Use navigation color for active elements
im.TextColored(UI.colorNav, "Active Item")Note on Local Functions
labelHide(shift, lbl)- Local (not exported). Draws a background rectangle to hide default ImGui labels.
See Also
- Gen Utils - Core utility functions
- Gen Mesh Explorer - Uses UI lib extensively
- Gen Render - Debug rendering
Gen JBeam Library
JBeam file parsing library for the gen editor's mesh and vehicle inspection tools.
Master Spline - Auto Road Generation
Generates roads between waypoints using A* pathfinding on the terrain heightmap grid. Handles slope avoidance, turning radius constraints, hairpin widening, and elevation optimization against road des