GGUI/Public/UIWidgetAsset.h file

Widget assets: UI made as data (docs/ui/Widgets.md).

GGWidgetLibrary widgets;
widgets.Load("StatBar.tnxwidget", text, problems);       // or again, to hot reload
context.SetWidgets(&widgets);

ui.Use("StatBar", { { "Value", TnxBind(body, &CHealth<>::Value) }, { "Max", 100.0f }, { "Label", "Game.Hud.Health" } });

A file is compiled once into elements whose names, inputs, and formulas are resolved; a use builds it through the same ui.* calls code makes, as a component whose properties are its inputs, so a change to one use's inputs re-runs only that use. Problems are reported, worded to say what to change and where, and the rest of the asset still builds.

The core knows nothing of the engine. Contexts (game state named in formulas, Player.CHealth.Value) are resolved by a hook the host sets; actions (a command, a call to the asset's class) go to a handler the host sets; and widget classes are found through a resolver the host sets. So are a list's items, unless they come from a data table (.tnxtable), which the library loads like an asset.

Namespaces

namespace GGUI

Classes

struct GGUI::GGWidgetProblem
Something wrong with an asset or a use of one.
struct GGUI::GGContextValue
Game state given to an asset: what its formulas read Ctx.Component.Field from.
class GGUI::GGInputValue
A value given to one of an asset's inputs, or one of its literals.
struct GGUI::GGInputValue::OwnedText
Text it holds a copy of.
struct GGUI::GGWidgetInput
What a use gives an asset: { { "Value", binding }, { "Max", 100.0f } }.
struct GGUI::GGWidgetAction
An element was used: a button clicked, something dropped. The host decides what it does.
struct GGUI::GGReferenceResolver
Finds an asset's current name from its persistent ID, so a file that references assets by ID ({ "guid": "...", "name": "StatBar" }) keeps working when they are renamed. Set by the host.
struct GGUI::GGContextResolver
Resolves the fields contexts read. Set by the host (the engine resolves against reflection).
struct GGUI::GGCommandChecker
Checks a command action against the commands the host knows: false, with why, for a command it hasn't got or a field the command hasn't. Set by the host.
struct GGUI::GGListItem
One item of a list: its key, which selection and focus follow, and what the item's widget reads as Item.
struct GGUI::GGItemFeed
The items a list shows, kept by whoever makes them.
struct GGUI::GGItemQuery
Where a list's items come from, as its asset says.
struct GGUI::GGItemSources
Finds the items for a query. Set by the host. Null, with why, for a source it hasn't got. A feed returned stays valid while the host lives.
struct GGUI::GGContextInfo
A context an asset declares: its name, and what it is (an entity type, a component, a view model).
struct GGUI::GGInputInfo
An input an asset declares: its name and what it takes.
struct GGUI::GGClassInfo
A widget class: the code behind a widget asset that names it ("class": "PlayerHud").
struct GGUI::GGClassInfo::Call
A method its assets' actions call.
struct GGUI::GGClassInfo::Widget
Its members that are widgets of a class: each is what the element of its name, using an asset of that class, is given and calls.
struct GGUI::GGClassResolver
Finds widget classes by name. Set by the host. Without one, an asset naming a class is reported.
struct GGUI::GGRegionInfo
A region of an asset: an element the host adds widgets to ("region": true).
struct GGUI::GGCurve
A curve asset (.tnxcurve): a motion over time that a track plays in place of its own keys, scaled and stretched where it is used. Its keys are in time order, their tangents worked out.
class GGUI::GGWidgetLibrary
Named widget assets, loaded from file text. Hot reload is loading a file again.
struct GGUI::GGSlotFill
Content for a slot of a used asset: { "Content", [=](UI& ui) { ... } }.
struct GGUI::GGMemberInputs
What a widget member of a class gives the element built as it: its contexts and inputs, and those of its own widget members.
struct GGUI::UseProps
Properties of a ui.Use: which asset, its inputs and contexts, and what fills its slots and regions (a fill named after a region is built inside it, after its own children).