mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-14 16:59:54 +02:00
ImColor::HSV() helper + color buttons demo
This commit is contained in:
13
imgui.cpp
13
imgui.cpp
@ -7808,6 +7808,19 @@ void ImGui::ShowTestWindow(bool* opened)
|
||||
ImGui::RadioButton("radio b", &e, 1); ImGui::SameLine();
|
||||
ImGui::RadioButton("radio c", &e, 2);
|
||||
|
||||
// Color buttons, demonstrate using PushID() to add unique identifier in the ID stack, and changing style.
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
if (i > 0) ImGui::SameLine();
|
||||
ImGui::PushID(i);
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImColor::HSV(i/7.0f, 0.6f, 0.6f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImColor::HSV(i/7.0f, 0.7f, 0.7f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImColor::HSV(i/7.0f, 0.8f, 0.8f));
|
||||
ImGui::Button("Click");
|
||||
ImGui::PopStyleColor(3);
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
ImGui::Text("Hover me");
|
||||
if (ImGui::IsItemHovered())
|
||||
ImGui::SetTooltip("I am a tooltip");
|
||||
|
Reference in New Issue
Block a user