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:
2123
src/controls_png.h
Normal file
2123
src/controls_png.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user