From aa705434110f8ef41784cd641002825f9bc5c6ff Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Tue, 30 Dec 2025 15:20:00 -0600 Subject: [PATCH 1/2] Tiny adjustment to make the play bar highlight on mouse hover --- src/window/play.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/window/play.cpp b/src/window/play.cpp index 9109833..a4604a7 100644 --- a/src/window/play.cpp +++ b/src/window/play.cpp @@ -85,6 +85,14 @@ namespace game::window auto barMin = ImVec2(position.x + (size.x * 0.5f) - (spacing * 0.5f), position.y + (spacing * 2.0f)); auto barMax = ImVec2(barMin.x + (spacing * 2.0f), barMin.y + size.y - (spacing * 4.0f)); + bool mouseHovering = ImGui::IsMouseHoveringRect(barMin, barMax); + + if (mouseHovering) + { + drawList->AddRect(ImVec2(barMin.x - 1, barMin.y - 1), ImVec2(barMax.x + 1, barMax.y + 1), + ImGui::GetColorU32(RECT_COLOR)); + } + drawList->AddRectFilled(barMin, barMax, ImGui::GetColorU32(BG_COLOR)); auto barWidth = barMax.x - barMin.x; @@ -171,8 +179,7 @@ namespace game::window } } - if (ImGui::IsKeyPressed(ImGuiKey_Space) || - (ImGui::IsMouseHoveringRect(barMin, barMax) && ImGui::IsMouseClicked(ImGuiMouseButton_Left))) + if (ImGui::IsKeyPressed(ImGuiKey_Space) || (mouseHovering && ImGui::IsMouseClicked(ImGuiMouseButton_Left))) { Grade grade{MISS}; auto subRanges = sub_ranges_get(challenge.range); From d028224fd0904d10dd2cc247d2ce63aa3266055d Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Tue, 30 Dec 2025 18:15:00 -0600 Subject: [PATCH 2/2] Ease the outline colour when clicked --- src/window/play.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/window/play.cpp b/src/window/play.cpp index a4604a7..feca73d 100644 --- a/src/window/play.cpp +++ b/src/window/play.cpp @@ -86,11 +86,15 @@ namespace game::window auto barMax = ImVec2(barMin.x + (spacing * 2.0f), barMin.y + size.y - (spacing * 4.0f)); bool mouseHovering = ImGui::IsMouseHoveringRect(barMin, barMax); + auto endTimerProgress = (float)endTimer / endTimerMax; if (mouseHovering) { + auto color = RECT_COLOR; + //Ease out and back in again + color.w = isActive ? 1.0f : (4 * pow(endTimerProgress, 2) - 4 * endTimerProgress + 1); drawList->AddRect(ImVec2(barMin.x - 1, barMin.y - 1), ImVec2(barMax.x + 1, barMax.y + 1), - ImGui::GetColorU32(RECT_COLOR)); + ImGui::GetColorU32(color)); } drawList->AddRectFilled(barMin, barMax, ImGui::GetColorU32(BG_COLOR)); @@ -140,8 +144,6 @@ namespace game::window } }; - auto endTimerProgress = (float)endTimer / endTimerMax; - range_draw(challenge.range, isActive ? 1.0f : 0.0f); auto lineMin = ImVec2(barMin.x - LINE_WIDTH_BONUS, barMin.y + (barHeight * tryValue));