From cf64ce9a1312de5e9a76bb3f43105a4eac59eb15 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 2 Jan 2022 01:32:02 +0000 Subject: Use Cache system to persist font rendering for Text --- ui/font.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'ui/font.h') diff --git a/ui/font.h b/ui/font.h index c9d834a..4b44ee3 100644 --- a/ui/font.h +++ b/ui/font.h @@ -3,17 +3,21 @@ #include #include +#include #include #include +#include +#include #include #include -#include #include #include class Font { public: - Font(const char * const path, unsigned int height); + static Cache cachedFontRenderings; + + Font(std::filesystem::path path, unsigned int height); using Quad = std::array; using Quads = std::vector; @@ -28,7 +32,7 @@ public: long advance; }; struct FontTexture { - GLuint texture; + glTexture texture; unsigned int used; }; @@ -39,7 +43,7 @@ protected: const CharData getChar(char) const; std::size_t getTextureWithSpace(unsigned int adv) const; - std::string path; + std::filesystem::path path; glm::uvec3 size; mutable std::map charsData; mutable std::vector fontTextures; -- cgit v1.2.3