Skip to content

HUD

The bonus HUD is a screen-space overlay rendered above the world view. It gives the player immediate feedback for Ammo, HP, Armor, Score, face state, weapon animation, and framed status panels.

Bonus HUD

Screen-space overlay drawn after the world frame

The HUD is fed by bonus gameplay state and rendered last, so stats, face reactions, weapon frames, and panels stay readable above world shading, sprites, minimap, and retro output.

01
data sources

HUD rendering reads the post-update gameplay snapshot.

app->bonus.stats Ammo · HP · Armor · Score gameplay values after pickups, damage, and actions
app->bonus.hud face · weapon · timers transient animation and reaction state
02
frame position

HUD is intentionally the last screen-space draw stage.

world background + raycast world
sprites + minimap bonus
vignette + retro upscale post
HUD draw overlay last
mlx_put_image_to_window present
interactive HUD simulator

Trigger common gameplay events and watch the overlay update from the same stat and HUD state model.

Use the controls to simulate HUD state changes.

03
render responsibilities

Layout, text, panels, face state, and weapon frames stay separated.

hud_draw.chud_state.chud_status.chud_fire.chud_frames.chud_text.c
runtime invariant

HUD uses updated values, draws last, and is not darkened by world effects.

post-update stats last overlay pass unaffected by vignette clean shutdown-owned assets

HUD state is updated before the final draw stage:

  1. gameplay systems modify stats and reaction state
  2. bonus_hud_update(...) advances timers and animation state
  3. HUD drawing renders the current snapshot after world effects

This keeps numeric values and animated elements synchronized with gameplay.

In draw_frame(...), the HUD is intentionally rendered last:

  • world background and raycast walls are drawn first
  • bonus sprites and minimap are drawn next
  • vignette and retro handling happen before the overlay
  • HUD panels are drawn after those effects
  • the composed image is presented with mlx_put_image_to_window

Drawing the HUD last keeps it readable and prevents world post-processing from darkening or overwriting interface elements.

HUD rendering is split by responsibility:

  • panel and frame drawing
  • text and glyph drawing
  • stat block layout
  • face state selection
  • weapon slot and fire animation
  • pixel blit and scaled helper functions

This separation keeps UI layout and state logic independent from raycasting.

Runtime state is stored in:

  • app->bonus.stats for values displayed by the HUD
  • app->bonus.hud for animation, timers, face, and weapon state

HUD assets are loaded during bonus initialization and released by the HUD shutdown path.

  • srcs_bonus/hud/hud_draw.c
  • srcs_bonus/hud/hud_state.c
  • srcs_bonus/hud/hud_status.c
  • srcs_bonus/hud/hud_fire.c
  • srcs_bonus/hud/hud_frames.c
  • srcs_bonus/hud/hud_text.c
  • srcs/render/render_frame.c