Top-level HUD system.
More...
#include <Hud.hpp>
|
| 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.
|
| void | quit () |
| | Release all resources.
|
| void | resize (uint32_t newW, uint32_t newH) |
| | Notify of window resize.
|
| void | processEvent (const SDL_Event *event) |
| | Forward an SDL event to interactive widgets (buy menu, scoreboard).
|
| void | update (float dt, const HudGameState &state) |
| | Tick widget animations and consume game events.
|
| void | render () |
| | Draw all widgets and flush to the GPU offscreen target.
|
| SDL_GPUTexture * | getOutputTexture () const |
| | The offscreen texture to blit.
|
| std::vector< std::unique_ptr< HudWidget > > & | widgets () |
| | Access all widgets (for debug panel iteration).
|
| HudTweenPool & | tweens () |
| | Access the tween pool (for debug panel).
|
|
| void | resolveAnchor (const HudWidget &w, float &outX, float &outY) const |
| | Resolve anchor + offset to pixel coordinates.
|
| void | createWidgets () |
| | Create all default widgets with initial layout.
|
Top-level HUD system.
Owns all layers and widgets.
Game calls update() + render() each frame. The renderer reads getOutputTexture() and blits it after tone mapping.
◆ createWidgets()
| void Hud::createWidgets |
( |
| ) |
|
|
private |
Create all default widgets with initial layout.
◆ getOutputTexture()
| SDL_GPUTexture * Hud::getOutputTexture |
( |
| ) |
const |
|
inlinenodiscard |
The offscreen texture to blit.
◆ init()
| bool Hud::init |
( |
SDL_GPUDevice * | device, |
|
|
SDL_GPUShaderFormat | shaderFormat, |
|
|
const SdfAtlas & | sdfAtlas, |
|
|
uint32_t | screenW, |
|
|
uint32_t | screenH ) |
Initialise all HUD subsystems and create default widgets.
◆ processEvent()
| void Hud::processEvent |
( |
const SDL_Event * | event | ) |
|
Forward an SDL event to interactive widgets (buy menu, scoreboard).
◆ quit()
◆ render()
Draw all widgets and flush to the GPU offscreen target.
◆ resize()
| void Hud::resize |
( |
uint32_t | newW, |
|
|
uint32_t | newH ) |
◆ resolveAnchor()
| void Hud::resolveAnchor |
( |
const HudWidget & | w, |
|
|
float & | outX, |
|
|
float & | outY ) const |
|
private |
Resolve anchor + offset to pixel coordinates.
◆ tweens()
Access the tween pool (for debug panel).
◆ update()
Tick widget animations and consume game events.
◆ widgets()
| std::vector< std::unique_ptr< HudWidget > > & Hud::widgets |
( |
| ) |
|
|
inlinenodiscard |
Access all widgets (for debug panel iteration).
◆ context_
◆ renderer_
◆ screenH_
| float Hud::screenH_ = 0.f |
|
private |
◆ screenW_
| float Hud::screenW_ = 0.f |
|
private |
◆ tweens_
◆ widgets_
| std::vector<std::unique_ptr<HudWidget> > Hud::widgets_ |
|
private |
The documentation for this class was generated from the following files: