diff options
Diffstat (limited to 'Runtime/GUI/TextMeshGenerator.h')
-rw-r--r-- | Runtime/GUI/TextMeshGenerator.h | 14 |
1 files changed, 10 insertions, 4 deletions
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 <vector>
+#include <unordered_map>
-// 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<TextMeshGenerator>
{
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<UITextMesh*> m_TextMeshes;
-
+ std::unordered_map<uint32_t, UITextMeshList*> m_TextMeshes;
};
#define g_TextMeshGenerator (*TextMeshGenerator::Instance())
\ No newline at end of file |