group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
HealthArmorBar.hpp
Go to the documentation of this file.
1
3
4#pragma once
5
6#include "hud/HudWidget.hpp"
7
9{
10 float panelWidth = 630.f;
11 float barHeight = 40.f;
12 float svgScale = 1.f;
13 float svgOffsetX = 0.f;
14 float svgOffsetY = 0.f;
15 float svgStretchX = 1.f;
16 float svgStretchY = 1.f;
17
19 void update(float dt, const HudGameState& state, HudTweenPool& tweens) override;
20 void draw(HudContext& ctx, float drawX, float drawY) override;
21
22private:
23 int maxHealth_ = 100;
24 int maxArmor_ = 100;
25 int maxOverShield_ = 200;
26 float healthFill_ = 1.f;
27 float armorFill_ = 0.f;
28 float overShieldFill_ = 0.f;
29};
Base struct for all HUD widgets.
Accumulates HUD geometry during a frame for batch rendering.
Definition HudContext.hpp:19
Fixed-size tween pool. No heap allocations.
Definition HudTween.hpp:35
float svgOffsetX
SVG frame X adjustment.
Definition HealthArmorBar.hpp:13
int maxHealth_
Definition HealthArmorBar.hpp:23
void update(float dt, const HudGameState &state, HudTweenPool &tweens) override
Called each frame before draw(). Update animation, consume events.
Definition HealthArmorBar.cpp:26
int maxArmor_
Definition HealthArmorBar.hpp:24
void draw(HudContext &ctx, float drawX, float drawY) override
Emit geometry into the draw context.
Definition HealthArmorBar.cpp:39
HealthArmorBar()
Definition HealthArmorBar.cpp:17
float armorFill_
Definition HealthArmorBar.hpp:27
float healthFill_
Definition HealthArmorBar.hpp:26
float barHeight
Base SVG frame height.
Definition HealthArmorBar.hpp:11
float svgScale
Extra scale applied to both SVG frame layers.
Definition HealthArmorBar.hpp:12
float svgOffsetY
SVG frame Y adjustment.
Definition HealthArmorBar.hpp:14
float svgStretchY
Vertical SVG stretch multiplier.
Definition HealthArmorBar.hpp:16
int maxOverShield_
Definition HealthArmorBar.hpp:25
float overShieldFill_
Definition HealthArmorBar.hpp:28
float svgStretchX
Horizontal SVG stretch multiplier.
Definition HealthArmorBar.hpp:15
float panelWidth
Base SVG frame width.
Definition HealthArmorBar.hpp:10
Snapshot of game state consumed by the HUD each frame.
Definition HudTypes.hpp:367
Base class for a retained HUD element.
Definition HudWidget.hpp:16