diff --git a/include/Nazara/Utility/SimpleTextDrawer.hpp b/include/Nazara/Utility/SimpleTextDrawer.hpp index 0f6046fe5..a84f8a2c3 100644 --- a/include/Nazara/Utility/SimpleTextDrawer.hpp +++ b/include/Nazara/Utility/SimpleTextDrawer.hpp @@ -25,6 +25,10 @@ class NAZARA_API NzSimpleTextDrawer : public NzAbstractTextDrawer, NzObjectListe unsigned int GetCharacterSize() const; const NzColor& GetColor() const; NzFont* GetFont() const; + NzFont* GetFont(unsigned int index) const override; + unsigned int GetFontCount() const override; + const Glyph& GetGlyph(unsigned int index) const override; + unsigned int GetGlyphCount() const override; nzUInt32 GetStyle() const; const NzString& GetText() const; @@ -38,11 +42,6 @@ class NAZARA_API NzSimpleTextDrawer : public NzAbstractTextDrawer, NzObjectListe static NzSimpleTextDrawer Draw(NzFont* font, const NzString& str, unsigned int characterSize, nzUInt32 style = nzTextStyle_Regular, const NzColor& color = NzColor::White); private: - NzFont* GetFont(unsigned int index) const override; - unsigned int GetFontCount() const override; - const Glyph& GetGlyph(unsigned int index) const override; - unsigned int GetGlyphCount() const override; - bool OnObjectModified(const NzRefCounted* object, int index, unsigned int code) override; void OnObjectReleased(const NzRefCounted* object, int index) override; void UpdateGlyphs() const; diff --git a/src/Nazara/Utility/SimpleTextDrawer.cpp b/src/Nazara/Utility/SimpleTextDrawer.cpp index 2cc3051af..f8fe74841 100644 --- a/src/Nazara/Utility/SimpleTextDrawer.cpp +++ b/src/Nazara/Utility/SimpleTextDrawer.cpp @@ -37,6 +37,40 @@ NzFont* NzSimpleTextDrawer::GetFont() const return m_font; } +NzFont* NzSimpleTextDrawer::GetFont(unsigned int index) const +{ + #if NAZARA_UTILITY_SAFE + if (index > 0) + { + NazaraError("Font index out of range (" + NzString::Number(index) + " >= 1)"); + return nullptr; + } + #endif + + return m_font; +} + +unsigned int NzSimpleTextDrawer::GetFontCount() const +{ + return 1; +} + +const NzAbstractTextDrawer::Glyph& NzSimpleTextDrawer::GetGlyph(unsigned int index) const +{ + if (!m_glyphUpdated) + UpdateGlyphs(); + + return m_glyphs[index]; +} + +unsigned int NzSimpleTextDrawer::GetGlyphCount() const +{ + if (!m_glyphUpdated) + UpdateGlyphs(); + + return m_glyphs.size(); +} + nzUInt32 NzSimpleTextDrawer::GetStyle() const { return m_style; @@ -106,40 +140,6 @@ NzSimpleTextDrawer NzSimpleTextDrawer::Draw(NzFont* font, const NzString& str, u return drawer; } -NzFont* NzSimpleTextDrawer::GetFont(unsigned int index) const -{ - #if NAZARA_UTILITY_SAFE - if (index > 0) - { - NazaraError("Font index out of range (" + NzString::Number(index) + " >= 1)"); - return nullptr; - } - #endif - - return m_font; -} - -unsigned int NzSimpleTextDrawer::GetFontCount() const -{ - return 1; -} - -const NzAbstractTextDrawer::Glyph& NzSimpleTextDrawer::GetGlyph(unsigned int index) const -{ - if (!m_glyphUpdated) - UpdateGlyphs(); - - return m_glyphs[index]; -} - -unsigned int NzSimpleTextDrawer::GetGlyphCount() const -{ - if (!m_glyphUpdated) - UpdateGlyphs(); - - return m_glyphs.size(); -} - bool NzSimpleTextDrawer::OnObjectModified(const NzRefCounted* object, int index, unsigned int code) { NazaraUnused(object);