group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
EnemyWorldHealthBar Struct Reference

#include <EnemyWorldHealthBar.hpp>

Inheritance diagram for EnemyWorldHealthBar:
[legend]
Collaboration diagram for EnemyWorldHealthBar:
[legend]

Classes

struct  EnemyState

Public Member Functions

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

Public Attributes

float barWidth = 80.f
 Shorter than v1 — design feedback wanted compact bars.
float shieldHeight = 3.f
float healthHeight = 5.f
float fontSize = 10.f
float yOffsetPx = 14.f
 Pixels above the projected world point.
float showAfterDamageSecs = 4.f
 Window after the most recent hit during which the bar stays visible.
float fadeOutSecs = 0.5f
 Final fade-out length appended to the visibility window.
Public Attributes inherited from HudWidget
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).

Private Attributes

glm::mat4 viewProj_ {1.f}
float screenW_ = 1280.f
float screenH_ = 720.f
std::unordered_map< std::string, EnemyStateenemies_
 Per-enemy state keyed by name (stable across frames).

Constructor & Destructor Documentation

◆ EnemyWorldHealthBar()

EnemyWorldHealthBar::EnemyWorldHealthBar ( )

Member Function Documentation

◆ draw()

void EnemyWorldHealthBar::draw ( HudContext & ctx,
float drawX,
float drawY )
overridevirtual

Emit geometry into the draw context.

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

Implements HudWidget.

Here is the call graph for this function:

◆ update()

void EnemyWorldHealthBar::update ( float dt,
const HudGameState & state,
HudTweenPool & tweens )
overridevirtual

Called each frame before draw(). Update animation, consume events.

Implements HudWidget.

Member Data Documentation

◆ barWidth

float EnemyWorldHealthBar::barWidth = 80.f

Shorter than v1 — design feedback wanted compact bars.

◆ enemies_

std::unordered_map<std::string, EnemyState> EnemyWorldHealthBar::enemies_
private

Per-enemy state keyed by name (stable across frames).

Held across frames so ghost trails persist between updates.

◆ fadeOutSecs

float EnemyWorldHealthBar::fadeOutSecs = 0.5f

Final fade-out length appended to the visibility window.

◆ fontSize

float EnemyWorldHealthBar::fontSize = 10.f

◆ healthHeight

float EnemyWorldHealthBar::healthHeight = 5.f

◆ screenH_

float EnemyWorldHealthBar::screenH_ = 720.f
private

◆ screenW_

float EnemyWorldHealthBar::screenW_ = 1280.f
private

◆ shieldHeight

float EnemyWorldHealthBar::shieldHeight = 3.f

◆ showAfterDamageSecs

float EnemyWorldHealthBar::showAfterDamageSecs = 4.f

Window after the most recent hit during which the bar stays visible.

◆ viewProj_

glm::mat4 EnemyWorldHealthBar::viewProj_ {1.f}
private

◆ yOffsetPx

float EnemyWorldHealthBar::yOffsetPx = 14.f

Pixels above the projected world point.


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