
20.06.2022, 23:23
|
|
Флудер
Регистрация: 06.11.2017
Сообщений: 2,759
С нами:
4483143
Репутация:
183
|
|
Сообщение от !Sam#0235
If I can get both values that would be great, if not enough with string hex color
C++:
Код:
ImVec4 color
{
}
;
// ImGui::ColorEdit
unsigned
long
u32_color
=
IM_COL32
(
color
.
x
,
color
.
y
,
color
.
z
,
color
.
w
)
;
// or
auto
u32_color
=
ImGui
::
ColorConvertFloat4ToU32
(
color
)
;
convert to hex string:
C++:
Код:
std
::
string str_color
{
}
;
str_color
.
reserve
(
8
)
;
// SSO is used, there isn't allocation. Just in case
std
::
to_chars
(
str_color
.
data
(
)
,
str_color
.
data
(
)
+
str_color
.
capacity
(
)
,
u32_color
,
16
)
;
|
|
|