|
@@ -6917,7 +6917,7 @@ static void ShowExampleAppCustomRendering(bool* p_open)
|
|
|
|
|
|
// Draw a bunch of primitives
|
|
|
ImGui::Text("All primitives");
|
|
|
- static float sz = 33.0f;
|
|
|
+ static float sz = 36.0f;
|
|
|
static float thickness = 3.0f;
|
|
|
static int ngon_sides = 6;
|
|
|
static bool circle_segments_override = false;
|
|
@@ -6930,12 +6930,10 @@ static void ShowExampleAppCustomRendering(bool* p_open)
|
|
|
ImGui::SliderInt("N-gon sides", &ngon_sides, 3, 12);
|
|
|
ImGui::Checkbox("##circlesegmentoverride", &circle_segments_override);
|
|
|
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
|
|
|
- if (ImGui::SliderInt("Circle segments", &circle_segments_override_v, 3, 40))
|
|
|
- circle_segments_override = true;
|
|
|
+ circle_segments_override |= ImGui::SliderInt("Circle segments override", &circle_segments_override_v, 3, 40);
|
|
|
ImGui::Checkbox("##curvessegmentoverride", &curve_segments_override);
|
|
|
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
|
|
|
- if (ImGui::SliderInt("Curves segments", &curve_segments_override_v, 3, 40))
|
|
|
- curve_segments_override = true;
|
|
|
+ curve_segments_override |= ImGui::SliderInt("Curves segments override", &curve_segments_override_v, 3, 40);
|
|
|
ImGui::ColorEdit4("Color", &colf.x);
|
|
|
|
|
|
const ImVec2 p = ImGui::GetCursorScreenPos();
|
|
@@ -6962,8 +6960,15 @@ static void ShowExampleAppCustomRendering(bool* p_open)
|
|
|
draw_list->AddLine(ImVec2(x, y), ImVec2(x + sz, y), col, th); x += sz + spacing; // Horizontal line (note: drawing a filled rectangle will be faster!)
|
|
|
draw_list->AddLine(ImVec2(x, y), ImVec2(x, y + sz), col, th); x += spacing; // Vertical line (note: drawing a filled rectangle will be faster!)
|
|
|
draw_list->AddLine(ImVec2(x, y), ImVec2(x + sz, y + sz), col, th); x += sz + spacing; // Diagonal line
|
|
|
- draw_list->AddQuadBezierCurve(ImVec2(x, y + sz * 0.6), ImVec2(x + sz * 0.5, y - sz * 0.4), ImVec2(x + sz, y + sz), col, th, curve_segments); x += sz + spacing; // Quad Bezier (3 control points)
|
|
|
- draw_list->AddBezierCurve(ImVec2(x, y), ImVec2(x + sz * 1.3f, y + sz * 0.3f), ImVec2(x + sz - sz * 1.3f, y + sz - sz * 0.3f), ImVec2(x + sz, y + sz), col, th, curve_segments);
|
|
|
+
|
|
|
+ // Quadratic Bezier Curve (3 control points)
|
|
|
+ ImVec2 cp3[3] = { ImVec2(x, y + sz * 0.6f), ImVec2(x + sz * 0.5f, y - sz * 0.4f), ImVec2(x + sz, y + sz) };
|
|
|
+ draw_list->AddQuadBezierCurve(cp3[0], cp3[1], cp3[2], col, th, curve_segments); x += sz + spacing;
|
|
|
+
|
|
|
+ // Cubic Bezier Curve (4 control points)
|
|
|
+ ImVec2 cp4[4] = { ImVec2(x, y), ImVec2(x + sz * 1.3f, y + sz * 0.3f), ImVec2(x + sz - sz * 1.3f, y + sz - sz * 0.3f), ImVec2(x + sz, y + sz) };
|
|
|
+ draw_list->AddBezierCurve(cp4[0], cp4[1], cp4[2], cp4[3], col, th, curve_segments);
|
|
|
+
|
|
|
x = p.x + 4;
|
|
|
y += sz + spacing;
|
|
|
}
|