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 ofsoul'splayer inworld. - 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
assetwithwidget, 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
assetas a HUD of classwidgetClass(invalid: none) whose class gives itcontexts. - void ClearHud(WorldBase& world, uint8_t ownerID)
- Remove the HUD of the player with owner ID
ownerIDinworld, 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'slevel unloaded: its Level HUDs go.- void OnPlayerLeft(uint8_t ownerID)
ownerID'splayer left the session: their Session HUDs go.- void Source(const char* name, WorldBase& world, std::function<void(TnxItems&)> fill)
- The list items
world'sHUDs 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
worldonly. - 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'sHUDs 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
typeinworld, 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'splayers into the element being built into, over the image of the world. Nullworld: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) onsoul'sscreen, with a newTmade fromargs: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 classT(a second look for one HUD).