diff options
author | chai <chaifix@163.com> | 2021-12-13 00:07:19 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-12-13 00:07:19 +0800 |
commit | 60cbbdec07ab7a5636eac5b3c024ae44e937f4d4 (patch) | |
tree | b2c7b0a868f18159dbc43d8954e1bd7668549a88 /Client/Source/GUI/UIMesh.h |
+init
Diffstat (limited to 'Client/Source/GUI/UIMesh.h')
-rw-r--r-- | Client/Source/GUI/UIMesh.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/Client/Source/GUI/UIMesh.h b/Client/Source/GUI/UIMesh.h new file mode 100644 index 0000000..11f157a --- /dev/null +++ b/Client/Source/GUI/UIMesh.h @@ -0,0 +1,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; +}; |