--- a/src/context.c Sat Apr 19 19:30:46 2025 +0200 +++ b/src/context.c Sun Apr 20 15:41:16 2025 +0200 @@ -31,6 +31,7 @@ #include <SDL2/SDL.h> #include <SDL2/SDL_ttf.h> +#include <SDL2/SDL_image.h> #include <time.h> @@ -76,12 +77,13 @@ ); // initialize SDL + const int supported_img_flags = IMG_INIT_PNG | IMG_INIT_JPG; if (SDL_Init(SDL_INIT_VIDEO) < 0) { asc_error(SDL_GetError()); - } else { - if (TTF_Init() < 0) { - asc_error(TTF_GetError()); - } + } else if (TTF_Init() < 0) { + asc_error(TTF_GetError()); + } else if (IMG_Init(supported_img_flags) != supported_img_flags) { + asc_error(IMG_GetError()); } SDL_ClearError(); asc_context.total_nanos = asc_nanos(); @@ -99,8 +101,8 @@ asc_font_cache_destroy(); // quit SDL - if (TTF_WasInit()) - TTF_Quit(); + IMG_Quit(); + TTF_Quit(); SDL_Quit(); // destroy the error buffer