TnxUI namespace

Functions

void Initialize(UIHost& host)
Engine startup: the host whose widget library HUDs are built from, and which hands their actions here.
void Shutdown()
Engine shutdown: every HUD goes, and the host is let go.
auto SetHud(WorldBase& world, const Soul& soul, const char* asset) -> TnxHud
Show asset, a HUD with no class, as the HUD of soul's player in world.
auto SetHud(WorldBase& world, uint8_t ownerID, const char* asset) -> TnxHud
The same, for the player with owner ID ownerID.
auto SetHudWidget(WorldBase& world, const Soul& soul, TnxName asset, std::shared_ptr<TnxWidgetBase> widget) -> TnxHud
Show asset with widget, an instance of its class, which gives it its contexts and inputs and whose methods its actions call. SetHud<T> makes the instance and calls it.
auto SetHudWidget(WorldBase& world, uint8_t ownerID, TnxName asset, std::shared_ptr<TnxWidgetBase> widget) -> TnxHud
The same, for the player with owner ID ownerID.
auto HudProblems(const GGUI::GGWidgetLibrary& library, TnxName asset, TnxName widgetClass, std::span<const GGUI::GGWidgetInput> contexts) -> std::string
What is wrong with showing asset as a HUD of class widgetClass (invalid: none) whose class gives it contexts.
void ClearHud(WorldBase& world, uint8_t ownerID)
Remove the HUD of the player with owner ID ownerID in world, and what was added to it.
void ClearHuds(const WorldBase& world)
Remove every HUD of world: it is going away. HUDs that outlive their world (Session, Persistent) wait for the next.
void OnWorldInitialized(WorldBase& world)
A world was made: HUDs waiting for one are given it, for their player.
void OnLevelUnloaded(const WorldBase& world)
world's level unloaded: its Level HUDs go.
void OnPlayerLeft(uint8_t ownerID)
ownerID's player left the session: their Session HUDs go.
void Source(const char* name, WorldBase& world, std::function<void(TnxItems&)> fill)
The list items world's HUDs show for "source": "<name>".
void SourceChanged(const char* name)
What the source would add is different: fill it again, in every world.
void SourceChanged(const char* name, WorldBase& world)
The same, in world only.
void PumpSources()
Bring lists' items up to date: sources filled since, and entities spawned or gone. The UI host calls it between document updates.
auto GivenContexts(const WorldBase& world) -> std::vector<TnxGivenContext>
The contexts world's HUDs are given now, by player. For tools showing an asset as the game would (the widget designer, in a play session).
auto EntityContexts(WorldBase& world, TnxName type) -> std::vector<std::pair<EntityHandle, GGUI::GGContextValue>>
Every live entity of entity type type in world, with its context. Empty for a type that isn't an entity type.
void BuildHuds(GGUI::UI& ui, const WorldBase* world)
Build the HUDs of world's players into the element being built into, over the image of the world. Null world: every HUD.
void MountGameScreen(UIHost& host, PlatformWindowID window, bool bStats)
The game window's document: every HUD, and the stats overlay with bStats.
template<typename T, typename... TArgs>
auto SetHud(WorldBase& world, const Soul& soul, TArgs && ... args) -> TnxHud
Show the HUD asset named for class T ("class": "PlayerHud" in PlayerHud.tnxwidget) on soul's screen, with a new T made from args: SetHud<PlayerHud>(world, soul, Body).
template<typename T, typename... TArgs>
auto SetHud(WorldBase& world, uint8_t ownerID, TArgs && ... args) -> TnxHud
The same, for the player with owner ID ownerID.
template<typename T, typename... TArgs>
auto SetHudAs(WorldBase& world, const Soul& soul, const char* asset, TArgs && ... args) -> TnxHud
The same, showing asset, another asset of class T (a second look for one HUD).