diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-21 19:46:23 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-21 19:46:23 +1000 |
commit | 8dce3349312927653b2ca7a33dcee0d2e6b69137 (patch) | |
tree | c2eb04711315d887c10c5ee649982ed37ea802dc /source/rendering/StarFontTextureGroup.hpp | |
parent | f2e64e17527f16966a37c788ca65e1e88bf44907 (diff) |
custom fonts!!
Diffstat (limited to 'source/rendering/StarFontTextureGroup.hpp')
-rw-r--r-- | source/rendering/StarFontTextureGroup.hpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/source/rendering/StarFontTextureGroup.hpp b/source/rendering/StarFontTextureGroup.hpp index 17c6467..9beb5d6 100644 --- a/source/rendering/StarFontTextureGroup.hpp +++ b/source/rendering/StarFontTextureGroup.hpp @@ -11,7 +11,8 @@ STAR_CLASS(FontTextureGroup); class FontTextureGroup { public: - typedef tuple<String::Char, unsigned, String> GlyphDescriptor; + // Font* is only included for key uniqueness and should not be dereferenced + typedef tuple<String::Char, unsigned, String, Font*> GlyphDescriptor; struct GlyphTexture { TexturePtr texture; @@ -19,7 +20,7 @@ public: Vec2F processingOffset; }; - FontTextureGroup(FontPtr font, TextureGroupPtr textureGroup); + FontTextureGroup(TextureGroupPtr textureGroup); const GlyphTexture& glyphTexture(String::Char, unsigned fontSize, String const& processingDirectives); @@ -31,9 +32,15 @@ public: // Removes glyphs that haven't been used in more than the given time in // milliseconds void cleanup(int64_t timeout); + // Switches the current font + void switchFont(String const& font); + void addFont(FontPtr const& font, String const& name, bool default = false); private: - + StringMap<FontPtr> m_fonts; + String m_fontName; FontPtr m_font; + FontPtr m_defaultFont; + TextureGroupPtr m_textureGroup; HashMap<GlyphDescriptor, GlyphTexture> m_glyphs; }; |