From 968eef3e5b6dfb13ed3256322464d6578d79174e Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Mon, 30 Sep 2024 21:40:02 +0300
Subject: [PATCH] Include SDL_ttf.h in SDL_textengine.h for SDL_Font, fix type
redefinition errors
---
include/SDL3_ttf/SDL_textengine.h | 9 ++++++---
src/SDL_hashtable.c | 1 -
src/SDL_renderer_textengine.c | 2 --
src/SDL_surface_textengine.c | 1 -
4 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/include/SDL3_ttf/SDL_textengine.h b/include/SDL3_ttf/SDL_textengine.h
index 59dbdee6..472de9c9 100644
--- a/include/SDL3_ttf/SDL_textengine.h
+++ b/include/SDL3_ttf/SDL_textengine.h
@@ -29,6 +29,8 @@
#define SDL_TTF_TEXTENGINE_H_
#include <SDL3/SDL.h>
+#include <SDL3_ttf/SDL_ttf.h>
+
#include <SDL3/SDL_begin_code.h>
/* Set up for C function definitions, even when using C++ */
@@ -37,7 +39,7 @@ extern "C" {
#endif
/* Text created with the text engine */
-typedef struct TTF_Text TTF_Text;
+struct TTF_Text;
/* Private data in TTF_Text, available to implementations */
struct TTF_TextData
@@ -109,7 +111,7 @@ typedef union TTF_DrawOperation
*
* \sa SDL_INIT_INTERFACE
*/
-typedef struct TTF_TextEngine
+struct TTF_TextEngine
{
Uint32 version; /**< The version of this interface */
@@ -132,7 +134,7 @@ typedef struct TTF_TextEngine
*/
void (SDLCALL *DestroyText)(void *userdata, TTF_Text *text);
-} TTF_TextEngine;
+};
/* Check the size of TTF_TextEngine
*
@@ -149,6 +151,7 @@ SDL_COMPILE_TIME_ASSERT(TTF_TextEngine_SIZE,
#ifdef __cplusplus
}
#endif
+
#include <SDL3/SDL_close_code.h>
#endif /* SDL_TTF_TEXTENGINE_H_ */
diff --git a/src/SDL_hashtable.c b/src/SDL_hashtable.c
index 797264a2..959128a7 100644
--- a/src/SDL_hashtable.c
+++ b/src/SDL_hashtable.c
@@ -18,7 +18,6 @@
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
-
#include <SDL3/SDL.h>
#include "SDL_hashtable.h"
diff --git a/src/SDL_renderer_textengine.c b/src/SDL_renderer_textengine.c
index 4a74341b..c1ab1af0 100644
--- a/src/SDL_renderer_textengine.c
+++ b/src/SDL_renderer_textengine.c
@@ -18,7 +18,6 @@
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
-#include <SDL3_ttf/SDL_ttf.h>
#include <SDL3_ttf/SDL_textengine.h>
#include "SDL_hashtable.h"
@@ -366,4 +365,3 @@ void TTF_DestroyRendererTextEngine(TTF_TextEngine *engine)
engine->CreateText = NULL;
SDL_free(engine);
}
-
diff --git a/src/SDL_surface_textengine.c b/src/SDL_surface_textengine.c
index 0bc84342..d5c6135b 100644
--- a/src/SDL_surface_textengine.c
+++ b/src/SDL_surface_textengine.c
@@ -18,7 +18,6 @@
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
-#include <SDL3_ttf/SDL_ttf.h>
#include <SDL3_ttf/SDL_textengine.h>
#include "SDL_hashtable.h"