GGUI/Public/UIWidgetRegistry.h file

The widget registry: every element type a widget asset can be made of, the built-in ones and the code widgets a game adds, with the properties each takes.

The file's loader checks keys against it, the widget designer lists its palette and Details from it, and code widgets are read from files and built through it.

A code widget is a props struct with reflected fields (UIReflect.h) and a function that builds it, registered once in a .cpp:

struct GaugeProps
{
    float Value = 0.0f;
    GGColor Needle = GGColor::White();
    GG_REGISTER_FIELDS(GaugeProps, Value, Needle)
};
void BuildGauge(UI& ui, const GaugeProps& props) { ... }
GG_REGISTER_WIDGET(Gauge, GaugeProps, BuildGauge)

An asset then writes { "name": "Speed", "type": "Gauge", "value": 0.5, "needle": "#FF0000" }.

Namespaces

namespace GGUI

Classes

struct GGUI::GGWidgetField
One property a widget type takes: a reflected field of its props, or an argument of its call (a Label's text, a Progress's value).
struct GGUI::GGWidgetType
A type of element: a built-in one, or a code widget.
class GGUI::GGWidgetRegistry
Every element type widget assets can use, and the properties each takes.