diff options
author | chai <chaifix@163.com> | 2021-11-05 12:14:59 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-11-05 12:14:59 +0800 |
commit | 6d5787d8da9ad1685864668dd4c3d6aa73a563db (patch) | |
tree | f4d28a553b13b369a580c482e187bcc4b42f39de /Runtime/GUI/TextMeshGenerator.h | |
parent | be9870f5c1ba4f6ae8cd9764f1a8ed56ee81ddd5 (diff) |
TextMeshGenerator
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 |