group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
HudIcons.hpp File Reference

Procedural vector icons for the VOIDFALL HUD. More...

#include "HudTypes.hpp"
Include dependency graph for HudIcons.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  voidfall
namespace  voidfall::icons

Functions

void voidfall::icons::filledPolygon (HudContext &ctx, const float *points, int n, HudColor color)
 Fill a closed polygon with n points using a triangle fan from the first vertex.
void voidfall::icons::strokedPolygon (HudContext &ctx, const float *points, int n, float thickness, HudColor color)
 Stroke a closed polygon (connects last point back to first).
void voidfall::icons::filledCircle (HudContext &ctx, float cx, float cy, float r, int sides, HudColor color)
 Fill a regular polygon approximating a circle.
void voidfall::icons::strokedCircle (HudContext &ctx, float cx, float cy, float r, float thickness, int sides, HudColor color)
 Stroke a circle as a sides-segment ring.
void voidfall::icons::hp (HudContext &ctx, float x, float y, float size, HudColor color)
 Medical-cross HP glyph (filled).
void voidfall::icons::shield (HudContext &ctx, float x, float y, float size, HudColor color)
 Shield silhouette: top-flat pentagon with curved bottom (stroked).
void voidfall::icons::skull (HudContext &ctx, float x, float y, float size, HudColor color)
 Skull silhouette (filled).
void voidfall::icons::headshot (HudContext &ctx, float x, float y, float size, HudColor color)
 Headshot reticle: circle + center pip + line below.
void voidfall::icons::gravityArrow (HudContext &ctx, float x, float y, float size, int direction, HudColor color)
 Gravity arrow inside a small dial. direction is 0=down, 1=left, 2=up, 3=right.
void voidfall::icons::fall (HudContext &ctx, float x, float y, float size, HudColor color)
 Upward filled triangle (used for "FALL" weapon kill icon).
void voidfall::icons::grenade (HudContext &ctx, float x, float y, float size, HudColor color)
 Grenade: round body + collar + lever (filled silhouette).
void voidfall::icons::grapple (HudContext &ctx, float x, float y, float size, HudColor color)
 Grapple hook: hook shape + diagonal rope (stroked).
void voidfall::icons::tactical (HudContext &ctx, float x, float y, float size, HudColor color)
 Tactical: dotted ring + center pip (stroked).
void voidfall::icons::playerArrow (HudContext &ctx, float cx, float cy, float size, HudColor color)
 Player arrow chevron used on the minimap (filled, with notch).
void voidfall::icons::enemyDiamond (HudContext &ctx, float cx, float cy, float size, HudColor color)
 Diamond marker for enemy positions on the minimap.

Detailed Description

Procedural vector icons for the VOIDFALL HUD.

Every icon takes (ctx, x, y, size, color) and renders into a size × size box anchored at top-left. The geometry is emitted as triangles + polylines through the existing HudContext primitives, so icons are crisp at any DPR and don't depend on texture filtering, mip chains, or atlas packing.

Why this lives here, not in widgets

The previous implementation built every icon ad-hoc inside its host widget using rotated rectangles, which produced the chunky / mis-aligned shield and grapple seen in early playtesting. Centralising the geometry here:

  • lets every widget reach the same icon by name,
  • keeps the visual language consistent (proportions match the design's 12-14 px SVG glyphs),
  • decouples icon authoring from widget layout.

Future SVG migration

The function signatures intentionally match the shape of an SVG-atlas lookup: draw(ctx, x, y, size, color). When an SVG raster pipeline (nanosvg + GPU atlas) is added, each function body can be swapped to a single ctx.icon(HudIcon::X, x, y, size, color) without touching any caller — the procedural path becomes a fallback for missing SVGs.

Adding a new icon

  1. Add the function signature here.
  2. Implement it in HudIcons.cpp using triangle(), polyline(), filledCircle(), or strokedCircle().
  3. Drop a matching <name>.svg into assets/hud_icons/ (12×12 px, currentColor strokes/fills) so the future atlas pipeline picks it up.