From 60cbbdec07ab7a5636eac5b3c024ae44e937f4d4 Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 13 Dec 2021 00:07:19 +0800 Subject: +init --- Client/Source/GUI/UIMesh.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Client/Source/GUI/UIMesh.h (limited to 'Client/Source/GUI/UIMesh.h') 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; +}; -- cgit v1.1-26-g67d0