55 lines
1.5 KiB
C++
55 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include <dl_ui.h>
|
|
using namespace dl;
|
|
|
|
class UIText : public UI::Scene
|
|
{
|
|
public:
|
|
UIText()
|
|
{
|
|
UI::Panel* panel = CreatePanel("root");
|
|
panel->SetPosScale({ 0.0f, 0.0f });
|
|
panel->SetPosPixel(POS_CONTENT);
|
|
panel->SetLocator(createLocatorX(200, 3, 100));
|
|
|
|
{
|
|
UI::Text* txt = g_ui->CreateTextDefault();
|
|
txt->GetText()->SetBackground(true, ColorDef::RED);
|
|
txt->SetString("abcdefghijklmnopqrst\n123456789!@#$%^&*()_+\nqb...||");
|
|
panel->Add(txt);
|
|
}
|
|
{
|
|
UI::Text* txt = g_ui->CreateTextDefault();
|
|
txt->GetText()->SetFormat(true);
|
|
txt->SetString("第一行\n第二行\n第三行");
|
|
panel->Add(txt);
|
|
}
|
|
{
|
|
UI::Text* txt = g_ui->CreateTextDefault();
|
|
txt->GetText()->SetFormat(true);
|
|
txt->SetString("标签文本(字体)\n[f_0]字体1");
|
|
panel->Add(txt);
|
|
}
|
|
{
|
|
UI::Text* txt = g_ui->CreateTextDefault();
|
|
txt->GetText()->SetFormat(true);
|
|
txt->GetText()->SetColor(ColorDef::RED, TextParam::OUTLINE);
|
|
txt->GetText()->SetColor(ColorDef::RED, TextParam::SHADOW);
|
|
txt->SetString("标签文本(大小)\n[s_8]小字体\n[s_12_1_0]中字体\n[s_16_0_1]大字体");
|
|
panel->Add(txt);
|
|
}
|
|
{
|
|
UI::Text* txt = g_ui->CreateTextDefault();
|
|
txt->GetText()->SetFormat(true);
|
|
txt->SetString("标签文本(颜色)\n[c_red]红色\n[c_green]绿色\n[c_blue]蓝色");
|
|
panel->Add(txt);
|
|
}
|
|
{
|
|
UI::Text* txt = g_ui->CreateTextDefault();
|
|
txt->GetText()->SetFormat(true);
|
|
txt->SetString("标签文本(背景)\n带[b_red]背景颜色[b]的文本");
|
|
panel->Add(txt);
|
|
}
|
|
}
|
|
}; |