dl
dl
ui
dl_ui_color.h
浏览该文件的文档.
1
12
13
#include "
base/dl_color.h
"
14
15
namespace
dl::UI
16
{
18
class
ColorSet
19
{
20
public
:
21
ColorSet
()
22
{
23
_col[0] =
ColorDef::RED
;
24
_col[1] =
ColorDef::RED
;
25
_col[2] =
ColorDef::WHITE
;
26
_col[3] =
ColorDef::GRAY
;
27
_col[4] =
ColorDef::GRAY
;
28
}
29
30
Color
operator[]
(
size_t
i)
31
{
32
if
(i >= _col.size())
33
return
ColorDef::WHITE
;
34
return
_col[i];
35
}
36
37
// 普通 经过 按下 禁用 禁用(按下)
38
void
Set
(
const
std::vector<Color>& mul_col)
39
{
40
if
(mul_col.size() == 1)
41
{
42
_col[0] = mul_col[0];
43
_col[1] = mul_col[0];
44
_col[2] = mul_col[0];
45
}
46
else
if
(mul_col.size() == 2)
47
{
48
_col[0] = mul_col[0];
49
_col[1] = mul_col[1];
50
_col[2] = mul_col[0];
51
}
52
else
if
(mul_col.size() >= 3)
53
{
54
_col[0] = mul_col[0];
55
_col[1] = mul_col[1];
56
_col[2] = mul_col[2];
57
if
(mul_col.size() == 4)
58
{
59
_col[3] = mul_col[3];
60
_col[4] = mul_col[3];
61
}
62
else
if
(mul_col.size() == 5)
63
{
64
_col[3] = mul_col[3];
65
_col[4] = mul_col[4];
66
}
67
else
if
(mul_col.size() != 3)
68
log_warn0
(
"传入过多的颜色没有意义!"
);
69
}
70
}
71
private
:
72
std::array<Color, 5> _col;
73
};
74
}
dl::UI::ColorSet::operator[]
Color operator[](size_t i)
取
定义
dl_ui_color.h:30
dl::UI::ColorSet::ColorSet
ColorSet()
定义
dl_ui_color.h:21
dl::UI::ColorSet::Set
void Set(const std::vector< Color > &mul_col)
定义
dl_ui_color.h:38
dl_color.h
颜色
dl::ColorDef::RED
constexpr Color RED
定义
dl_color.h:352
dl::ColorDef::WHITE
constexpr Color WHITE
定义
dl_color.h:350
dl::ColorDef::GRAY
constexpr Color GRAY
定义
dl_color.h:370
dl::UI
UI系统
定义
dl_ui_background.h:21
dl::Color
Array< float, 4 > Color
定义
dl_type_def.h:58
dl::log_warn0
void log_warn0(std::string_view str, DL_SOURCE_LOCATION)
制作者
1.13.1