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/UITextMesh.h | 69 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 Client/Source/GUI/UITextMesh.h (limited to 'Client/Source/GUI/UITextMesh.h') diff --git a/Client/Source/GUI/UITextMesh.h b/Client/Source/GUI/UITextMesh.h new file mode 100644 index 0000000..869db80 --- /dev/null +++ b/Client/Source/GUI/UITextMesh.h @@ -0,0 +1,69 @@ +#pragma once + +#include "../Graphics/VertexBuffer.h" +#include "../Utilities/Exception.h" +#include "../Graphics/Color.h" + +#include "Font.h" + +#include + +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, +}; + +namespace TextHelper +{ +} + +class UITextMesh +{ +public: + void Draw() const; + +private: + friend class TextMeshGenerator; + + UITextMesh(const UnicodeString& str, Font* font, int pixelSize, int lineHeight, Color32 color32 = Color32::white, ETextAnchor anchor = TextAnchor_UpperLeft, ETextAlignment alignment = TextAlignment_Left, bool wordwrap = false, float preferred = 0)/*throw TextMeshException*/; + ~UITextMesh(); + + GET(const Font*, Font, m_Font); + GET(int, PixelSize, m_PixelSize); + GET(int, LineHeight, m_LineHeight); + GET(Color32, Color, m_Color); + GET(ETextAlignment, Alignment, m_Alignment); + GET(ETextAnchor, Anchor, m_Anchor); + GET(bool, Wordwrap, m_Wordwrap); + GET(float, Preferred, m_Preferred); + GET(const UnicodeString&, Content, m_Content); + + std::unordered_map m_VBOs; + + Font* m_Font; + UnicodeString m_Content; + int m_PixelSize; + int m_LineHeight; + Color32 m_Color; + ETextAlignment m_Alignment; + ETextAnchor m_Anchor; + bool m_Wordwrap; + float m_Preferred; + +}; \ No newline at end of file -- cgit v1.1-26-g67d0