summaryrefslogtreecommitdiff
path: root/Runtime/GUI/UITextMesh.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Runtime/GUI/UITextMesh.cpp')
-rw-r--r--Runtime/GUI/UITextMesh.cpp28
1 files changed, 12 insertions, 16 deletions
diff --git a/Runtime/GUI/UITextMesh.cpp b/Runtime/GUI/UITextMesh.cpp
index a800dcd..39bed55 100644
--- a/Runtime/GUI/UITextMesh.cpp
+++ b/Runtime/GUI/UITextMesh.cpp
@@ -52,20 +52,17 @@ InitializeStaticVariables([]() {
s_SizePerText = sizeof(TextMeshVBOLayout) * 4;
});
-// 一段文字里面的网格可能会来自不同的atlas,在生成UITextMesh时做好合批
-
-// 需要支持
-// * 大小
-// * 锚点
-// * 对齐方式
-// * 换行
-// * 颜色
-
-// lineheight 用来处理换行、锚点
-// wordwrap 自动换行
-// preferredSize 自动换行区域大小
-UITextMesh::UITextMesh(const UnicodeString& str, Font* font, int pixelSize, int lineHeight, ETextAnchor anchor, ETextAlignment alignment, bool wordwrap, float preferred)
-{
+UITextMesh::UITextMesh(
+ const UnicodeString& str // 文本
+ , Font* font // 字体
+ , int pixelSize // 大小
+ , int lineHeight // 行高
+ , Color32 color32 // 颜色
+ , ETextAnchor anchor // 锚点
+ , ETextAlignment alignment // 对齐方式
+ , bool wordwrap // 自动换行
+ , float preferred // 自动换行区域大小
+){
s_TextInfos.clear();
// 记录文本每行的长度
@@ -110,7 +107,6 @@ UITextMesh::UITextMesh(const UnicodeString& str, Font* font, int pixelSize, int
unsigned int atlasIndex = ch->atlas;
if (atlasIndex != FONT_NOT_IN_ATLAS_PLACEHOLDER) //非空格
{
-
// 换行符Unix'\n', Windows'\r\n', MacOS '\r'
#define CHECK_BREAKS() \
if (c == '\n' || c == '\r') \
@@ -224,7 +220,7 @@ UITextMesh::UITextMesh(const UnicodeString& str, Font* font, int pixelSize, int
{
dst[vOff + j].position.Set(pos[2 * j], pos[2 * j + 1]);
dst[vOff + j].uv.Set(uv[2 * j], uv[2 * j + 1]);
- dst[vOff + j].color.Set(255 , 255, 255, 255);
+ dst[vOff + j].color = color32;
}
int iOff = i * s_IndicesPerText;