summaryrefslogtreecommitdiff
path: root/Runtime/GUI/UITextMesh.h
blob: 7778785bc3a044561aaceb14bee99d5d7975c18a (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
41
42
43
44
45
46
47
48
#pragma once
#include "../Graphics/VertexBuffer.h"
#include "Font.h"
#include "Runtime/Utilities/Exception.h"
#include <unordered_map>

CustomException(TextMeshException);

enum ETextAnchor
{
    TextAnchor_UpperLeft,
    TextAnchor_UpperCenter,
    TextAnchor_UpperRight,
    TextAnchor_MiddleLeft,
    TextAnchor_MiddleCenter,
    TextAnchor_MiddleRight,
    TextAnchor_LowerLeft,
    TextAnchor_LowerCenter,
    TextAnchor_LowerRight,
};

enum ETextAlignment {
    TextAlignment_Left,
    TextAlignment_Center,
    TextAlignment_Right,
};

typedef unsigned long long TextMeshHash;

namespace TextHelper
{
	TextMeshHash GetTextMeshHash();
}

class UITextMesh
{
public:
	UITextMesh(const UnicodeString& str, Font* font, int pixelSize, int lineHeight, ETextAnchor anchor = TextAnchor_UpperLeft, ETextAlignment alignment = TextAlignment_Left, bool wordwrap = false, float preferred = 0)/*throw TextMeshException*/;

	~UITextMesh();

	void Draw();

private: 
	Font* m_Font;
	std::unordered_map<int/*IndexOfAtlas*/, VertexBuffer*> m_VBOs;
	
};