fix hex to u32
This commit is contained in:
@@ -21,6 +21,6 @@
|
||||
#define VE_NO_NAME(n) VE::func::name(n).data()
|
||||
#define VE_NAME(n) VE::func::name(n, "").data()
|
||||
|
||||
#define VE_COLOR(c, t) VE::func::color(c, t)
|
||||
#define VE_COLOR(c, t) VE::func::colorU32(c, t)
|
||||
|
||||
#define VE_GLGETSTRING(n) reinterpret_cast<const char*>(glGetString(n))
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace VE::func
|
||||
return key_no_name + n;
|
||||
}
|
||||
|
||||
inline ImU32 color(std::string hex, unsigned char alpha = 255)
|
||||
inline ImU32 colorU32(std::string hex, unsigned char alpha = 255)
|
||||
{
|
||||
if (hex[0] == '#') hex.erase(0, 1);
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace VE::func
|
||||
|
||||
// Парсим HEX
|
||||
if (hex.length() >= 6) std::sscanf(hex.c_str(), "%2x%2x%2x", &r, &g, &b);
|
||||
|
||||
|
||||
// Конвертируем в float (0.0-1.0)
|
||||
return ImVec4(
|
||||
r / 255.0f,
|
||||
|
||||
Reference in New Issue
Block a user