From cdfc71d546ad871e3899bdcb8d560da657e8c658 Mon Sep 17 00:00:00 2001 From: SkrubbySkrubInAShrub Date: Thu, 19 Feb 2026 13:28:20 +0100 Subject: [PATCH 1/2] add filled star for favourites. --- src/WeatherEditor/EditorWindow.cpp | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/WeatherEditor/EditorWindow.cpp b/src/WeatherEditor/EditorWindow.cpp index 360f4a8234..d0f1115cc4 100644 --- a/src/WeatherEditor/EditorWindow.cpp +++ b/src/WeatherEditor/EditorWindow.cpp @@ -40,7 +40,7 @@ inline void HelpMarker(const char* a_desc) AddTooltip(a_desc, ImGuiHoveredFlags_DelayShort); } -void DrawIconStar(ImVec2 center, float radius, ImU32 color, bool /*filled*/) +void DrawIconStar(ImVec2 center, float radius, ImU32 color, bool filled) { auto* drawList = ImGui::GetWindowDrawList(); const int numPoints = 5; @@ -53,8 +53,28 @@ void DrawIconStar(ImVec2 center, float radius, ImU32 color, bool /*filled*/) points[i] = ImVec2(center.x + cosf(angle) * r, center.y + sinf(angle) * r); } - for (int i = 0; i < 10; i++) { - drawList->AddLine(points[i], points[(i + 1) % 10], color, 1.5f); + if (filled) { + // Fill without AA to prevent fringe seams between adjacent pieces + ImDrawListFlags oldFlags = drawList->Flags; + drawList->Flags &= ~ImDrawListFlags_AntiAliasedFill; + + ImVec2 innerPentagon[5]; + for (int i = 0; i < 5; i++) { + innerPentagon[i] = points[i * 2 + 1]; // inner points + } + drawList->AddConvexPolyFilled(innerPentagon, 5, color); + for (int i = 0; i < 5; i++) { + drawList->AddTriangleFilled(points[i * 2], points[i * 2 + 1], points[(i * 2 + 9) % 10], color); + } + + drawList->Flags = oldFlags; + + // Draw an AA outline over the outer perimeter to restore smooth edges + drawList->AddPolyline(points, 10, color, ImDrawFlags_Closed, 1.0f); + } else { + for (int i = 0; i < 10; i++) { + drawList->AddLine(points[i], points[(i + 1) % 10], color, 1.5f); + } } } From 39d5fafbc88f36f0e5f0ae0416734c2abcfc27a1 Mon Sep 17 00:00:00 2001 From: SkrubbySkrubInAShrub Date: Thu, 19 Feb 2026 13:31:43 +0100 Subject: [PATCH 2/2] cleanup --- src/WeatherEditor/EditorWindow.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/WeatherEditor/EditorWindow.cpp b/src/WeatherEditor/EditorWindow.cpp index d0f1115cc4..c9e2b912d9 100644 --- a/src/WeatherEditor/EditorWindow.cpp +++ b/src/WeatherEditor/EditorWindow.cpp @@ -43,18 +43,19 @@ inline void HelpMarker(const char* a_desc) void DrawIconStar(ImVec2 center, float radius, ImU32 color, bool filled) { auto* drawList = ImGui::GetWindowDrawList(); - const int numPoints = 5; - const float angleStep = 3.14159f / numPoints; + constexpr int numPoints = 5; + const float angleStep = IM_PI / numPoints; ImVec2 points[10]; for (int i = 0; i < numPoints * 2; i++) { - float angle = -1.57079f + i * angleStep; + float angle = -IM_PI * 0.5f + i * angleStep; float r = (i % 2 == 0) ? radius : radius * 0.38f; points[i] = ImVec2(center.x + cosf(angle) * r, center.y + sinf(angle) * r); } if (filled) { - // Fill without AA to prevent fringe seams between adjacent pieces + // Disable AA fill temporarily — ImGui adds a 1px fringe around each filled shape + // that creates visible seams at the pentagon/triangle boundaries. ImDrawListFlags oldFlags = drawList->Flags; drawList->Flags &= ~ImDrawListFlags_AntiAliasedFill; @@ -69,12 +70,10 @@ void DrawIconStar(ImVec2 center, float radius, ImU32 color, bool filled) drawList->Flags = oldFlags; - // Draw an AA outline over the outer perimeter to restore smooth edges - drawList->AddPolyline(points, 10, color, ImDrawFlags_Closed, 1.0f); + // Draw an AA polyline over the outer perimeter to restore smooth edges + drawList->AddPolyline(points, 10, color, ImDrawFlags_Closed, 1.5f); } else { - for (int i = 0; i < 10; i++) { - drawList->AddLine(points[i], points[(i + 1) % 10], color, 1.5f); - } + drawList->AddPolyline(points, 10, color, ImDrawFlags_Closed, 1.5f); } }