Jazz2::UI::Multiplayer::MpHUD class

Player HUD for multiplayer.

Multiplayer-specific extension of HUD. It overrides the overview and score drawing to show multiplayer information such as the player's position in the current round, and adds a centered countdown display.

Base classes

class Jazz2::UI::HUD
Player HUD.
class Jazz2::Multiplayer::GameModes::IGameModeHUD
Drawing surface a game mode uses to render its own part of the HUD.

Constructors, destructors, conversion operators

MpHUD(Jazz2::Multiplayer::MpLevelHandler* levelHandler)
Creates a new instance.

Public functions

void OnUpdate(float timeMult) override
Called every frame to update the node state.
auto OnDraw(RenderQueue& renderQueue) -> bool override
Called when the node needs to be drawn, returning true if a command was added.
void ShowCountdown(std::int32_t secsLeft)
Shows countdown text in the middle of the screen.

Protected functions

void OnDrawOverview(const Rectf& view, const Rectf& adjustedView, Actors::Player* player) override
Called when some overview information of the player needs to be drawn.
void OnDrawScore(const Rectf& view, Actors::Player* player) override
Called when score of the player needs to be drawn.
void OnDrawSpectate(const Rectf& view, const Rectf& adjustedView, Actors::Player* player) override
Called instead of health/score/ammo when the player is in PlayerType::Spectate mode.
void OnAddPerformanceMetrics(PerformanceOverlay& overlay) override
Called when the detailed performance metrics are rebuilt, to add the rows only the level knows.
void DrawPositionInRound(const Rectf& view, Actors::Player* player) override
Draws the position of the player in the current round (also serves as IGameModeHUD::DrawPositionInRound).
void DrawMinimap(const Rectf& view, Actors::Player* player)
Draws the minimap in the top-right corner, in any game mode with a track, if the server allows it.
void DrawRoundResults()
Draws the final standings of the round in the middle of the screen while the round is ending.
void DrawHudText(Jazz2::Multiplayer::GameModes::GameModeFontType font, StringView text, float x, float y, float shadowOffsetY, Alignment alignment, const Colorf& color, float scale, float charSpacing, float angleOffset, float variance, float speed) override
Draws a text string (shadow + main) with the small or medium HUD font.
void DrawHudIcon(Jazz2::Multiplayer::GameModes::GameModeHudIcon icon, float x, float y, float shadowOffsetY, Alignment alignment, const Colorf& color, float scaleX, float scaleY) override
Draws a semantic HUD icon (shadow + main).

Function documentation

void Jazz2::UI::Multiplayer::MpHUD::OnDrawSpectate(const Rectf& view, const Rectf& adjustedView, Actors::Player* player) override protected

Called instead of health/score/ammo when the player is in PlayerType::Spectate mode.

A spectator has no health, weapons or score of its own, but the parts of the HUD that describe the round itself still apply - multiplayer draws the leaderboard and the minimap here.

void Jazz2::UI::Multiplayer::MpHUD::OnAddPerformanceMetrics(PerformanceOverlay& overlay) override protected

Called when the detailed performance metrics are rebuilt, to add the rows only the level knows.

Runs after the rows every screen has were added, and only when there are new numbers to show - twice a second - rather than every frame (see PerformanceOverlay).

void Jazz2::UI::Multiplayer::MpHUD::DrawHudText(Jazz2::Multiplayer::GameModes::GameModeFontType font, StringView text, float x, float y, float shadowOffsetY, Alignment alignment, const Colorf& color, float scale, float charSpacing, float angleOffset, float variance, float speed) override protected

Draws a text string (shadow + main) with the small or medium HUD font.

angleOffset, variance and speed drive the optional wavy-text animation (all 0 = static text, which is what most HUD text uses).