Embed controls.png into binary so it can run from any directory

The spritesheet is compiled in as a C byte array. An external
controls.png in cwd still takes precedence for skinning. Includes
tools/embed_png.py to regenerate the header if the asset changes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Michael Smith
2026-02-13 10:25:22 +01:00
parent 8f8cbc97c7
commit 7e67589150
5 changed files with 2168 additions and 3 deletions

2123
src/controls_png.h Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -13,6 +13,8 @@
#include "SDL.h"
#include "SDL_image.h"
#include "controls_png.h"
#define MAX_FILES 64
#define SEEK_SECONDS 10.0
@@ -626,6 +628,12 @@ int main(int argc, char** argv) {
}
SDL_Surface* controls_surface = IMG_Load("controls.png");
if (!controls_surface) {
SDL_RWops* rw = SDL_RWFromConstMem(controls_png_data, controls_png_size);
if (rw) {
controls_surface = IMG_Load_RW(rw, 1);
}
}
if (!controls_surface) {
panic_and_abort("Could not load controls asset!", SDL_GetError());
}