|
@@ -4454,16 +4454,37 @@ static void ShowExampleAppCustomRendering(bool* p_open)
|
|
|
|
|
|
if (ImGui::BeginTabBar("##TabBar"))
|
|
|
{
|
|
|
- // Primitives
|
|
|
if (ImGui::BeginTabItem("Primitives"))
|
|
|
{
|
|
|
+ ImGui::PushItemWidth(-ImGui::GetFontSize() * 10);
|
|
|
+
|
|
|
+ // Draw gradients
|
|
|
+ // (note that those are currently exacerbating our sRGB/Linear issues)
|
|
|
+ ImGui::Text("Gradients");
|
|
|
+ ImVec2 gradient_size = ImVec2(ImGui::CalcItemWidth(), ImGui::GetFrameHeight());
|
|
|
+ {
|
|
|
+ ImVec2 p = ImGui::GetCursorScreenPos();
|
|
|
+ ImU32 col_a = ImGui::GetColorU32(ImVec4(0.0f, 0.0f, 0.0f, 1.0f));
|
|
|
+ ImU32 col_b = ImGui::GetColorU32(ImVec4(1.0f, 1.0f, 1.0f, 1.0f));
|
|
|
+ draw_list->AddRectFilledMultiColor(p, ImVec2(p.x + gradient_size.x, p.y + gradient_size.y), col_a, col_b, col_b, col_a);
|
|
|
+ ImGui::InvisibleButton("##gradient1", gradient_size);
|
|
|
+ }
|
|
|
+ {
|
|
|
+ ImVec2 p = ImGui::GetCursorScreenPos();
|
|
|
+ ImU32 col_a = ImGui::GetColorU32(ImVec4(0.0f, 1.0f, 0.0f, 1.0f));
|
|
|
+ ImU32 col_b = ImGui::GetColorU32(ImVec4(1.0f, 0.0f, 0.0f, 1.0f));
|
|
|
+ draw_list->AddRectFilledMultiColor(p, ImVec2(p.x + gradient_size.x, p.y + gradient_size.y), col_a, col_b, col_b, col_a);
|
|
|
+ ImGui::InvisibleButton("##gradient2", gradient_size);
|
|
|
+ }
|
|
|
+
|
|
|
+ // Draw a bunch of primitives
|
|
|
+ ImGui::Text("All primitives");
|
|
|
static float sz = 36.0f;
|
|
|
static float thickness = 3.0f;
|
|
|
static int ngon_sides = 6;
|
|
|
static bool circle_segments_override = false;
|
|
|
static int circle_segments_override_v = 12;
|
|
|
static ImVec4 colf = ImVec4(1.0f, 1.0f, 0.4f, 1.0f);
|
|
|
- ImGui::PushItemWidth(-ImGui::GetFontSize() * 10);
|
|
|
ImGui::DragFloat("Size", &sz, 0.2f, 2.0f, 72.0f, "%.0f");
|
|
|
ImGui::DragFloat("Thickness", &thickness, 0.05f, 1.0f, 8.0f, "%.02f");
|
|
|
ImGui::SliderInt("N-gon sides", &ngon_sides, 3, 12);
|
|
@@ -4511,26 +4532,6 @@ static void ShowExampleAppCustomRendering(bool* p_open)
|
|
|
draw_list->AddRectFilledMultiColor(ImVec2(x, y), ImVec2(x + sz, y + sz), IM_COL32(0, 0, 0, 255), IM_COL32(255, 0, 0, 255), IM_COL32(255, 255, 0, 255), IM_COL32(0, 255, 0, 255));
|
|
|
ImGui::Dummy(ImVec2((sz + spacing) * 9.8f, (sz + spacing) * 3));
|
|
|
|
|
|
- // Draw black and white gradients
|
|
|
- static int gradient_steps = 16;
|
|
|
- ImGui::Separator();
|
|
|
- ImGui::AlignTextToFramePadding();
|
|
|
- ImGui::Text("Gradient steps");
|
|
|
- ImGui::SameLine(); if (ImGui::RadioButton("16", gradient_steps == 16)) { gradient_steps = 16; }
|
|
|
- ImGui::SameLine(); if (ImGui::RadioButton("32", gradient_steps == 32)) { gradient_steps = 32; }
|
|
|
- ImGui::SameLine(); if (ImGui::RadioButton("256", gradient_steps == 256)) { gradient_steps = 256; }
|
|
|
- ImVec2 gradient_size = ImVec2(ImGui::CalcItemWidth(), 64.0f);
|
|
|
- x = ImGui::GetCursorScreenPos().x;
|
|
|
- y = ImGui::GetCursorScreenPos().y;
|
|
|
- for (int n = 0; n < gradient_steps; n++)
|
|
|
- {
|
|
|
- float f0 = n / (float)gradient_steps;
|
|
|
- float f1 = (n + 1) / (float)gradient_steps;
|
|
|
- ImU32 col32 = ImGui::GetColorU32(ImVec4(f0, f0, f0, 1.0f));
|
|
|
- draw_list->AddRectFilled(ImVec2(x + gradient_size.x * f0, y), ImVec2(x + gradient_size.x * f1, y + gradient_size.y), col32);
|
|
|
- }
|
|
|
- ImGui::InvisibleButton("##gradient", gradient_size);
|
|
|
-
|
|
|
ImGui::PopItemWidth();
|
|
|
ImGui::EndTabItem();
|
|
|
}
|
|
@@ -4598,9 +4599,9 @@ 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), 48, 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), 48, 10);
|
|
|
+ ImGui::GetForegroundDrawList()->AddCircle(window_center, window_size.y * 0.6f, IM_COL32(0, 255, 0, 200), 0, 10);
|
|
|
ImGui::EndTabItem();
|
|
|
}
|
|
|
|