From 8c38116f5b7213e39c90493b5430e58da14265b9 Mon Sep 17 00:00:00 2001 From: meowtech Date: Mon, 30 Mar 2026 21:01:56 +0000 Subject: [PATCH] code changes for SDL3... again --- src/font.cpp | 16 +++++++--------- src/font.h | 8 +++++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/font.cpp b/src/font.cpp index 3de72d6..a2d4552 100644 --- a/src/font.cpp +++ b/src/font.cpp @@ -31,8 +31,6 @@ #include #include -#include - typedef std::pair FontKey; struct FontSet @@ -88,10 +86,10 @@ SharedFontState::~SharedFontState() delete p; } -void SharedFontState::initFontSetCB(SDL_IOStream &ops, +void SharedFontState::initFontSetCB(SDL_IOStream* &ops, const std::string &filename) { - TTF_Font *font = TTF_OpenFontIO(&ops, 0, 0); + TTF_Font *font = TTF_OpenFontIO(ops, false, 0); if (!font) return; @@ -109,7 +107,7 @@ void SharedFontState::initFontSetCB(SDL_IOStream &ops, set.other = filename; } -_TTF_Font *SharedFontState::getFont(std::string family, +TTF_Font *SharedFontState::getFont(std::string family, int size) { /* Check for substitutions */ @@ -147,8 +145,8 @@ _TTF_Font *SharedFontState::getFont(std::string family, ? req.regular.c_str() : req.other.c_str(); //ops = SDL_OpenIO(); - SDL_IOStream ops; - shState->fileSystem().openReadRaw(*ops, path, true); + SDL_IOStream* ops; + shState->fileSystem().openReadRaw(ops, path); } font = TTF_OpenFontIO(ops, 1, size); @@ -157,7 +155,7 @@ _TTF_Font *SharedFontState::getFont(std::string family, throw Exception(Exception::SDLError, "%s", SDL_GetError()); p->pool.insert(key, font); - return (_TTF_Font*)font; + return font; } bool SharedFontState::fontPresent(std::string family) const @@ -410,7 +408,7 @@ void Font::initDefaults(const SharedFontState &sfs) FontPrivate::defaultShadow = (rgssVer == 2 ? true : false); } -_TTF_Font *Font::getSdlFont() +TTF_Font *Font::getSdlFont() { if (!p->sdlFont) p->sdlFont = shState->fontState().getFont(p->name.c_str(), diff --git a/src/font.h b/src/font.h index c436809..eff0550 100644 --- a/src/font.h +++ b/src/font.h @@ -28,6 +28,8 @@ #include #include +#include + struct SDL_IOStream; struct _TTF_Font; struct Config; @@ -44,10 +46,10 @@ public: * (when "Fonts/" is scanned for available assets). * 'ops' is an opened handle to a possible font file, * 'filename' is the corresponding path */ - void initFontSetCB(SDL_IOStream &ops, + void initFontSetCB(SDL_IOStream* &ops, const std::string &filename); - _TTF_Font *getFont(std::string family, + TTF_Font *getFont(std::string family, int size); bool fontPresent(std::string family) const; @@ -110,7 +112,7 @@ public: static void initDefaults(const SharedFontState &sfs); /* internal */ - _TTF_Font *getSdlFont(); + TTF_Font *getSdlFont(); private: FontPrivate *p;