dl
类 | Public 成员函数 | 友元 | 所有成员列表
dl::Text类 参考

#include <dl_text.h>

类

struct  Layout
 布局属性 更多...
 

Public 成员函数

void Render ()
 绘制 更多...
 
void SetFormat (bool open)
 设置是否要格式化字符串(默认为否) 更多...
 
void SetLayoutAlign (Align::Direction dir_h)
 设置布局属性(单行而已) 更多...
 
void SetPositionAlign (const Position &pos={}, const Align::Direction2 &dir={ Align::Direction::BACK, Align::Direction::BACK })
 设置Coor位置,来整体对齐 更多...
 
void SetPositionAlign (const Position &pos, Align::Direction dir_v)
 
void SetCenter (const Position &pos={})
 设置Coor位置,并根据整体大小居中 更多...
 
void SetMaxW (unsigned w)
 设置自动换行宽度,0为不自动换行 更多...
 
void SetLineSpacing (Float k)
 设置行间距,默认为1.0 更多...
 
const Layout & GetLayout ()
 
void SetOrder (float order)
 设置绘制顺序 更多...
 
void SetColor (const Color &col, TextParam type=TextParam::NORMAL)
 设置颜色 更多...
 
void SetString (std::string_view str)
 设置内容 更多...
 
void SetFontId (std::size_t id)
 设置字体id 更多...
 
void SetFontSize (unsigned size)
 设置字体大小 更多...
 
void SetOutline (unsigned outline, const Color &color=ColorDef::BLACK)
 设置描边属性 更多...
 
void SetShadow (unsigned shadow, const Color &color=ColorDef::BLACK)
 设置阴影属性 更多...
 
void SetBackground (bool open, const Color &col=ColorDef::TEXT_BG)
 设置背景精灵 更多...
 
void SetBackground (Text *b)
 注意传入gcText会调用上面的重载 更多...
 
Coor * GetCoor ()
 返回坐标系 更多...
 
float GetOrder ()
 
std::string GetString ()
 
Color GetColor (TextParam type=TextParam::NORMAL)
 
Size GetSize ()
 返回区域大小 更多...
 
unsigned GetFontSize (TextParam type=TextParam::NORMAL)
 返回字体大小 更多...
 
bool IsPickup ()
 是否被光标选中 更多...
 
 ~Text ()
 

友元

class Factory
 
class PoolList< Text >
 

详细描述

在文件 dl_text.h 第 74 行定义.

构造及析构函数说明

◆ ~Text()

dl::Text::~Text ( )

成员函数说明

◆ GetColor()

Color dl::Text::GetColor ( TextParam  type = TextParam::NORMAL)
inline

在文件 dl_text.h 第 244 行定义.

◆ GetCoor()

Coor * dl::Text::GetCoor ( )
inline

返回坐标系

注解
注意,直接调整位置是以左上角对齐,请优先使用SetPositionAlign

在文件 dl_text.h 第 238 行定义.

◆ GetFontSize()

unsigned dl::Text::GetFontSize ( TextParam  type = TextParam::NORMAL)
inline

返回字体大小

在文件 dl_text.h 第 258 行定义.

◆ GetLayout()

const Layout & dl::Text::GetLayout ( )
inline

在文件 dl_text.h 第 166 行定义.

◆ GetOrder()

float dl::Text::GetOrder ( )
inline

在文件 dl_text.h 第 240 行定义.

◆ GetSize()

Size dl::Text::GetSize ( )
inline

返回区域大小

注解
字体本身一定是左上角为0

在文件 dl_text.h 第 253 行定义.

◆ GetString()

std::string dl::Text::GetString ( )

◆ IsPickup()

bool dl::Text::IsPickup ( )

是否被光标选中

◆ Render()

void dl::Text::Render ( )

绘制

◆ SetBackground() [1/2]

void dl::Text::SetBackground ( bool  open,
const Color &  col = ColorDef::TEXT_BG 
)

设置背景精灵

注解
自动设定为文本大小,但可以设定颜色

◆ SetBackground() [2/2]

void dl::Text::SetBackground ( Text *  b)
inline

注意传入gcText会调用上面的重载

在文件 dl_text.h 第 226 行定义.

◆ SetCenter()

void dl::Text::SetCenter ( const Position &  pos = {})

设置Coor位置,并根据整体大小居中

注解
字体大小变化后,需要重新设置

◆ SetColor()

void dl::Text::SetColor ( const Color &  col,
TextParam  type = TextParam::NORMAL 
)

设置颜色

◆ SetFontId()

void dl::Text::SetFontId ( std::size_t  id)

设置字体id

◆ SetFontSize()

void dl::Text::SetFontSize ( unsigned  size)

设置字体大小

◆ SetFormat()

void dl::Text::SetFormat ( bool  open)
inline

设置是否要格式化字符串(默认为否)

在文件 dl_text.h 第 105 行定义.

◆ SetLayoutAlign()

void dl::Text::SetLayoutAlign ( Align::Direction  dir_h)
inline

设置布局属性(单行而已)

在文件 dl_text.h 第 117 行定义.

◆ SetLineSpacing()

void dl::Text::SetLineSpacing ( Float  k)
inline

设置行间距,默认为1.0

在文件 dl_text.h 第 160 行定义.

◆ SetMaxW()

void dl::Text::SetMaxW ( unsigned  w)
inline

设置自动换行宽度,0为不自动换行

在文件 dl_text.h 第 151 行定义.

◆ SetOrder()

void dl::Text::SetOrder ( float  order)

设置绘制顺序

◆ SetOutline()

void dl::Text::SetOutline ( unsigned  outline,
const Color &  color = ColorDef::BLACK 
)

设置描边属性

◆ SetPositionAlign() [1/2]

void dl::Text::SetPositionAlign ( const Position &  pos,
Align::Direction  dir_v 
)
inline

在文件 dl_text.h 第 136 行定义.

◆ SetPositionAlign() [2/2]

void dl::Text::SetPositionAlign ( const Position &  pos = {},
const Align::Direction2 &  dir = { Align::Direction::BACK, Align::Direction::BACK } 
)
inline

设置Coor位置,来整体对齐

注解
字体大小变化后,需要重新设置

在文件 dl_text.h 第 129 行定义.

◆ SetShadow()

void dl::Text::SetShadow ( unsigned  shadow,
const Color &  color = ColorDef::BLACK 
)

设置阴影属性

◆ SetString()

void dl::Text::SetString ( std::string_view  str)

设置内容

参数
[in]str要设置的内容
备注
格式化标签如下
[c_red] 颜色 红色,可以有3个,额外指定描边和阴影的颜色
[f_0_24_2_1] 字体 id为0的字体,24大小,2描边大小,1阴影偏移
[s_test_0_1] 精灵 test, [0, 1]
[v_money] 变量 money
[t_8] 对齐 tab对齐到8个字体大小,默认为2个(即4个英文字母宽度)
[l] 左中括号
[r] 右中括号
[n_2] 换行 换行2次,默认为1次
特殊的 [c]、[f] 还原到字体本身颜色和字体

友元及相关函数文档

◆ Factory

friend class Factory
friend

在文件 dl_text.h 第 76 行定义.

◆ PoolList< Text >

friend class PoolList< Text >
friend

在文件 dl_text.h 第 76 行定义.


该类的文档由以下文件生成: