29 void rect(
float x,
float y,
float w,
float h,
HudColor color);
44 void triangle(
float x0,
float y0,
float x1,
float y1,
float x2,
float y2,
HudColor color);
57 void polyline(
const float* points,
int numPoints,
float thickness,
HudColor color);
71 void text(
const char* str,
77 bool outlined =
false);
79 float measureText(
const char* str,
float size)
const;
135 void rotateVertices(std::size_t startVertex,
float cx,
float cy,
float angleDeg);
Shared types for the HUD system.
HudAlign
Definition HudTypes.hpp:55
@ Left
Definition HudTypes.hpp:56
HudIcon
Icon identifiers for the HUD icon atlas.
Definition HudTypes.hpp:63
Accumulates HUD geometry during a frame for batch rendering.
Definition HudContext.hpp:19
void beginFrame()
Clear all geometry for a new frame.
Definition HudContext.cpp:21
void bar(float x, float y, float w, float h, float fill01, HudColor fg, HudColor bg)
Definition HudContext.cpp:268
bool svgMaskFlipped(HudIcon id, float x, float y, float w, float h, bool flipX, bool flipY, HudColor color)
Definition HudContext.cpp:484
bool svg(HudIcon id, float x, float y, float w, float h, HudColor tint=HudColor::white())
Definition HudContext.cpp:434
const SdfAtlas * sdfAtlas_
Definition HudContext.hpp:146
bool svgMaskRangeX(HudIcon id, float x, float y, float w, float h, float startFraction, float endFraction, HudColor color)
Definition HudContext.cpp:524
bool svgFlipped(HudIcon id, float x, float y, float w, float h, bool flipX, bool flipY, HudColor tint=HudColor::white())
Definition HudContext.cpp:439
const std::vector< std::array< float, 6 > > & clipSpans() const
Clip rect spans: {startVertex, vertexCount, x, y, w, h}.
Definition HudContext.hpp:143
bool svgMaskPartialX(HudIcon id, float x, float y, float w, float h, float fraction, HudColor color)
Definition HudContext.cpp:503
void rotateVertices(std::size_t startVertex, float cx, float cy, float angleDeg)
Rotate vertices emitted since startVertex around a screen-space point.
Definition HudContext.cpp:53
void flushClipSpan()
Flush the current clip span before changing scissor state.
Definition HudContext.cpp:106
void pushClipRect(float x, float y, float w, float h)
Definition HudContext.cpp:626
void rotatedRect(float cx, float cy, float w, float h, float angleDeg, HudColor color)
Definition HudContext.cpp:141
HudSvgAtlas * svgAtlas_
Definition HudContext.hpp:147
void knockoutText(const char *str, float x, float y, float size, HudAlign align=HudAlign::Left)
Definition HudContext.cpp:345
void text(const char *str, float x, float y, float size, HudColor color, HudAlign align=HudAlign::Left, bool outlined=false)
Render a UTF-8 ASCII string via SDF.
Definition HudContext.cpp:278
void vignette(float screenW, float screenH, HudColor color)
Draw a full-screen radial vignette overlay.
Definition HudContext.cpp:611
void polyline(const float *points, int numPoints, float thickness, HudColor color)
Stroke a polyline with sharp-mitred corners using rotated rects.
Definition HudContext.cpp:226
std::vector< std::array< float, 6 > > clipSpans_
Definition HudContext.hpp:149
bool svgMaskPartialXFlipped(HudIcon id, float x, float y, float w, float h, float fraction, bool fromRight, bool flipX, bool flipY, HudColor color)
Definition HudContext.cpp:549
void triangleColors(float x0, float y0, HudColor c0, float x1, float y1, HudColor c1, float x2, float y2, HudColor c2)
Triangle with per-vertex colors — the rasteriser interpolates across the surface.
Definition HudContext.cpp:214
uint32_t spanStartVertex_
Vertex index where current clip span started.
Definition HudContext.hpp:153
std::vector< HudVertex > vertices_
Definition HudContext.hpp:148
void tintVertices(std::size_t startVertex, HudColor tint)
Multiply already-emitted vertex colors by a tint.
Definition HudContext.cpp:37
bool svgMask(HudIcon id, float x, float y, float w, float h, HudColor color)
Definition HudContext.cpp:479
void init(const SdfAtlas *atlas, HudSvgAtlas *svgAtlas=nullptr)
Bind the SDF atlas for text layout (glyph metrics).
Definition HudContext.cpp:15
float measureText(const char *str, float size) const
Definition HudContext.cpp:382
void triangle(float x0, float y0, float x1, float y1, float x2, float y2, HudColor color)
Emit a single solid-colored triangle (3 vertices).
Definition HudContext.cpp:203
bool svgPartialX(HudIcon id, float x, float y, float w, float h, float fraction, HudColor tint=HudColor::white())
Definition HudContext.cpp:458
void rectOutline(float x, float y, float w, float h, float thickness, HudColor color)
Definition HudContext.cpp:173
bool icon(HudIcon id, float x, float y, float size, HudColor tint=HudColor::white())
Definition HudContext.cpp:429
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:71
const std::vector< HudVertex > & vertices() const
Definition HudContext.hpp:139
void measureTextVerticalBounds(const char *str, float size, float &outTop, float &outBottom) const
Definition HudContext.cpp:397
void scopeMask(float screenW, float screenH, float radiusPx, HudColor color)
Draw a full-screen scope mask with a transparent circular cut-out.
Definition HudContext.cpp:617
void crosshair(const CrosshairStyle &style, float screenW, float screenH)
Definition HudContext.cpp:589
bool spanDirty_
Definition HudContext.hpp:154
void gradientRect(float x, float y, float w, float h, HudColor leftColor, HudColor rightColor)
Filled rect with a horizontal color gradient.
Definition HudContext.cpp:181
void endFrame()
Flush any remaining unflushed vertices into a final clip span.
Definition HudContext.cpp:30
void roundedRect(float x, float y, float w, float h, float radius, HudColor color)
Definition HudContext.cpp:247
void rect(float x, float y, float w, float h, HudColor color)
Definition HudContext.cpp:136
std::vector< std::array< float, 4 > > clipStack_
Definition HudContext.hpp:152
void popClipRect()
Definition HudContext.cpp:633
Definition HudSvgAtlas.hpp:26
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:133
RGBA color for HUD elements (linear space, straight alpha).
Definition HudTypes.hpp:24
static constexpr HudColor white()
Definition HudTypes.hpp:30