mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-19 21:39:57 +00:00
Merge branch 'master' of https://github.com/ZakatTeamI2P/mkxp-sunshine
This commit is contained in:
commit
a466201881
2 changed files with 12 additions and 12 deletions
16
src/font.cpp
16
src/font.cpp
|
|
@ -31,8 +31,6 @@
|
|||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include <SDL3_ttf/SDL_ttf.h>
|
||||
|
||||
typedef std::pair<std::string, int> 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(),
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@
|
|||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include <SDL3_ttf/SDL_ttf.h>
|
||||
|
||||
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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue