Hud¶
The race HUD, as parts a plugin can move, resize, turn off or keep shown. A part is known by a key such as
PlayerUI/TimeGroup (the timer and splits), PlayerUI/WBP_InputVisualizer, RaceUI/WBP_Leaderboard_0, or
Window/<plugin>/<n> for plugins' windows on screen. The host keeps a layout in place while the game rebuilds and
animates its HUD, until the plugin clears it.
Elements¶
array<string>@ Hud::Elements()
The parts of the HUD on screen now; empty off a track. Name, Label, Shown and ParentShown answer about the
parts of the last call.
Example
array<string>@ parts = Hud::Elements();
for (uint i = 0; i < parts.length(); i++)
Log::Info(parts[i] + " is " + Hud::Name(parts[i]));
Name¶
string Hud::Name(const string &in)
The part's widget name in the game ("TimeGroup", "WBP_Split").
Example
string name = Hud::Name(key);
Label¶
string Hud::Label(const string &in)
A plugin window's plugin name; "" for the game's own parts.
Example
string label = Hud::Label(key) != "" ? Hud::Label(key) : Hud::Name(key);
Shown¶
bool Hud::Shown(const string &in)
Whether the part is on screen (it and everything it sits in are visible).
Example
if (!Hud::Shown(key))
label += " (hidden by the game)";
ParentShown¶
bool Hud::ParentShown(const string &in)
Whether what the part sits in is on screen: a part the game hides for now (a split before the first checkpoint) is not shown, but its parent is.
Example
bool canEdit = Hud::Shown(key) || Hud::ParentShown(key);
SetLayout¶
void Hud::SetLayout(const string &in, double, double, double, Mode = Normal)
Moves a part by x, y pixels from where the game puts it, sizes it (1 = its own size) and sets its mode:
Hud::Normal, Hud::Off (invisible, though the game still shows and hides it) or Hud::On (shown even when the game
hides it). Kept until ClearLayout.
Example
Hud::SetLayout("PlayerUI/TimeGroup", 300, 50, 1.4);
Hud::SetLayout("RaceUI/WBP_Leaderboard_0", 0, 0, 1, Hud::Off);
ClearLayout¶
void Hud::ClearLayout(const string &in)
Gives the part back to the game.
Example
Hud::ClearLayout("PlayerUI/TimeGroup");
SetEditing¶
void Hud::SetEditing(bool)
While on, parts laid out as Off show faintly instead of not at all, so they can be found and turned back on.
Example
Hud::SetEditing(true);
SetBlink¶
void Hud::SetBlink(const string &in)
Makes one part blink, shown even if the game hides it; "" for none.
Example
Hud::SetBlink(chosenKey);
SetPartColor¶
bool Hud::SetPartColor(const string &in, const string &in, float, float, float, float)
Tints a named part of a HUD part: a variable of its widget blueprint, such as the input display's Key_Up,
Key_Down, Key_Left, Key_Right, Key_Jump (boxes) or Up, Down, Left, Right (arrows). False if there is no
such part.
Example
Hud::SetPartColor("PlayerUI/WBP_InputVisualizer", "Key_Jump", 1.0f, 0.1f, 0.1f, 0.85f);
ResetPartColor¶
void Hud::ResetPartColor(const string &in, const string &in)
Gives the part back its own colour.
Example
Hud::ResetPartColor("PlayerUI/WBP_InputVisualizer", "Key_Jump");
HideGame¶
void Hud::HideGame(bool)
Hides the game's race UI (the HUD, the header, the leaderboard and the race's menus) while true, and puts it back
with false or when the plugin stops. The footer bar stays, with the plugin buttons in it (UI::FooterHeight says how
tall it is). What's hidden can't be clicked, so its buttons can't be pressed unseen.
In a track editor test run it hides the run's own HUD (host 0.25.0). For a clear view of the track, such as a replay
or ghost viewer. Requires host 0.14.0.
Example
Hud::HideGame(true); // nothing of the game's over the track
HideEditor¶
void Hud::HideEditor(bool)
Hides the track editor's own screens around a test run (its header, menus and footer) while true, keeping the race
clock, and puts them back with false or when the plugin stops. Only the editor's: it does nothing on a track. Hiding
them during a test run can take the clock with it; it's meant for after a test run's finish, to show the world and the
time only. Requires host 0.25.0.
Example
if (Race::IsComplete())
Hud::HideEditor(true);
Hud::Mode¶
Hud::Normal, Hud::Off, Hud::On