From 9c9f90bd045013e5657bb7402a46e80448c65b67 Mon Sep 17 00:00:00 2001 From: kdx Date: Mon, 4 Dec 2023 07:02:44 +0100 Subject: drop SDL2_ttf support --- headers/TZR_types.h | 1 - sources/TZR_DestroyResource.c | 6 ------ sources/TZR_DirectResourceLoad.c | 22 ---------------------- sources/TZR_Init.c | 5 ----- sources/TZR_LoadResource.c | 4 ---- sources/TZR_Quit.c | 3 --- 6 files changed, 41 deletions(-) diff --git a/headers/TZR_types.h b/headers/TZR_types.h index e7d13fc..06d9d41 100644 --- a/headers/TZR_types.h +++ b/headers/TZR_types.h @@ -8,7 +8,6 @@ enum TZR_ResourceType { TZR_RES_RAW, TZR_RES_IMAGE, TZR_RES_SOUND, - TZR_RES_FONT, ___TZR_RES_COUNT }; diff --git a/sources/TZR_DestroyResource.c b/sources/TZR_DestroyResource.c index de235e4..7536017 100644 --- a/sources/TZR_DestroyResource.c +++ b/sources/TZR_DestroyResource.c @@ -22,12 +22,6 @@ TZR_DestroyResource(TZR_Resource *res, int free_path) #else if (res->sound.ptr != NULL) Mix_FreeChunk(res->sound.ptr); -#endif - break; - case TZR_RES_FONT: -#ifdef TZR_TTF - if (res->ttf.ptr != NULL) - TTF_CloseFont(res->ttf.ptr); #endif break; default: diff --git a/sources/TZR_DirectResourceLoad.c b/sources/TZR_DirectResourceLoad.c index e3579b1..7b53a5e 100644 --- a/sources/TZR_DirectResourceLoad.c +++ b/sources/TZR_DirectResourceLoad.c @@ -6,10 +6,6 @@ #include #include -#ifdef TZR_TTF -#include -#endif - #ifdef TZR_STB_IMAGE #define STB_IMAGE_IMPLEMENTATION #include "stb_image.h" @@ -127,24 +123,6 @@ TZR_DirectResourceLoad(TZR_Resource *res, const void *data, int size) res->sound.ptr = chunk; #endif } break; - case TZR_RES_FONT: -#ifdef TZR_TTF - { - const int ptsize = 20; - SDL_RWops *const rw = SDL_RWFromConstMem(data, size); - if (rw == NULL) - return sdl_error(-1); - TTF_Font *font = TTF_OpenFontRW(rw, 0, ptsize); - SDL_RWclose(rw); - if (font == NULL) - return sdl_error(-1); - res->ttf.ptr = font; - res->ttf.ptsize = ptsize; - } break; -#else - SDL_Log("add -DTZR_TTF= to your compile flags"); - return -1; -#endif default: fprintf(stderr, "invalid type\n"); return -1; diff --git a/sources/TZR_Init.c b/sources/TZR_Init.c index 5af39f4..ac436b3 100644 --- a/sources/TZR_Init.c +++ b/sources/TZR_Init.c @@ -128,10 +128,5 @@ _TZR_Init(const TZR_Config *config) #endif } while (0); -#ifdef TZR_TTF - /* Setup font system. */ - if (TTF_Init()) - return _sdl_error(); -#endif return 0; } diff --git a/sources/TZR_LoadResource.c b/sources/TZR_LoadResource.c index 330589d..c1c73ce 100644 --- a/sources/TZR_LoadResource.c +++ b/sources/TZR_LoadResource.c @@ -15,10 +15,6 @@ deduce_type(const char *path) return TZR_RES_IMAGE; if (strcasecmp(path_extension, ".wav") == 0) return TZR_RES_SOUND; - if (strcasecmp(path_extension, ".ttf") == 0 || - strcasecmp(path_extension, ".otf") == 0 || - strcasecmp(path_extension, ".fon") == 0) - return TZR_RES_FONT; return TZR_RES_RAW; } diff --git a/sources/TZR_Quit.c b/sources/TZR_Quit.c index 62be0b0..0bc9f29 100644 --- a/sources/TZR_Quit.c +++ b/sources/TZR_Quit.c @@ -48,8 +48,5 @@ TZR_Quit(void) Mix_CloseAudio(); Mix_Quit(); } -#ifdef TZR_TTF - TTF_Quit(); -#endif SDL_Quit(); } -- cgit v1.2.3