28 void rect(
float x,
float y,
float w,
float h,
HudColor color);
40 float measureText(
const char* str,
float size)
const;
Shared types for the HUD system.
HudAlign
Definition HudTypes.hpp:46
@ Left
Definition HudTypes.hpp:47
HudIcon
Icon identifiers for the HUD icon atlas.
Definition HudTypes.hpp:54
Accumulates HUD geometry during a frame for batch rendering.
Definition HudContext.hpp:18
void beginFrame()
Clear all geometry for a new frame.
Definition HudContext.cpp:18
void bar(float x, float y, float w, float h, float fill01, HudColor fg, HudColor bg)
Definition HudContext.cpp:167
const SdfAtlas * sdfAtlas_
Definition HudContext.hpp:76
const std::vector< std::array< float, 6 > > & clipSpans() const
Clip rect spans: {startVertex, vertexCount, x, y, w, h}.
Definition HudContext.hpp:73
void flushClipSpan()
Flush the current clip span before changing scissor state.
Definition HudContext.cpp:71
void pushClipRect(float x, float y, float w, float h)
Definition HudContext.cpp:276
void init(const SdfAtlas *atlas)
Bind the SDF atlas for text layout (glyph metrics).
Definition HudContext.cpp:13
void rotatedRect(float cx, float cy, float w, float h, float angleDeg, HudColor color)
Definition HudContext.cpp:106
void vignette(float screenW, float screenH, HudColor color)
Draw a full-screen radial vignette overlay.
Definition HudContext.cpp:268
std::vector< std::array< float, 6 > > clipSpans_
Definition HudContext.hpp:78
uint32_t spanStartVertex_
Vertex index where current clip span started.
Definition HudContext.hpp:82
std::vector< HudVertex > vertices_
Definition HudContext.hpp:77
void text(const char *str, float x, float y, float size, HudColor color, HudAlign align=HudAlign::Left)
Definition HudContext.cpp:177
float measureText(const char *str, float size) const
Definition HudContext.cpp:221
void rectOutline(float x, float y, float w, float h, float thickness, HudColor color)
Definition HudContext.cpp:138
void icon(HudIcon id, float x, float y, float size, HudColor tint=HudColor::white())
Definition HudContext.cpp:238
void emitQuad(float x, float y, float w, float h, float u0, float v0, float u1, float v1, HudColor color, float texMode, float sd0=0.f, float sd1=0.f, float sd2=0.f)
Emit 6 vertices for a textured quad.
Definition HudContext.cpp:36
const std::vector< HudVertex > & vertices() const
Definition HudContext.hpp:69
void crosshair(const CrosshairStyle &style, float screenW, float screenH)
Definition HudContext.cpp:246
bool spanDirty_
Definition HudContext.hpp:83
void endFrame()
Flush any remaining unflushed vertices into a final clip span.
Definition HudContext.cpp:27
void roundedRect(float x, float y, float w, float h, float radius, HudColor color)
Definition HudContext.cpp:146
void rect(float x, float y, float w, float h, HudColor color)
Definition HudContext.cpp:101
std::vector< std::array< float, 4 > > clipStack_
Definition HudContext.hpp:81
void popClipRect()
Definition HudContext.cpp:283
Loads a TTF font, bakes an SDF glyph atlas, and uploads it to the GPU.
Definition SdfAtlas.hpp:18
Crosshair appearance parameters.
Definition HudTypes.hpp:75
RGBA color for HUD elements (linear space, straight alpha).
Definition HudTypes.hpp:15
static constexpr HudColor white()
Definition HudTypes.hpp:21