From 8173ff5416dfb86326548c5833b54a4ba994020b Mon Sep 17 00:00:00 2001 From: xorus Date: Fri, 5 Jul 2024 17:26:45 +0200 Subject: [PATCH] fix countdown being rounded instead of floored in floating window when disabling decimals --- Plugin/EngageTimer.csproj | 2 +- Plugin/EngageTimer.yaml | 2 +- Plugin/Ui/FloatingWindow.cs | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Plugin/EngageTimer.csproj b/Plugin/EngageTimer.csproj index f787921..8f3696a 100644 --- a/Plugin/EngageTimer.csproj +++ b/Plugin/EngageTimer.csproj @@ -8,7 +8,7 @@ true false false - 2.4.0.0 + 2.4.0.1 false true true diff --git a/Plugin/EngageTimer.yaml b/Plugin/EngageTimer.yaml index 4669dbe..5e342e1 100644 --- a/Plugin/EngageTimer.yaml +++ b/Plugin/EngageTimer.yaml @@ -38,4 +38,4 @@ changelog: |- - Use new texture loading for countdown - Migrate to the new font system, the floating window contents might be blurry, this will be fixed soon when I can implement font customization instead of always using the default dalamud one - \ No newline at end of file + - Fix countdown being rounded instead of floored in floating window when disabling decimals \ No newline at end of file diff --git a/Plugin/Ui/FloatingWindow.cs b/Plugin/Ui/FloatingWindow.cs index 745b85d..fbc21c5 100644 --- a/Plugin/Ui/FloatingWindow.cs +++ b/Plugin/Ui/FloatingWindow.cs @@ -78,7 +78,7 @@ private void DrawWindow(bool stopwatchActive, bool countdownActive) pushVar = true; ImGui.PushStyleVar(ImGuiStyleVar.WindowBorderSize, 0); } - + ImGui.PushStyleColor(ImGuiCol.WindowBg, Plugin.Config.FloatingWindow.BackgroundColor); var flags = ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoDecoration | ImGuiWindowFlags.NoScrollbar | @@ -94,7 +94,7 @@ private void DrawWindow(bool stopwatchActive, bool countdownActive) ImGui.PushStyleColor(ImGuiCol.Text, color); ImGui.SetWindowFontScale(Plugin.Config.FloatingWindow.Scale); - + var stopwatchDecimals = Plugin.Config.FloatingWindow.DecimalStopwatchPrecision > 0; var text = ""; // text to be displayed @@ -117,6 +117,7 @@ private void DrawWindow(bool stopwatchActive, bool countdownActive) var format = "{0:0." + new string('0', Plugin.Config.FloatingWindow.DecimalCountdownPrecision) + "}"; var number = Plugin.State.CountDownValue + (Plugin.Config.FloatingWindow.AccurateMode ? 0 : 1); + if (Plugin.Config.FloatingWindow.DecimalCountdownPrecision == 0) number = (float)Math.Floor(number); text = negative + string.Format(CultureInfo.InvariantCulture, format, number); displayed = true; }