mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-06 04:58:47 +02:00
This commit is contained in:
8
imgui.h
8
imgui.h
@ -2342,13 +2342,13 @@ struct ImGuiListClipper
|
||||
// **None of the ImGui API are using ImColor directly but you can use it as a convenience to pass colors in either ImU32 or ImVec4 formats. Explicitly cast to ImU32 or ImVec4 if needed.
|
||||
struct ImColor
|
||||
{
|
||||
ImVec4 Value;
|
||||
ImVec4 Value;
|
||||
|
||||
ImColor() { Value.x = Value.y = Value.z = Value.w = 0.0f; }
|
||||
constexpr ImColor() { }
|
||||
constexpr ImColor(float r, float g, float b, float a = 1.0f) : Value(r, g, b, a) { }
|
||||
constexpr ImColor(const ImVec4& col) : Value(col) {}
|
||||
ImColor(int r, int g, int b, int a = 255) { float sc = 1.0f / 255.0f; Value.x = (float)r * sc; Value.y = (float)g * sc; Value.z = (float)b * sc; Value.w = (float)a * sc; }
|
||||
ImColor(ImU32 rgba) { float sc = 1.0f / 255.0f; Value.x = (float)((rgba >> IM_COL32_R_SHIFT) & 0xFF) * sc; Value.y = (float)((rgba >> IM_COL32_G_SHIFT) & 0xFF) * sc; Value.z = (float)((rgba >> IM_COL32_B_SHIFT) & 0xFF) * sc; Value.w = (float)((rgba >> IM_COL32_A_SHIFT) & 0xFF) * sc; }
|
||||
ImColor(float r, float g, float b, float a = 1.0f) { Value.x = r; Value.y = g; Value.z = b; Value.w = a; }
|
||||
ImColor(const ImVec4& col) { Value = col; }
|
||||
inline operator ImU32() const { return ImGui::ColorConvertFloat4ToU32(Value); }
|
||||
inline operator ImVec4() const { return Value; }
|
||||
|
||||
|
Reference in New Issue
Block a user