Binding.h file
Bindings: an element property driven by data.
A binding is data, not code: an expression over fields with a small closed set of operations.
const GGExpr health = GGExpr::Field(HealthField) / GGExpr::Field(MaxHealthField); ui.Value(GGBind(player, health)); // a bar's fill ui.Visible(GGBind(player, health < 1.0f)); // shown only when hurt
Being data, an expression can be evaluated on the CPU or compiled for the GPU by a world-UI template, it lists exactly the fields it reads, and tools can display it. When the value changes, only that property updates and the node is dirtied for paint or layout according to the property's class. No component function re-runs.
The core doesn't know what a field is. FieldIDs are assigned by the integration layer, and a BindingReader it supplies reads them (for the engine: from the published frame). BindLambda is the escape hatch for values an expression can't express; it is CPU only.
Namespaces
- namespace GGUI
Classes
- struct GGUI::BindingReader
- How bindings read data. Supplied by the integration layer per update.
- struct GGUI::BigField
- BigField: a field holding a BigNumber.
- struct GGUI::BigRatio
- Numerator / Denominator, clamped to 0..1.
- struct GGUI::BigAtLeast
- 1 if Left >= Right, else 0.
- class GGUI::GGExpr
- GGExpr: a value computed from fields and constants.
- class GGUI::GGBinding
- GGBinding: an expression (or a lambda) plus the target it reads from.
- class GGUI::TemplateEntity
- TemplateEntity: a placeholder for "the entity this instance is drawn for".
- struct GGUI::NumberFormat
- How a bound number is shown as text.
- struct GGUI::PaintInput
- Per-node paint inputs, beyond the rect.