mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-06 13:08:47 +02:00
Merge branch 'master' into docking
# Conflicts: # imgui.cpp # imgui_demo.cpp # imgui_internal.h
This commit is contained in:
134
imgui_demo.cpp
134
imgui_demo.cpp
@ -396,12 +396,12 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
|
||||
if (ImGui::TreeNode("Configuration##2"))
|
||||
{
|
||||
ImGui::CheckboxFlags("io.ConfigFlags: NavEnableKeyboard", (unsigned int *)&io.ConfigFlags, ImGuiConfigFlags_NavEnableKeyboard);
|
||||
ImGui::CheckboxFlags("io.ConfigFlags: NavEnableGamepad", (unsigned int *)&io.ConfigFlags, ImGuiConfigFlags_NavEnableGamepad);
|
||||
ImGui::CheckboxFlags("io.ConfigFlags: NavEnableKeyboard", (unsigned int*)&io.ConfigFlags, ImGuiConfigFlags_NavEnableKeyboard);
|
||||
ImGui::CheckboxFlags("io.ConfigFlags: NavEnableGamepad", (unsigned int*)&io.ConfigFlags, ImGuiConfigFlags_NavEnableGamepad);
|
||||
ImGui::SameLine(); HelpMarker("Required back-end to feed in gamepad inputs in io.NavInputs[] and set io.BackendFlags |= ImGuiBackendFlags_HasGamepad.\n\nRead instructions in imgui.cpp for details.");
|
||||
ImGui::CheckboxFlags("io.ConfigFlags: NavEnableSetMousePos", (unsigned int *)&io.ConfigFlags, ImGuiConfigFlags_NavEnableSetMousePos);
|
||||
ImGui::CheckboxFlags("io.ConfigFlags: NavEnableSetMousePos", (unsigned int*)&io.ConfigFlags, ImGuiConfigFlags_NavEnableSetMousePos);
|
||||
ImGui::SameLine(); HelpMarker("Instruct navigation to move the mouse cursor. See comment for ImGuiConfigFlags_NavEnableSetMousePos.");
|
||||
ImGui::CheckboxFlags("io.ConfigFlags: NoMouse", (unsigned int *)&io.ConfigFlags, ImGuiConfigFlags_NoMouse);
|
||||
ImGui::CheckboxFlags("io.ConfigFlags: NoMouse", (unsigned int*)&io.ConfigFlags, ImGuiConfigFlags_NoMouse);
|
||||
|
||||
// The "NoMouse" option above can get us stuck with a disable mouse! Provide an alternative way to fix it:
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_NoMouse)
|
||||
@ -414,7 +414,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Space)))
|
||||
io.ConfigFlags &= ~ImGuiConfigFlags_NoMouse;
|
||||
}
|
||||
ImGui::CheckboxFlags("io.ConfigFlags: NoMouseCursorChange", (unsigned int *)&io.ConfigFlags, ImGuiConfigFlags_NoMouseCursorChange);
|
||||
ImGui::CheckboxFlags("io.ConfigFlags: NoMouseCursorChange", (unsigned int*)&io.ConfigFlags, ImGuiConfigFlags_NoMouseCursorChange);
|
||||
ImGui::SameLine(); HelpMarker("Instruct back-end to not alter mouse cursor shape and visibility.");
|
||||
|
||||
ImGui::CheckboxFlags("io.ConfigFlags: DockingEnable", (unsigned int *)&io.ConfigFlags, ImGuiConfigFlags_DockingEnable);
|
||||
@ -467,13 +467,13 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
"Here we expose then as read-only fields to avoid breaking interactions with your back-end.");
|
||||
// Make a local copy to avoid modifying actual back-end flags.
|
||||
ImGuiBackendFlags backend_flags = io.BackendFlags;
|
||||
ImGui::CheckboxFlags("io.BackendFlags: HasGamepad", (unsigned int *)&backend_flags, ImGuiBackendFlags_HasGamepad);
|
||||
ImGui::CheckboxFlags("io.BackendFlags: HasMouseCursors", (unsigned int *)&backend_flags, ImGuiBackendFlags_HasMouseCursors);
|
||||
ImGui::CheckboxFlags("io.BackendFlags: HasSetMousePos", (unsigned int *)&backend_flags, ImGuiBackendFlags_HasSetMousePos);
|
||||
ImGui::CheckboxFlags("io.BackendFlags: PlatformHasViewports", (unsigned int *)&backend_flags, ImGuiBackendFlags_PlatformHasViewports);
|
||||
ImGui::CheckboxFlags("io.BackendFlags: HasMouseHoveredViewport", (unsigned int *)&backend_flags, ImGuiBackendFlags_HasMouseHoveredViewport);
|
||||
ImGui::CheckboxFlags("io.BackendFlags: RendererHasVtxOffset", (unsigned int *)&backend_flags, ImGuiBackendFlags_RendererHasVtxOffset);
|
||||
ImGui::CheckboxFlags("io.BackendFlags: RendererHasViewports", (unsigned int *)&backend_flags, ImGuiBackendFlags_RendererHasViewports);
|
||||
ImGui::CheckboxFlags("io.BackendFlags: HasGamepad", (unsigned int*)&backend_flags, ImGuiBackendFlags_HasGamepad);
|
||||
ImGui::CheckboxFlags("io.BackendFlags: HasMouseCursors", (unsigned int*)&backend_flags, ImGuiBackendFlags_HasMouseCursors);
|
||||
ImGui::CheckboxFlags("io.BackendFlags: HasSetMousePos", (unsigned int*)&backend_flags, ImGuiBackendFlags_HasSetMousePos);
|
||||
ImGui::CheckboxFlags("io.BackendFlags: PlatformHasViewports", (unsigned int*)&backend_flags, ImGuiBackendFlags_PlatformHasViewports);
|
||||
ImGui::CheckboxFlags("io.BackendFlags: HasMouseHoveredViewport",(unsigned int*)&backend_flags, ImGuiBackendFlags_HasMouseHoveredViewport);
|
||||
ImGui::CheckboxFlags("io.BackendFlags: RendererHasVtxOffset", (unsigned int*)&backend_flags, ImGuiBackendFlags_RendererHasVtxOffset);
|
||||
ImGui::CheckboxFlags("io.BackendFlags: RendererHasViewports", (unsigned int*)&backend_flags, ImGuiBackendFlags_RendererHasViewports);
|
||||
ImGui::TreePop();
|
||||
ImGui::Separator();
|
||||
}
|
||||
@ -561,9 +561,9 @@ static void ShowDemoWindowWidgets()
|
||||
if (i > 0)
|
||||
ImGui::SameLine();
|
||||
ImGui::PushID(i);
|
||||
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_ButtonActive, (ImVec4)ImColor::HSV(i/7.0f, 0.8f, 0.8f));
|
||||
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_ButtonActive, (ImVec4)ImColor::HSV(i / 7.0f, 0.8f, 0.8f));
|
||||
ImGui::Button("Click");
|
||||
ImGui::PopStyleColor(3);
|
||||
ImGui::PopID();
|
||||
@ -669,17 +669,17 @@ static void ShowDemoWindowWidgets()
|
||||
|
||||
ImGui::DragInt("drag int 0..100", &i2, 1, 0, 100, "%d%%");
|
||||
|
||||
static float f1=1.00f, f2=0.0067f;
|
||||
static float f1 = 1.00f, f2 = 0.0067f;
|
||||
ImGui::DragFloat("drag float", &f1, 0.005f);
|
||||
ImGui::DragFloat("drag small float", &f2, 0.0001f, 0.0f, 0.0f, "%.06f ns");
|
||||
}
|
||||
|
||||
{
|
||||
static int i1=0;
|
||||
static int i1 = 0;
|
||||
ImGui::SliderInt("slider int", &i1, -1, 3);
|
||||
ImGui::SameLine(); HelpMarker("CTRL+click to input value.");
|
||||
|
||||
static float f1=0.123f, f2=0.0f;
|
||||
static float f1 = 0.123f, f2 = 0.0f;
|
||||
ImGui::SliderFloat("slider float", &f1, 0.0f, 1.0f, "ratio = %.3f");
|
||||
ImGui::SliderFloat("slider float (curve)", &f2, -10.0f, 10.0f, "%.4f", 2.0f);
|
||||
|
||||
@ -698,8 +698,8 @@ static void ShowDemoWindowWidgets()
|
||||
}
|
||||
|
||||
{
|
||||
static float col1[3] = { 1.0f,0.0f,0.2f };
|
||||
static float col2[4] = { 0.4f,0.7f,0.0f,0.5f };
|
||||
static float col1[3] = { 1.0f, 0.0f, 0.2f };
|
||||
static float col2[4] = { 0.4f, 0.7f, 0.0f, 0.5f };
|
||||
ImGui::ColorEdit3("color 1", col1);
|
||||
ImGui::SameLine(); HelpMarker(
|
||||
"Click on the colored square to open a color picker.\n"
|
||||
@ -876,8 +876,8 @@ static void ShowDemoWindowWidgets()
|
||||
if (ImGui::TreeNode("Colored Text"))
|
||||
{
|
||||
// Using shortcut. You can use PushStyleColor()/PopStyleColor() for more flexibility.
|
||||
ImGui::TextColored(ImVec4(1.0f,0.0f,1.0f,1.0f), "Pink");
|
||||
ImGui::TextColored(ImVec4(1.0f,1.0f,0.0f,1.0f), "Yellow");
|
||||
ImGui::TextColored(ImVec4(1.0f, 0.0f, 1.0f, 1.0f), "Pink");
|
||||
ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f), "Yellow");
|
||||
ImGui::TextDisabled("Disabled");
|
||||
ImGui::SameLine(); HelpMarker("The TextDisabled color is stored in ImGuiStyle.");
|
||||
ImGui::TreePop();
|
||||
@ -1133,11 +1133,11 @@ static void ShowDemoWindowWidgets()
|
||||
}
|
||||
if (ImGui::TreeNode("Grid"))
|
||||
{
|
||||
static int selected[4*4] = { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 };
|
||||
for (int i = 0; i < 4*4; i++)
|
||||
static int selected[4 * 4] = { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 };
|
||||
for (int i = 0; i < 4 * 4; i++)
|
||||
{
|
||||
ImGui::PushID(i);
|
||||
if (ImGui::Selectable("Sailor", selected[i] != 0, 0, ImVec2(50,50)))
|
||||
if (ImGui::Selectable("Sailor", selected[i] != 0, 0, ImVec2(50, 50)))
|
||||
{
|
||||
// Toggle
|
||||
selected[i] = !selected[i];
|
||||
@ -1172,7 +1172,7 @@ static void ShowDemoWindowWidgets()
|
||||
sprintf(name, "(%.1f,%.1f)", alignment.x, alignment.y);
|
||||
if (x > 0) ImGui::SameLine();
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_SelectableTextAlign, alignment);
|
||||
ImGui::Selectable(name, &selected[3*y+x], ImGuiSelectableFlags_None, ImVec2(80,80));
|
||||
ImGui::Selectable(name, &selected[3 * y + x], ImGuiSelectableFlags_None, ImVec2(80, 80));
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
}
|
||||
@ -1307,9 +1307,9 @@ static void ShowDemoWindowWidgets()
|
||||
{
|
||||
static float phase = 0.0f;
|
||||
values[values_offset] = cosf(phase);
|
||||
values_offset = (values_offset+1) % IM_ARRAYSIZE(values);
|
||||
phase += 0.10f*values_offset;
|
||||
refresh_time += 1.0f/60.0f;
|
||||
values_offset = (values_offset + 1) % IM_ARRAYSIZE(values);
|
||||
phase += 0.10f * values_offset;
|
||||
refresh_time += 1.0f / 60.0f;
|
||||
}
|
||||
|
||||
// Plots can display overlay texts
|
||||
@ -1340,8 +1340,8 @@ static void ShowDemoWindowWidgets()
|
||||
ImGui::SameLine();
|
||||
ImGui::SliderInt("Sample count", &display_count, 1, 400);
|
||||
float (*func)(void*, int) = (func_type == 0) ? Funcs::Sin : Funcs::Saw;
|
||||
ImGui::PlotLines("Lines", func, NULL, display_count, 0, NULL, -1.0f, 1.0f, ImVec2(0,80));
|
||||
ImGui::PlotHistogram("Histogram", func, NULL, display_count, 0, NULL, -1.0f, 1.0f, ImVec2(0,80));
|
||||
ImGui::PlotLines("Lines", func, NULL, display_count, 0, NULL, -1.0f, 1.0f, ImVec2(0, 80));
|
||||
ImGui::PlotHistogram("Histogram", func, NULL, display_count, 0, NULL, -1.0f, 1.0f, ImVec2(0, 80));
|
||||
ImGui::Separator();
|
||||
|
||||
// Animate a simple progress bar
|
||||
@ -1355,20 +1355,20 @@ static void ShowDemoWindowWidgets()
|
||||
|
||||
// Typically we would use ImVec2(-1.0f,0.0f) or ImVec2(-FLT_MIN,0.0f) to use all available width,
|
||||
// or ImVec2(width,0.0f) for a specified width. ImVec2(0.0f,0.0f) uses ItemWidth.
|
||||
ImGui::ProgressBar(progress, ImVec2(0.0f,0.0f));
|
||||
ImGui::ProgressBar(progress, ImVec2(0.0f, 0.0f));
|
||||
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
|
||||
ImGui::Text("Progress Bar");
|
||||
|
||||
float progress_saturated = IM_CLAMP(progress, 0.0f, 1.0f);
|
||||
char buf[32];
|
||||
sprintf(buf, "%d/%d", (int)(progress_saturated*1753), 1753);
|
||||
ImGui::ProgressBar(progress, ImVec2(0.f,0.f), buf);
|
||||
sprintf(buf, "%d/%d", (int)(progress_saturated * 1753), 1753);
|
||||
ImGui::ProgressBar(progress, ImVec2(0.f, 0.f), buf);
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
if (ImGui::TreeNode("Color/Picker Widgets"))
|
||||
{
|
||||
static ImVec4 color = ImVec4(114.0f/255.0f, 144.0f/255.0f, 154.0f/255.0f, 200.0f/255.0f);
|
||||
static ImVec4 color = ImVec4(114.0f / 255.0f, 144.0f / 255.0f, 154.0f / 255.0f, 200.0f / 255.0f);
|
||||
|
||||
static bool alpha_preview = true;
|
||||
static bool alpha_half_preview = false;
|
||||
@ -1435,9 +1435,9 @@ static void ShowDemoWindowWidgets()
|
||||
|
||||
ImGui::BeginGroup(); // Lock X position
|
||||
ImGui::Text("Current");
|
||||
ImGui::ColorButton("##current", color, ImGuiColorEditFlags_NoPicker | ImGuiColorEditFlags_AlphaPreviewHalf, ImVec2(60,40));
|
||||
ImGui::ColorButton("##current", color, ImGuiColorEditFlags_NoPicker | ImGuiColorEditFlags_AlphaPreviewHalf, ImVec2(60, 40));
|
||||
ImGui::Text("Previous");
|
||||
if (ImGui::ColorButton("##previous", backup_color, ImGuiColorEditFlags_NoPicker | ImGuiColorEditFlags_AlphaPreviewHalf, ImVec2(60,40)))
|
||||
if (ImGui::ColorButton("##previous", backup_color, ImGuiColorEditFlags_NoPicker | ImGuiColorEditFlags_AlphaPreviewHalf, ImVec2(60, 40)))
|
||||
color = backup_color;
|
||||
ImGui::Separator();
|
||||
ImGui::Text("Palette");
|
||||
@ -1448,7 +1448,7 @@ static void ShowDemoWindowWidgets()
|
||||
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemSpacing.y);
|
||||
|
||||
ImGuiColorEditFlags palette_button_flags = ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_NoPicker | ImGuiColorEditFlags_NoTooltip;
|
||||
if (ImGui::ColorButton("##palette", saved_palette[n], palette_button_flags, ImVec2(20,20)))
|
||||
if (ImGui::ColorButton("##palette", saved_palette[n], palette_button_flags, ImVec2(20, 20)))
|
||||
color = ImVec4(saved_palette[n].x, saved_palette[n].y, saved_palette[n].z, color.w); // Preserve alpha!
|
||||
|
||||
// Allow user to drop colors into each palette entry. Note that ColorButton() is already a
|
||||
@ -1471,14 +1471,14 @@ static void ShowDemoWindowWidgets()
|
||||
ImGui::Text("Color button only:");
|
||||
static bool no_border = false;
|
||||
ImGui::Checkbox("ImGuiColorEditFlags_NoBorder", &no_border);
|
||||
ImGui::ColorButton("MyColor##3c", *(ImVec4*)&color, misc_flags | (no_border ? ImGuiColorEditFlags_NoBorder : 0), ImVec2(80,80));
|
||||
ImGui::ColorButton("MyColor##3c", *(ImVec4*)&color, misc_flags | (no_border ? ImGuiColorEditFlags_NoBorder : 0), ImVec2(80, 80));
|
||||
|
||||
ImGui::Text("Color picker:");
|
||||
static bool alpha = true;
|
||||
static bool alpha_bar = true;
|
||||
static bool side_preview = true;
|
||||
static bool ref_color = false;
|
||||
static ImVec4 ref_color_v(1.0f,0.0f,1.0f,0.5f);
|
||||
static ImVec4 ref_color_v(1.0f, 0.0f, 1.0f, 0.5f);
|
||||
static int display_mode = 0;
|
||||
static int picker_mode = 0;
|
||||
ImGui::Checkbox("With Alpha", &alpha);
|
||||
@ -1693,7 +1693,7 @@ static void ShowDemoWindowWidgets()
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(spacing, spacing));
|
||||
|
||||
static int int_value = 0;
|
||||
ImGui::VSliderInt("##int", ImVec2(18,160), &int_value, 0, 5);
|
||||
ImGui::VSliderInt("##int", ImVec2(18, 160), &int_value, 0, 5);
|
||||
ImGui::SameLine();
|
||||
|
||||
static float values[7] = { 0.0f, 0.60f, 0.35f, 0.9f, 0.70f, 0.20f, 0.0f };
|
||||
@ -1702,11 +1702,11 @@ static void ShowDemoWindowWidgets()
|
||||
{
|
||||
if (i > 0) ImGui::SameLine();
|
||||
ImGui::PushID(i);
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBg, (ImVec4)ImColor::HSV(i/7.0f, 0.5f, 0.5f));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, (ImVec4)ImColor::HSV(i/7.0f, 0.6f, 0.5f));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgActive, (ImVec4)ImColor::HSV(i/7.0f, 0.7f, 0.5f));
|
||||
ImGui::PushStyleColor(ImGuiCol_SliderGrab, (ImVec4)ImColor::HSV(i/7.0f, 0.9f, 0.9f));
|
||||
ImGui::VSliderFloat("##v", ImVec2(18,160), &values[i], 0.0f, 1.0f, "");
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBg, (ImVec4)ImColor::HSV(i / 7.0f, 0.5f, 0.5f));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, (ImVec4)ImColor::HSV(i / 7.0f, 0.6f, 0.5f));
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBgActive, (ImVec4)ImColor::HSV(i / 7.0f, 0.7f, 0.5f));
|
||||
ImGui::PushStyleColor(ImGuiCol_SliderGrab, (ImVec4)ImColor::HSV(i / 7.0f, 0.9f, 0.9f));
|
||||
ImGui::VSliderFloat("##v", ImVec2(18, 160), &values[i], 0.0f, 1.0f, "");
|
||||
if (ImGui::IsItemActive() || ImGui::IsItemHovered())
|
||||
ImGui::SetTooltip("%.3f", values[i]);
|
||||
ImGui::PopStyleColor(4);
|
||||
@ -1725,7 +1725,7 @@ static void ShowDemoWindowWidgets()
|
||||
ImGui::BeginGroup();
|
||||
for (int ny = 0; ny < rows; ny++)
|
||||
{
|
||||
ImGui::PushID(nx*rows+ny);
|
||||
ImGui::PushID(nx * rows + ny);
|
||||
ImGui::VSliderFloat("##v", small_slider_size, &values2[nx], 0.0f, 1.0f, "");
|
||||
if (ImGui::IsItemActive() || ImGui::IsItemHovered())
|
||||
ImGui::SetTooltip("%.3f", values2[nx]);
|
||||
@ -1742,7 +1742,7 @@ static void ShowDemoWindowWidgets()
|
||||
if (i > 0) ImGui::SameLine();
|
||||
ImGui::PushID(i);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_GrabMinSize, 40);
|
||||
ImGui::VSliderFloat("##v", ImVec2(40,160), &values[i], 0.0f, 1.0f, "%.2f\nsec");
|
||||
ImGui::VSliderFloat("##v", ImVec2(40, 160), &values[i], 0.0f, 1.0f, "%.2f\nsec");
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::PopID();
|
||||
}
|
||||
@ -1790,7 +1790,7 @@ static void ShowDemoWindowWidgets()
|
||||
ImGui::PushID(n);
|
||||
if ((n % 3) != 0)
|
||||
ImGui::SameLine();
|
||||
ImGui::Button(names[n], ImVec2(60,60));
|
||||
ImGui::Button(names[n], ImVec2(60, 60));
|
||||
|
||||
// Our buttons are both drag sources and drag targets here!
|
||||
if (ImGui::BeginDragDropSource(ImGuiDragDropFlags_None))
|
||||
@ -2617,8 +2617,8 @@ static void ShowDemoWindowLayout()
|
||||
ImGui::PushID(n + line * 1000);
|
||||
char num_buf[16];
|
||||
sprintf(num_buf, "%d", n);
|
||||
const char* label = (!(n%15)) ? "FizzBuzz" : (!(n%3)) ? "Fizz" : (!(n%5)) ? "Buzz" : num_buf;
|
||||
float hue = n*0.05f;
|
||||
const char* label = (!(n % 15)) ? "FizzBuzz" : (!(n % 3)) ? "Fizz" : (!(n % 5)) ? "Buzz" : num_buf;
|
||||
float hue = n * 0.05f;
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, (ImVec4)ImColor::HSV(hue, 0.6f, 0.6f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, (ImVec4)ImColor::HSV(hue, 0.7f, 0.7f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, (ImVec4)ImColor::HSV(hue, 0.8f, 0.8f));
|
||||
@ -2966,7 +2966,7 @@ static void ShowDemoWindowPopups()
|
||||
|
||||
// Testing behavior of widgets stacking their own regular popups over the modal.
|
||||
static int item = 1;
|
||||
static float color[4] = { 0.4f,0.7f,0.0f,0.5f };
|
||||
static float color[4] = { 0.4f, 0.7f, 0.0f, 0.5f };
|
||||
ImGui::Combo("Combo", &item, "aaaa\0bbbb\0cccc\0dddd\0eeee\0\0");
|
||||
ImGui::ColorEdit4("color", color);
|
||||
|
||||
@ -4014,7 +4014,7 @@ static void ShowExampleMenuFile()
|
||||
{
|
||||
const char* name = ImGui::GetStyleColorName((ImGuiCol)i);
|
||||
ImVec2 p = ImGui::GetCursorScreenPos();
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(p, ImVec2(p.x+sz, p.y+sz), ImGui::GetColorU32((ImGuiCol)i));
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(p, ImVec2(p.x + sz, p.y + sz), ImGui::GetColorU32((ImGuiCol)i));
|
||||
ImGui::Dummy(ImVec2(sz, sz));
|
||||
ImGui::SameLine();
|
||||
ImGui::MenuItem(name);
|
||||
@ -4106,7 +4106,7 @@ struct ExampleAppConsole
|
||||
|
||||
void Draw(const char* title, bool* p_open)
|
||||
{
|
||||
ImGui::SetNextWindowSize(ImVec2(520,600), ImGuiCond_FirstUseEver);
|
||||
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
|
||||
if (!ImGui::Begin(title, p_open))
|
||||
{
|
||||
ImGui::End();
|
||||
@ -4184,7 +4184,7 @@ struct ExampleAppConsole
|
||||
// If your items are of variable height:
|
||||
// - Split them into same height items would be simpler and facilitate random-seeking into your list.
|
||||
// - Consider using manual call to IsRectVisible() and skipping extraneous decoration from your items.
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(4,1)); // Tighten spacing
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(4, 1)); // Tighten spacing
|
||||
if (copy_to_clipboard)
|
||||
ImGui::LogToClipboard();
|
||||
for (int i = 0; i < Items.Size; i++)
|
||||
@ -4244,7 +4244,7 @@ struct ExampleAppConsole
|
||||
// Insert into history. First find match and delete it so it can be pushed to the back.
|
||||
// This isn't trying to be smart or optimal.
|
||||
HistoryPos = -1;
|
||||
for (int i = History.Size-1; i >= 0; i--)
|
||||
for (int i = History.Size - 1; i >= 0; i--)
|
||||
if (Stricmp(History[i], command_line) == 0)
|
||||
{
|
||||
free(History[i]);
|
||||
@ -4309,18 +4309,18 @@ struct ExampleAppConsole
|
||||
// Build a list of candidates
|
||||
ImVector<const char*> candidates;
|
||||
for (int i = 0; i < Commands.Size; i++)
|
||||
if (Strnicmp(Commands[i], word_start, (int)(word_end-word_start)) == 0)
|
||||
if (Strnicmp(Commands[i], word_start, (int)(word_end - word_start)) == 0)
|
||||
candidates.push_back(Commands[i]);
|
||||
|
||||
if (candidates.Size == 0)
|
||||
{
|
||||
// No match
|
||||
AddLog("No match for \"%.*s\"!\n", (int)(word_end-word_start), word_start);
|
||||
AddLog("No match for \"%.*s\"!\n", (int)(word_end - word_start), word_start);
|
||||
}
|
||||
else if (candidates.Size == 1)
|
||||
{
|
||||
// Single match. Delete the beginning of the word and replace it entirely so we've got nice casing.
|
||||
data->DeleteChars((int)(word_start-data->Buf), (int)(word_end-word_start));
|
||||
data->DeleteChars((int)(word_start - data->Buf), (int)(word_end - word_start));
|
||||
data->InsertChars(data->CursorPos, candidates[0]);
|
||||
data->InsertChars(data->CursorPos, " ");
|
||||
}
|
||||
@ -4345,7 +4345,7 @@ struct ExampleAppConsole
|
||||
|
||||
if (match_len > 0)
|
||||
{
|
||||
data->DeleteChars((int)(word_start - data->Buf), (int)(word_end-word_start));
|
||||
data->DeleteChars((int)(word_start - data->Buf), (int)(word_end - word_start));
|
||||
data->InsertChars(data->CursorPos, candidates[0], candidates[0] + match_len);
|
||||
}
|
||||
|
||||
@ -4633,7 +4633,7 @@ static void ShowDummyObject(const char* prefix, int uid)
|
||||
ImGui::NextColumn();
|
||||
if (node_open)
|
||||
{
|
||||
static float dummy_members[8] = { 0.0f,0.0f,1.0f,3.1416f,100.0f,999.0f };
|
||||
static float dummy_members[8] = { 0.0f, 0.0f, 1.0f, 3.1416f, 100.0f, 999.0f };
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
ImGui::PushID(i); // Use field index as identifier.
|
||||
@ -4665,7 +4665,7 @@ static void ShowDummyObject(const char* prefix, int uid)
|
||||
// Demonstrate create a simple property editor.
|
||||
static void ShowExampleAppPropertyEditor(bool* p_open)
|
||||
{
|
||||
ImGui::SetNextWindowSize(ImVec2(430,450), ImGuiCond_FirstUseEver);
|
||||
ImGui::SetNextWindowSize(ImVec2(430, 450), ImGuiCond_FirstUseEver);
|
||||
if (!ImGui::Begin("Example: Property editor", p_open))
|
||||
{
|
||||
ImGui::End();
|
||||
@ -4678,7 +4678,7 @@ static void ShowExampleAppPropertyEditor(bool* p_open)
|
||||
"Remember that in many simple cases, you can use ImGui::SameLine(xxx) to position\n"
|
||||
"your cursor horizontally instead of using the Columns() API.");
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(2,2));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(2, 2));
|
||||
ImGui::Columns(2);
|
||||
ImGui::Separator();
|
||||
|
||||
@ -4699,7 +4699,7 @@ static void ShowExampleAppPropertyEditor(bool* p_open)
|
||||
// Demonstrate/test rendering huge amount of text, and the incidence of clipping.
|
||||
static void ShowExampleAppLongText(bool* p_open)
|
||||
{
|
||||
ImGui::SetNextWindowSize(ImVec2(520,600), ImGuiCond_FirstUseEver);
|
||||
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
|
||||
if (!ImGui::Begin("Example: Long text display", p_open))
|
||||
{
|
||||
ImGui::End();
|
||||
@ -4720,7 +4720,7 @@ static void ShowExampleAppLongText(bool* p_open)
|
||||
if (ImGui::Button("Add 1000 lines"))
|
||||
{
|
||||
for (int i = 0; i < 1000; i++)
|
||||
log.appendf("%i The quick brown fox jumps over the lazy dog\n", lines+i);
|
||||
log.appendf("%i The quick brown fox jumps over the lazy dog\n", lines + i);
|
||||
lines += 1000;
|
||||
}
|
||||
ImGui::BeginChild("Log");
|
||||
@ -5084,7 +5084,7 @@ static void ShowExampleAppCustomRendering(bool* p_open)
|
||||
ImVec2 window_size = ImGui::GetWindowSize();
|
||||
ImVec2 window_center = ImVec2(window_pos.x + window_size.x * 0.5f, window_pos.y + window_size.y * 0.5f);
|
||||
if (draw_bg)
|
||||
ImGui::GetBackgroundDrawList()->AddCircle(window_center, window_size.x * 0.6f, IM_COL32(255, 0, 0, 200), 0, 10+4);
|
||||
ImGui::GetBackgroundDrawList()->AddCircle(window_center, window_size.x * 0.6f, IM_COL32(255, 0, 0, 200), 0, 10 + 4);
|
||||
if (draw_fg)
|
||||
ImGui::GetForegroundDrawList()->AddCircle(window_center, window_size.y * 0.6f, IM_COL32(0, 255, 0, 200), 0, 10);
|
||||
ImGui::EndTabItem();
|
||||
@ -5204,7 +5204,7 @@ struct MyDocument
|
||||
bool WantClose; // Set when the document
|
||||
ImVec4 Color; // An arbitrary variable associated to the document
|
||||
|
||||
MyDocument(const char* name, bool open = true, const ImVec4& color = ImVec4(1.0f,1.0f,1.0f,1.0f))
|
||||
MyDocument(const char* name, bool open = true, const ImVec4& color = ImVec4(1.0f, 1.0f, 1.0f, 1.0f))
|
||||
{
|
||||
Name = name;
|
||||
Open = OpenPrev = open;
|
||||
|
Reference in New Issue
Block a user