|
@@ -389,7 +389,8 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|
// Color buttons, demonstrate using PushID() to add unique identifier in the ID stack, and changing style.
|
|
// Color buttons, demonstrate using PushID() to add unique identifier in the ID stack, and changing style.
|
|
for (int i = 0; i < 7; i++)
|
|
for (int i = 0; i < 7; i++)
|
|
{
|
|
{
|
|
- if (i > 0) ImGui::SameLine();
|
|
|
|
|
|
+ if (i > 0)
|
|
|
|
+ ImGui::SameLine();
|
|
ImGui::PushID(i);
|
|
ImGui::PushID(i);
|
|
ImGui::PushStyleColor(ImGuiCol_Button, (ImVec4)ImColor::HSV(i/7.0f, 0.6f, 0.6f));
|
|
ImGui::PushStyleColor(ImGuiCol_Button, (ImVec4)ImColor::HSV(i/7.0f, 0.6f, 0.6f));
|
|
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, (ImVec4)ImColor::HSV(i/7.0f, 0.7f, 0.7f));
|
|
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, (ImVec4)ImColor::HSV(i/7.0f, 0.7f, 0.7f));
|
|
@@ -399,7 +400,12 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|
ImGui::PopID();
|
|
ImGui::PopID();
|
|
}
|
|
}
|
|
|
|
|
|
- // Arrow buttons
|
|
|
|
|
|
+ // Use AlignTextToFramePadding() to align text baseline to the baseline of framed elements (otherwise a Text+SameLine+Button sequence will have the text a little too high by default)
|
|
|
|
+ ImGui::AlignTextToFramePadding();
|
|
|
|
+ ImGui::Text("Hold to repeat:");
|
|
|
|
+ ImGui::SameLine();
|
|
|
|
+
|
|
|
|
+ // Arrow buttons with Repeater
|
|
static int counter = 0;
|
|
static int counter = 0;
|
|
float spacing = ImGui::GetStyle().ItemInnerSpacing.x;
|
|
float spacing = ImGui::GetStyle().ItemInnerSpacing.x;
|
|
ImGui::PushButtonRepeat(true);
|
|
ImGui::PushButtonRepeat(true);
|