From 6d5787d8da9ad1685864668dd4c3d6aa73a563db Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 5 Nov 2021 12:14:59 +0800 Subject: TextMeshGenerator --- Runtime/GUI/TextMeshGenerator.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'Runtime/GUI/TextMeshGenerator.h') diff --git a/Runtime/GUI/TextMeshGenerator.h b/Runtime/GUI/TextMeshGenerator.h index dd4f1d9..815f4c4 100644 --- a/Runtime/GUI/TextMeshGenerator.h +++ b/Runtime/GUI/TextMeshGenerator.h @@ -3,9 +3,11 @@ #include "UITextMesh.h" #include "Runtime/Utilities/IIncrementalTask.h" #include "Font.h" +#include "Runtime/Debug/Log.h" #include +#include -// collect unused text mesh gradually +// 逐步回收长期没用到的textmesh class GraduallyReleaseTextMesh : public IIncrementalTask { public: @@ -21,14 +23,18 @@ public: }; +struct UITextMeshList { + UITextMesh* mesh; + UITextMeshList* next; +}; + class TextMeshGenerator : public Singleton { public: - UITextMesh* GetTextMesh(const UnicodeString& str, Font* font, int pixelSize, int lineHeight, Color32 col32, ETextAnchor anchor, ETextAlignment alignment, bool wordwrap, float preferred); + const UITextMesh* GetTextMesh(const UnicodeString& str, Font* font, int pixelSize, int lineHeight, Color32 col32, ETextAnchor anchor, ETextAlignment alignment, bool wordwrap, float preferred); private: - std::vector m_TextMeshes; - + std::unordered_map m_TextMeshes; }; #define g_TextMeshGenerator (*TextMeshGenerator::Instance()) \ No newline at end of file -- cgit v1.1-26-g67d0