group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
ShotgunPelletWidget.hpp
Go to the documentation of this file.
1
11
12#pragma once
13
14#include "hud/HudWidget.hpp"
15
17{
18 float radius = 18.f;
19 float dotRadius = 3.5f;
20 float holdDuration = 0.45f;
21 float fadeDuration = 0.55f;
22
24 void update(float dt, const HudGameState& state, HudTweenPool& tweens) override;
25 void draw(HudContext& ctx, float drawX, float drawY) override;
26
27private:
29 float alpha_ = 0.f;
30 float age_ = 0.f;
31 bool primed_ = false;
32};
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
Snapshot of game state consumed by the HUD each frame.
Definition HudTypes.hpp:367
A single completed shotgun blast (11 pellets) staged for the HUD widget.
Definition HudTypes.hpp:357
Base class for a retained HUD element.
Definition HudWidget.hpp:16
float dotRadius
Pixel radius of each pellet dot at uiScale=1.
Definition ShotgunPelletWidget.hpp:19
HudShotgunBlast latest_
Cached copy of the last blast we displayed.
Definition ShotgunPelletWidget.hpp:28
bool primed_
False until the first blast arrives.
Definition ShotgunPelletWidget.hpp:31
ShotgunPelletWidget()
Definition ShotgunPelletWidget.cpp:41
float radius
Pixel radius of the outer ring at uiScale=1.
Definition ShotgunPelletWidget.hpp:18
float holdDuration
Full opacity hold time after a blast.
Definition ShotgunPelletWidget.hpp:20
float age_
Seconds since the latest blast was staged.
Definition ShotgunPelletWidget.hpp:30
float fadeDuration
Linear fade-out duration after the hold.
Definition ShotgunPelletWidget.hpp:21
void update(float dt, const HudGameState &state, HudTweenPool &tweens) override
Called each frame before draw(). Update animation, consume events.
Definition ShotgunPelletWidget.cpp:52
float alpha_
Current widget opacity.
Definition ShotgunPelletWidget.hpp:29
void draw(HudContext &ctx, float drawX, float drawY) override
Emit geometry into the draw context.
Definition ShotgunPelletWidget.cpp:77