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

#include "../Utilities/Exception.h"
#include "../Graphics/DynamicMesh.h"
#include "../Math/Math.h"
#include "../Utilities/StaticInitiator.h"
#include "../Graphics/CustomVertexLayout.h"
#include "../Graphics/DefaultVertexLayout.h"
#include "../Graphics/Color.h"
#include "../Graphics/GfxDevice.h"

// UI默认的顶点布局
struct UIVertexLayout
{
    UIVertexLayout(Vector2f pos = Vector2f::zero, Vector2f texCoord = Vector2f::zero, Color32 col = Color32())
    {
        position = pos; 
        uv = texCoord;
        color = col;
    }

	Vector2f position;
	Vector2f uv;
	Color32 color;
};

typedef uint16 UIIndex;

CustomException(UIMeshException);

// 所有的UIMesh都是左上角为原点
class UIMesh : public DynamicMesh
{
public:
	UIMesh() : DynamicMesh() {}
	virtual ~UIMesh() {}

	virtual void Draw() = 0;

	static CustomVertexLayout s_UIVertexLayout;
	static unsigned int s_SizePerVertex;
};