diff --git a/RotationSolver.Basic/Configuration/PluginConfiguration.cs b/RotationSolver.Basic/Configuration/PluginConfiguration.cs index 2e4f9243a..76bb0f690 100644 --- a/RotationSolver.Basic/Configuration/PluginConfiguration.cs +++ b/RotationSolver.Basic/Configuration/PluginConfiguration.cs @@ -172,6 +172,7 @@ public class PluginConfiguration : IPluginConfiguration public bool ShowGCDCooldown = false; public bool UseOriginalCooldown = true; public int CooldownActionOneLine = 15; + public float CooldownFontSize = 24; public Vector4 ControlWindowLockBg = new Vector4(0, 0, 0, 0.6f); public Vector4 ControlWindowUnlockBg = new Vector4(0, 0, 0, 0.9f); diff --git a/RotationSolver/Localization/Localization.json b/RotationSolver/Localization/Localization.json index 7f7b9ae07..696c291e6 100644 --- a/RotationSolver/Localization/Localization.json +++ b/RotationSolver/Localization/Localization.json @@ -188,6 +188,7 @@ "ConfigWindow_Control_ShowGCDCooldown": "Show GCD' Cooldown", "ConfigWindow_Control_UseOriginalCooldown": "Show Original Cooldown", "ConfigWindow_Control_CooldownActionOneLine": "The count of cooldown actions in one line.", + "ConfigWindow_Control_CooldownFontSize": "Change the cooldown font size.", "ConfigWindow_Control_BackgroundColor": "Control Window's Background", "ConfigWindow_Control_InfoWindowBg": "Info Window's Background", "ConfigWindow_Control_ControlWindowGCDSize": "GCD icon size", diff --git a/RotationSolver/Localization/Strings.cs b/RotationSolver/Localization/Strings.cs index 8ce800e4e..282c464dd 100644 --- a/RotationSolver/Localization/Strings.cs +++ b/RotationSolver/Localization/Strings.cs @@ -256,6 +256,7 @@ internal partial class Strings public string ConfigWindow_Control_ShowGCDCooldown { get; set; } = "Show GCD' Cooldown"; public string ConfigWindow_Control_UseOriginalCooldown { get; set; } = "Show Original Cooldown"; public string ConfigWindow_Control_CooldownActionOneLine { get; set; } = "The count of cooldown actions in one line."; + public string ConfigWindow_Control_CooldownFontSize { get; set; } = "Change the cooldown font size."; public string ConfigWindow_Control_BackgroundColor { get; set; } = "Control Window's Background"; public string ConfigWindow_Control_InfoWindowBg { get; set; } = "Info Window's Background"; public string ConfigWindow_Control_ControlWindowGCDSize { get; set; } = "GCD icon size"; diff --git a/RotationSolver/UI/CooldownWindow.cs b/RotationSolver/UI/CooldownWindow.cs index 2059c8923..f6c52b668 100644 --- a/RotationSolver/UI/CooldownWindow.cs +++ b/RotationSolver/UI/CooldownWindow.cs @@ -79,11 +79,14 @@ private static void DrawActionCooldown(IAction act) ImGui.GetWindowDrawList().AddLine(startPos, startPos + new Vector2(0, size.Y), black); } + + ImGui.PushFont(ImGuiHelper.GetFont(Service.Config.CooldownFontSize)); string time = recast == 0 ? "0" : ((int)(recast - elapsed % recast) + 1).ToString(); var strSize = ImGui.CalcTextSize(time); var fontPos = new Vector2(pos.X + size.X / 2 - strSize.X / 2, pos.Y + size.Y / 2 - strSize.Y / 2) + winPos; TextShade(fontPos, time); + ImGui.PopFont(); } if (act.EnoughLevel && act is IBaseAction bAct && bAct.MaxCharges > 1) diff --git a/RotationSolver/UI/ImGuiHelper.cs b/RotationSolver/UI/ImGuiHelper.cs index a9bd8839b..8d4daadf3 100644 --- a/RotationSolver/UI/ImGuiHelper.cs +++ b/RotationSolver/UI/ImGuiHelper.cs @@ -791,4 +791,13 @@ public static void Display(this RotationDescAttribute attr, ICustomRotation rota } ImGui.Unindent(ATTR_INDENT); } + + public static ImFontPtr GetFont(float size) + { + var style = new Dalamud.Interface.GameFonts.GameFontStyle(Dalamud.Interface.GameFonts.GameFontStyle.GetRecommendedFamilyAndSize(Dalamud.Interface.GameFonts.GameFontFamily.Axis, size)); + var font = Service.Interface.UiBuilder.GetGameFontHandle(style).ImFont; + font.Scale = size / style.BaseSizePt; + + return font; + } } diff --git a/RotationSolver/UI/RotationConfigWindow_Control.cs b/RotationSolver/UI/RotationConfigWindow_Control.cs index ce9cf4e0f..36e9c34eb 100644 --- a/RotationSolver/UI/RotationConfigWindow_Control.cs +++ b/RotationSolver/UI/RotationConfigWindow_Control.cs @@ -49,6 +49,8 @@ private void DrawControlTab() ref Service.Config.UseOriginalCooldown, Service.Default.UseOriginalCooldown); DrawIntNumber(LocalizationManager.RightLang.ConfigWindow_Control_CooldownActionOneLine, ref Service.Config.CooldownActionOneLine, Service.Default.CooldownActionOneLine, min: 1, max: 30); + + DrawFloatNumber(LocalizationManager.RightLang.ConfigWindow_Control_CooldownFontSize, ref Service.Config.CooldownFontSize, Service.Default.CooldownFontSize, min: 9.6f, max: 96); } } @@ -57,30 +59,31 @@ private void DrawControlTab() DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Control_ShowControlWindow, ref Service.Config.ShowControlWindow, Service.Default.ShowControlWindow); - if (!Service.Config.ShowControlWindow) return; - - DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Control_IsInfoWindowNoInputs, - ref Service.Config.IsControlWindowLock, Service.Default.IsControlWindowLock); - - if (Service.Config.IsControlWindowLock) + if (Service.Config.ShowControlWindow) { - DrawColor4(LocalizationManager.RightLang.ConfigWindow_Control_BackgroundColor, - ref Service.Config.ControlWindowLockBg, Service.Default.ControlWindowLockBg); - } - else - { - DrawColor4(LocalizationManager.RightLang.ConfigWindow_Control_BackgroundColor, - ref Service.Config.ControlWindowUnlockBg, Service.Default.ControlWindowUnlockBg); - } + DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Control_IsInfoWindowNoInputs, + ref Service.Config.IsControlWindowLock, Service.Default.IsControlWindowLock); - DrawFloatNumber(LocalizationManager.RightLang.ConfigWindow_Control_ControlWindowGCDSize, - ref Service.Config.ControlWindowGCDSize, Service.Default.ControlWindowGCDSize, speed: 0.2f , max: 80); + if (Service.Config.IsControlWindowLock) + { + DrawColor4(LocalizationManager.RightLang.ConfigWindow_Control_BackgroundColor, + ref Service.Config.ControlWindowLockBg, Service.Default.ControlWindowLockBg); + } + else + { + DrawColor4(LocalizationManager.RightLang.ConfigWindow_Control_BackgroundColor, + ref Service.Config.ControlWindowUnlockBg, Service.Default.ControlWindowUnlockBg); + } + + DrawFloatNumber(LocalizationManager.RightLang.ConfigWindow_Control_ControlWindowGCDSize, + ref Service.Config.ControlWindowGCDSize, Service.Default.ControlWindowGCDSize, speed: 0.2f, max: 80); - DrawFloatNumber(LocalizationManager.RightLang.ConfigWindow_Control_ControlWindow0GCDSize, - ref Service.Config.ControlWindow0GCDSize, Service.Default.ControlWindow0GCDSize, speed: 0.2f, max: 80); + DrawFloatNumber(LocalizationManager.RightLang.ConfigWindow_Control_ControlWindow0GCDSize, + ref Service.Config.ControlWindow0GCDSize, Service.Default.ControlWindow0GCDSize, speed: 0.2f, max: 80); - DrawFloatNumber(LocalizationManager.RightLang.ConfigWindow_Control_ControlWindowNextSizeRatio, - ref Service.Config.ControlWindowNextSizeRatio, Service.Default.ControlWindowNextSizeRatio); + DrawFloatNumber(LocalizationManager.RightLang.ConfigWindow_Control_ControlWindowNextSizeRatio, + ref Service.Config.ControlWindowNextSizeRatio, Service.Default.ControlWindowNextSizeRatio); + } } private static void DrawColor4(string name, ref Vector4 value, Vector4 @default, string description = "") diff --git a/RotationSolver/UI/RotationConfigWindow_Major.cs b/RotationSolver/UI/RotationConfigWindow_Major.cs index 8d97c4ef8..8319a3e26 100644 --- a/RotationSolver/UI/RotationConfigWindow_Major.cs +++ b/RotationSolver/UI/RotationConfigWindow_Major.cs @@ -1,4 +1,5 @@ using Dalamud.Interface.Windowing; +using ImGuiNET; using RotationSolver.Localization; namespace RotationSolver.UI;