summaryrefslogtreecommitdiff
path: root/Runtime/GUI/TextMeshGenerator.h
blob: 815f4c4782c269817bcb3b2f73a9aaba6ac917a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#pragma once 

#include "UITextMesh.h"
#include "Runtime/Utilities/IIncrementalTask.h"
#include "Font.h"
#include "Runtime/Debug/Log.h"
#include <vector>
#include <unordered_map>

// 逐步回收长期没用到的textmesh
class GraduallyReleaseTextMesh : public IIncrementalTask
{
public:
    void Execute() override
    {

    }

    bool IsDone() override
    {

    }

};

struct UITextMeshList {
    UITextMesh* mesh; 
    UITextMeshList* next;
};

class TextMeshGenerator : public Singleton<TextMeshGenerator>
{
public:
    const UITextMesh* GetTextMesh(const UnicodeString& str, Font* font, int pixelSize, int lineHeight, Color32 col32, ETextAnchor anchor, ETextAlignment alignment, bool wordwrap, float preferred);

private:
    std::unordered_map<uint32_t, UITextMeshList*> m_TextMeshes;
};

#define g_TextMeshGenerator (*TextMeshGenerator::Instance())