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 // Layout constants (tweakable via ImGui debug panel).
11 float barWidth = 260.f;
12 float barHeight = 20.f;
13 float barSpacing = 6.f;
14 float fontSize = 22.f;
15 float textPadding = 8.f;
16
18 void update(float dt, const HudGameState& state, HudTweenPool& tweens) override;
19 void draw(HudContext& ctx, float drawX, float drawY) override;
20
21private:
22 float healthFill_ = 1.f;
23 float armorFill_ = 0.f;
24 int lastHealth_ = 100;
25 int lastArmor_ = 0;
26 int displayHealth_ = 100;
28};
Base struct for all HUD widgets.
Accumulates HUD geometry during a frame for batch rendering.
Definition HudContext.hpp:18
Fixed-size tween pool. No heap allocations.
Definition HudTween.hpp:35
void update(float dt, const HudGameState &state, HudTweenPool &tweens) override
Called each frame before draw(). Update animation, consume events.
Definition HealthArmorBar.cpp:18
float fontSize
Definition HealthArmorBar.hpp:14
float barSpacing
Definition HealthArmorBar.hpp:13
void draw(HudContext &ctx, float drawX, float drawY) override
Emit geometry into the draw context.
Definition HealthArmorBar.cpp:37
int displayArmor_
Definition HealthArmorBar.hpp:27
HealthArmorBar()
Definition HealthArmorBar.cpp:9
int lastArmor_
Definition HealthArmorBar.hpp:25
float armorFill_
Definition HealthArmorBar.hpp:23
float healthFill_
Definition HealthArmorBar.hpp:22
float barHeight
Definition HealthArmorBar.hpp:12
float barWidth
Definition HealthArmorBar.hpp:11
int displayHealth_
Definition HealthArmorBar.hpp:26
int lastHealth_
Definition HealthArmorBar.hpp:24
float textPadding
Definition HealthArmorBar.hpp:15
Snapshot of game state consumed by the HUD each frame.
Definition HudTypes.hpp:148
Base class for a retained HUD element.
Definition HudWidget.hpp:16