aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkdx <kikoodx@paranoici.org>2023-12-04 07:02:44 +0100
committerkdx <kikoodx@paranoici.org>2023-12-04 07:02:44 +0100
commit9c9f90bd045013e5657bb7402a46e80448c65b67 (patch)
tree51ef264ba6fcb1bf0aa69d0b2bb8ff0f853ecb9e
parentb5927ba9a22dd256603b81d452fdb3cfaf0dc2ba (diff)
downloadtzr-9c9f90bd045013e5657bb7402a46e80448c65b67.tar.gz
drop SDL2_ttf support
-rw-r--r--headers/TZR_types.h1
-rw-r--r--sources/TZR_DestroyResource.c6
-rw-r--r--sources/TZR_DirectResourceLoad.c22
-rw-r--r--sources/TZR_Init.c5
-rw-r--r--sources/TZR_LoadResource.c4
-rw-r--r--sources/TZR_Quit.c3
6 files changed, 0 insertions, 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
@@ -24,12 +24,6 @@ TZR_DestroyResource(TZR_Resource *res, int free_path)
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:
fprintf(stderr, "unknown resource type %u\n", res->type);
break;
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 <SDL2/SDL_rwops.h>
#include <string.h>
-#ifdef TZR_TTF
-#include <SDL2/SDL_ttf.h>
-#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();
}