27 bool init(SDL_GPUDevice* device,
28 SDL_GPUShaderFormat shaderFormat,
37 void resize(uint32_t newW, uint32_t newH);
52 [[nodiscard]] std::vector<std::unique_ptr<HudWidget>>&
widgets() {
return widgets_; }
61 std::vector<std::unique_ptr<HudWidget>>
widgets_;
Immediate-mode draw API for HUD widgets.
GPU backend for the HUD system — owns offscreen target, pipeline, and vertex buffer upload.
Lightweight fixed-pool tween engine for HUD animations.
Shared types for the HUD system.
Accumulates HUD geometry during a frame for batch rendering.
Definition HudContext.hpp:18
Renders batched HUD geometry to an offscreen RGBA8 texture.
Definition HudRenderer.hpp:22
Fixed-size tween pool. No heap allocations.
Definition HudTween.hpp:35
Top-level HUD system.
Definition Hud.hpp:24
void resize(uint32_t newW, uint32_t newH)
Notify of window resize.
Definition Hud.cpp:48
SDL_GPUTexture * getOutputTexture() const
The offscreen texture to blit.
Definition Hud.hpp:49
void quit()
Release all resources.
Definition Hud.cpp:42
void update(float dt, const HudGameState &state)
Tick widget animations and consume game events.
Definition Hud.cpp:80
void resolveAnchor(const HudWidget &w, float &outX, float &outY) const
Resolve anchor + offset to pixel coordinates.
Definition Hud.cpp:119
HudRenderer renderer_
Definition Hud.hpp:58
std::vector< std::unique_ptr< HudWidget > > widgets_
Definition Hud.hpp:61
void render()
Draw all widgets and flush to the GPU offscreen target.
Definition Hud.cpp:92
void createWidgets()
Create all default widgets with initial layout.
Definition Hud.cpp:166
float screenH_
Definition Hud.hpp:63
float screenW_
Definition Hud.hpp:63
HudTweenPool & tweens()
Access the tween pool (for debug panel).
Definition Hud.hpp:55
void processEvent(const SDL_Event *event)
Forward an SDL event to interactive widgets (buy menu, scoreboard).
Definition Hud.cpp:55
HudContext context_
Definition Hud.hpp:59
bool init(SDL_GPUDevice *device, SDL_GPUShaderFormat shaderFormat, const SdfAtlas &sdfAtlas, uint32_t screenW, uint32_t screenH)
Initialise all HUD subsystems and create default widgets.
Definition Hud.cpp:23
HudTweenPool tweens_
Definition Hud.hpp:60
std::vector< std::unique_ptr< HudWidget > > & widgets()
Access all widgets (for debug panel iteration).
Definition Hud.hpp:52
Loads a TTF font, bakes an SDF glyph atlas, and uploads it to the GPU.
Definition SdfAtlas.hpp:18
Snapshot of game state consumed by the HUD each frame.
Definition HudTypes.hpp:148