In my_app.cpp:
{
The application: owns the windows, the systems and the frame loop.
Definition gui_application.h:185
ui.
Field(excited, excited ?
"Yes" :
"No");
void Label(ID id, std::string_view text, StyleRef style, LayoutOverride &&constraints={})
A label for the control after it: a click focuses that control.
void EndLabelGroup()
Closes BeginLabelGroup.
bool BeginLabelGroup(ID id, CssPx defaultWidth=120, CssPx minWidth=40, CssPx maxWidth=500, bool resizable=true)
Label group: Labels/DragLabels inside share one width, resizable by dragging any label's right edge.
bool Field(ID id, bool &value, std::string_view text, StyleRef style, LayoutOverride &&constraints={})
A bool as a Toggle labelled text.
Drag speed and range of a numeric Field, specialized per value type.
Definition gui_numeric_field_config.h:19
- Field picks the editor from the type:
- text for std::string
- number for int
- toggle for bool
- Each field edits the value in place.
- NumericFieldConfig limits times to 1..5.
- The label group lines each Label up with the next control:
- the labels go in a label column, which the user can resize
- clicking a label focuses its field
- The toggle's text is recomputed every frame, so it follows the value.
Below the fields, the greeting:
const std::string text = "Hello, " + name + (excited ? "!" : ".");
for (int i = 0; i < times; ++i)
void Text(ID id, std::string_view text, StyleRef style, LayoutOverride &&constraints={})
Static text.
- The greeting updates on the next frame after typing.
- The Text calls in the loop share a call site, but each gets its own ID.
Close GreetingPanel::Draw with }.
Previous: 2. Buttons | Tutorial | Next: 4. The app