group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
HudWidget Struct Referenceabstract

Base class for a retained HUD element. More...

#include <HudWidget.hpp>

Inheritance diagram for HudWidget:
[legend]

Public Member Functions

virtual ~HudWidget ()=default
virtual void update (float dt, const HudGameState &state, HudTweenPool &tweens)=0
 Called each frame before draw(). Update animation, consume events.
virtual void draw (HudContext &ctx, float drawX, float drawY)=0
 Emit geometry into the draw context.

Public Attributes

bool visible = true
HudAnchor anchor = HudAnchor::TopLeft
float offsetX = 0.f
float offsetY = 0.f
float width = 0.f
float height = 0.f
float uiScale_ = 1.f
 Set by Hud each frame (screenH / 1080).

Detailed Description

Base class for a retained HUD element.

Widgets own their state and animation. Their draw() method uses HudContext's immediate-mode API to emit geometry.

Constructor & Destructor Documentation

◆ ~HudWidget()

virtual HudWidget::~HudWidget ( )
virtualdefault

Member Function Documentation

◆ draw()

virtual void HudWidget::draw ( HudContext & ctx,
float drawX,
float drawY )
pure virtual

Emit geometry into the draw context.

Parameters
ctxImmediate-mode draw API.
drawXResolved pixel X (anchor + offset already applied).
drawYResolved pixel Y.

Implemented in AmmoCounter, BuyMenu, CrosshairWidget, DamageAccumWidget, DamageIndicator, DamageNumberWidget, HealthArmorBar, HitMarkerWidget, KillFeed, Minimap, PickupPrompt, RoundTimer, Scoreboard, TeamStatusBar, and VignetteWidget.

◆ update()

virtual void HudWidget::update ( float dt,
const HudGameState & state,
HudTweenPool & tweens )
pure virtual

Member Data Documentation

◆ anchor

HudAnchor HudWidget::anchor = HudAnchor::TopLeft

◆ height

float HudWidget::height = 0.f

◆ offsetX

float HudWidget::offsetX = 0.f

◆ offsetY

float HudWidget::offsetY = 0.f

◆ uiScale_

float HudWidget::uiScale_ = 1.f

Set by Hud each frame (screenH / 1080).

◆ visible

bool HudWidget::visible = true

◆ width

float HudWidget::width = 0.f

The documentation for this struct was generated from the following file: