From d5709c237fad82792da764d34e1ffe427a765c1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Till=20W=C3=BCbbers?= Date: Sun, 26 Mar 2023 17:18:13 +0200 Subject: [PATCH] fake drop shadow --- AsuroTool/AsuroTool.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/AsuroTool/AsuroTool.cpp b/AsuroTool/AsuroTool.cpp index d38ae91..fb1817a 100644 --- a/AsuroTool/AsuroTool.cpp +++ b/AsuroTool/AsuroTool.cpp @@ -66,6 +66,26 @@ time_t getDayStartOf(time_t time) return mktime(&localTime); } +void dropShadow(float size, ImColor color) +{ + ImDrawList* windowDrawList = ImGui::GetWindowDrawList(); + ImVec2 lastMin = ImGui::GetItemRectMin(); + ImVec2 lastMax = ImGui::GetItemRectMax(); + + windowDrawList->AddQuadFilled( + { lastMin.x, lastMax.y }, + { lastMax.x, lastMax.y }, + { lastMax.x + size, lastMax.y + size }, + { lastMin.x + size, lastMax.y + size }, + color); + windowDrawList->AddQuadFilled( + { lastMax.x, lastMin.y }, + { lastMax.x + size, lastMin.y + size }, + { lastMax.x + size, lastMax.y + size }, + { lastMax.x, lastMax.y }, + color); +} + void init(DrawData& drawData, ApplicationData& appData) { std::wstring appPath; @@ -429,6 +449,7 @@ ImVec2 timerWindow(DrawData& drawData, ApplicationData& appData) appData.settings.timerDuration -= 60.f; if (appData.settings.timerDuration < 0.) appData.settings.timerDuration = 0.f; } + dropShadow(3.f, { 1.f, 1.f, 1.f, .3f }); ImGui::SameLine(); ImGui::PushItemWidth(45.f);