group2
0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
HudWidget.hpp
Go to the documentation of this file.
1
3
4
#pragma once
5
6
#include "
HudTypes.hpp
"
7
8
class
HudContext
;
9
class
HudTweenPool
;
10
15
struct
HudWidget
16
{
17
bool
visible
=
true
;
18
19
HudAnchor
anchor
=
HudAnchor::TopLeft
;
20
float
offsetX
= 0.f,
offsetY
= 0.f;
21
float
width
= 0.f,
height
= 0.f;
22
float
uiScale_
= 1.f;
23
24
virtual
~HudWidget
() =
default
;
25
27
virtual
void
update
(
float
dt,
const
HudGameState
& state,
HudTweenPool
& tweens) = 0;
28
33
virtual
void
draw
(
HudContext
& ctx,
float
drawX,
float
drawY) = 0;
34
};
HudTypes.hpp
Shared types for the HUD system.
HudAnchor
HudAnchor
Definition
HudTypes.hpp:33
HudAnchor::TopLeft
@ TopLeft
Definition
HudTypes.hpp:34
HudContext
Accumulates HUD geometry during a frame for batch rendering.
Definition
HudContext.hpp:18
HudTweenPool
Fixed-size tween pool. No heap allocations.
Definition
HudTween.hpp:35
HudGameState
Snapshot of game state consumed by the HUD each frame.
Definition
HudTypes.hpp:148
HudWidget
Base class for a retained HUD element.
Definition
HudWidget.hpp:16
HudWidget::uiScale_
float uiScale_
Set by Hud each frame (screenH / 1080).
Definition
HudWidget.hpp:22
HudWidget::height
float height
Definition
HudWidget.hpp:21
HudWidget::offsetY
float offsetY
Definition
HudWidget.hpp:20
HudWidget::visible
bool visible
Definition
HudWidget.hpp:17
HudWidget::draw
virtual void draw(HudContext &ctx, float drawX, float drawY)=0
Emit geometry into the draw context.
HudWidget::width
float width
Definition
HudWidget.hpp:21
HudWidget::anchor
HudAnchor anchor
Definition
HudWidget.hpp:19
HudWidget::offsetX
float offsetX
Definition
HudWidget.hpp:20
HudWidget::update
virtual void update(float dt, const HudGameState &state, HudTweenPool &tweens)=0
Called each frame before draw(). Update animation, consume events.
HudWidget::~HudWidget
virtual ~HudWidget()=default
src
client
hud
HudWidget.hpp
Generated by
1.16.1