diff options
Diffstat (limited to '3rdparty/bgfx/examples/11-fontsdf/fontsdf.cpp')
-rw-r--r-- | 3rdparty/bgfx/examples/11-fontsdf/fontsdf.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/3rdparty/bgfx/examples/11-fontsdf/fontsdf.cpp b/3rdparty/bgfx/examples/11-fontsdf/fontsdf.cpp index 43634abba9b..6cbe71d829e 100644 --- a/3rdparty/bgfx/examples/11-fontsdf/fontsdf.cpp +++ b/3rdparty/bgfx/examples/11-fontsdf/fontsdf.cpp @@ -37,8 +37,8 @@ TrueTypeHandle loadTtf(FontManager* _fm, const char* _filePath) class ExampleFontSDF : public entry::AppI { public: - ExampleFontSDF(const char* _name, const char* _description) - : entry::AppI(_name, _description) + ExampleFontSDF(const char* _name, const char* _description, const char* _url) + : entry::AppI(_name, _description, _url) { } @@ -73,7 +73,9 @@ public: // Imgui. imguiCreate(); - m_bigText = (char*)load("text/sherlock_holmes_a_scandal_in_bohemia_arthur_conan_doyle.txt"); + uint32_t size; + m_txtFile = load("text/sherlock_holmes_a_scandal_in_bohemia_arthur_conan_doyle.txt", &size); + m_bigText = bx::StringView( (const char*)m_txtFile, size); // Init the text rendering system. m_fontManager = new FontManager(512); @@ -111,7 +113,7 @@ public: { imguiDestroy(); - BX_FREE(entry::getAllocator(), m_bigText); + unload(m_txtFile); m_fontManager->destroyTtf(m_font); // Destroy the fonts. @@ -253,7 +255,8 @@ public: uint32_t m_debug; uint32_t m_reset; - char* m_bigText; + void* m_txtFile; + bx::StringView m_bigText; // Init the text rendering system. FontManager* m_fontManager; @@ -279,4 +282,9 @@ public: } // namespace -ENTRY_IMPLEMENT_MAIN(ExampleFontSDF, "11-fontsdf", "Use a single distance field font to render text of various size."); +ENTRY_IMPLEMENT_MAIN( + ExampleFontSDF + , "11-fontsdf" + , "Use a single distance field font to render text of various size." + , "https://bkaradzic.github.io/bgfx/examples.html#fontsdf" + ); |