Implement four feature phases: Phase 1 - Pause menu: extract bitmap font into shared engine/font module, add MODE_PAUSED with Resume/Restart/Quit overlay. Phase 2 - Laser turret hazard: ENT_LASER_TURRET with charge/fire/ cooldown state machine, per-pixel beam raycast, two variants (fixed and tracking). Registered in entity registry with editor icons. Phase 3 - Charger and Spawner enemies: charger ground patrol with detect/telegraph/charge/stun cycle (2s charge timeout), spawner that periodically creates grunts up to a global cap of 3. Phase 4 - Mars campaign: two handcrafted levels (mars01 surface, mars02 base), mars_tileset.png, PARALLAX_STYLE_MARS with salmon sky and red mesas, THEME_MARS_SURFACE/THEME_MARS_BASE for the procedural generator with per-theme gravity/tileset/parallax. Moon campaign now chains moon03 -> mars01 -> mars02 -> victory. Also fix review findings: deterministic seed on generated level restart, NULL checks on calloc in spawn functions, charge timeout to prevent infinite charge on flat terrain, and stop suppressing stderr in Makefile web-serve target so real errors are visible.
33 lines
1.3 KiB
C
33 lines
1.3 KiB
C
#ifndef JNR_FONT_H
|
|
#define JNR_FONT_H
|
|
|
|
#include <SDL2/SDL.h>
|
|
|
|
/* ═══════════════════════════════════════════════════
|
|
* Minimal 4x7 bitmap font
|
|
*
|
|
* Each character is 4 pixels wide, 7 pixels tall.
|
|
* Covers ASCII 32-95 (space through underscore).
|
|
* Lowercase maps to uppercase automatically.
|
|
* ═══════════════════════════════════════════════════ */
|
|
|
|
#define FONT_W 4
|
|
#define FONT_H 7
|
|
#define FONT_SPACING 1 /* 1px gap between characters */
|
|
|
|
/* Draw a single character at pixel position (x, y). */
|
|
void font_draw_char(SDL_Renderer *r, char ch, int x, int y, SDL_Color col);
|
|
|
|
/* Draw a null-terminated string at pixel position (x, y). */
|
|
void font_draw_text(SDL_Renderer *r, const char *text, int x, int y, SDL_Color col);
|
|
|
|
/* Draw text centered horizontally on the given y, within a region of
|
|
* total_width pixels starting at x=0. */
|
|
void font_draw_text_centered(SDL_Renderer *r, const char *text, int y,
|
|
int total_width, SDL_Color col);
|
|
|
|
/* Return the pixel width of a string (without trailing spacing). */
|
|
int font_text_width(const char *text);
|
|
|
|
#endif /* JNR_FONT_H */
|