diff options
| author | frosty <gabriel@bwaaa.monster> | 2026-03-15 00:06:45 -0400 |
|---|---|---|
| committer | iceyrazor <iceyrazor@mailfence.com> | 2026-03-14 23:16:31 -0500 |
| commit | ce1034dd612a3166281403f829a368e9ada3411d (patch) | |
| tree | b18f53e64b95397bade502a4ea08462acfffeff3 | |
| parent | 3c361669ad0d4db6e53200c7f25b9576ae73e9d6 (diff) | |
| -rwxr-xr-x | src/main.c | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -3,7 +3,9 @@ #include <SDL2/SDL_ttf.h> #include <SDL2/SDL_video.h> #include <stdio.h> +#include <stdlib.h> #include <stdbool.h> +#include <sys/stat.h> #include <time.h> #include <pthread.h> #include <SDL2/SDL.h> @@ -17,6 +19,30 @@ bool running=true; #define PROJECT_NAME "dacctal fish" +static int file_exists(const char *path) { + struct stat st; + return stat(path, &st) == 0; +} + +static void check_assets(void) { + int missing = 0; + if (!file_exists(fontfile)) { + SDL_LogWarn(0, "Missing: %s", fontfile); + missing++; + } + if (!file_exists(fishimg)) { + SDL_LogWarn(0, "Missing: %s", fishimg); + missing++; + } + if (!file_exists("patreons.txt")) { + SDL_LogWarn(0, "Missing: patreons.txt"); + missing++; + } + if (missing > 0) { + exit(EXIT_FAILURE); + } +} + int main(int argc, char *argv[]) { if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0) @@ -26,6 +52,8 @@ int main(int argc, char *argv[]) SDL_Log("SDL fails to initialize ttf! %s\n", SDL_GetError()); } + check_assets(); + int startw=1920; int starth=1080; |
