summaryrefslogtreecommitdiff
path: root/Client/Source/GUI/TextMeshGenerator.h
blob: acc0a0afbaffe576921a473ceb3a0c40ef50420d (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
#pragma once 

#include <vector>
#include <unordered_map>

#include "../Debug/Log.h"
#include "../Graphics/Color.h"

#include "UITextMesh.h"
#include "Font.h"

// 逐步回收长期没用到的textmesh
class GraduallyReleaseTextMesh 
{
};

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())