TnxUI.h file
TnxUI: each local player's HUD (docs/ui/Widgets.md, HUDs and Regions).
TnxHud hud = TnxUI::SetHud<PlayerHud>(world, soul, Player->Body); // its class (TnxWidget.h) TnxWidgetRef note = hud.Add("Notifications", "QuestUpdate", { { "Title", quest.Name } }); hud.Remove(note);
Everything on a player's screen belongs to their HUD: placed in its asset, or added while the game runs to a region the asset declares. Above the HUD every one has three layers, bottom first: Menu, Modal (takes focus and blocks what is under it), and Toast.
A HUD is recorded here and built wherever its player's view is drawn: the game window (MountGameScreen), or an editor play view (BuildHuds), over the image of that player's world.
What its elements do goes to the HUD: a command is sent from the player's world, show and hide add to and remove from regions and layers, and a call runs a method of its class.
A list in a HUD's asset shows the items of its world: every entity of a type ("source": { "entities": "EUpgrade" }), or a source the game names and fills:
TnxUI::Source("Shop.Offers", world, [this](TnxItems& items) { for (const ShopOffer& o : Offers) items.Add(o); }); TnxUI::SourceChanged("Shop.Offers"); // when what it would add is different
Any thread. A world going away calls ClearHuds.
Namespaces
Classes
- struct TnxWidgetRef
- A widget added to a HUD (TnxHud::
Add), to remove it by. - class TnxItems
- The items a named source adds, in the order a list shows them unless it sorts them.
- struct TnxGivenContext
- A context a HUD's class gives its asset, as it is now.
- class TnxHud
- One player's HUD.