diff --git a/Dalamud/Interface/Internal/Windows/TitleScreenMenuWindow.cs b/Dalamud/Interface/Internal/Windows/TitleScreenMenuWindow.cs index 88f291954..979f68bf8 100644 --- a/Dalamud/Interface/Internal/Windows/TitleScreenMenuWindow.cs +++ b/Dalamud/Interface/Internal/Windows/TitleScreenMenuWindow.cs @@ -11,6 +11,7 @@ using Dalamud.Game.Gui; using Dalamud.Game.Text; using Dalamud.Interface.Animation.EasingFunctions; +using Dalamud.Interface.ImGuiSeStringRenderer; using Dalamud.Interface.ManagedFontAtlas; using Dalamud.Interface.ManagedFontAtlas.Internals; using Dalamud.Interface.Textures.TextureWraps; @@ -50,11 +51,11 @@ internal class TitleScreenMenuWindow : Window, IDisposable private readonly Lazy myFontHandle; private readonly Lazy shadeTexture; private readonly AddonLifecycleEventListener versionStringListener; - + private readonly Dictionary shadeEasings = new(); private readonly Dictionary moveEasings = new(); private readonly Dictionary logoEasings = new(); - + private readonly IConsoleVariable showTsm; private InOutCubic? fadeOutEasing; @@ -62,7 +63,7 @@ internal class TitleScreenMenuWindow : Window, IDisposable private State state = State.Hide; private int lastLoadedPluginCount = -1; - + /// /// Initializes a new instance of the class. /// @@ -91,7 +92,7 @@ public TitleScreenMenuWindow( ImGuiWindowFlags.NoBackground | ImGuiWindowFlags.NoFocusOnAppearing | ImGuiWindowFlags.NoNavFocus) { this.showTsm = consoleManager.AddVariable("dalamud.show_tsm", "Show the Title Screen Menu", true); - + this.clientState = clientState; this.configuration = configuration; this.gameGui = gameGui; @@ -124,7 +125,7 @@ public TitleScreenMenuWindow( framework.Update += this.FrameworkOnUpdate; this.scopedFinalizer.Add(() => framework.Update -= this.FrameworkOnUpdate); - + this.versionStringListener = new AddonLifecycleEventListener(AddonEvent.PreDraw, "_TitleRevision", this.OnVersionStringDraw); addonLifecycle.RegisterListener(this.versionStringListener); this.scopedFinalizer.Add(() => addonLifecycle.UnregisterListener(this.versionStringListener)); @@ -136,7 +137,7 @@ private enum State Show, FadeOut, } - + /// /// Gets or sets a value indicating whether drawing is allowed. /// @@ -165,7 +166,7 @@ public override void Draw() { if (!this.AllowDrawing || !this.showTsm.Value) return; - + var scale = ImGui.GetIO().FontGlobalScale; var entries = this.titleScreenMenu.PluginEntries; @@ -174,7 +175,7 @@ public override void Draw() ImGuiHoveredFlags.AllowWhenBlockedByActiveItem); Service.Get().OverrideGameCursor = !hovered; - + switch (this.state) { case State.Show: @@ -251,7 +252,7 @@ public override void Draw() this.fadeOutEasing.Update(); - using (ImRaii.PushStyle(ImGuiStyleVar.Alpha, (float)this.fadeOutEasing.Value)) + using (ImRaii.PushStyle(ImGuiStyleVar.Alpha, (float)Math.Max(this.fadeOutEasing.Value, 0))) { var i = 0; foreach (var entry in entries) @@ -392,21 +393,14 @@ private bool DrawEntry( if (overrideAlpha) { - ImGui.PushStyleVar(ImGuiStyleVar.Alpha, showText ? (float)logoEasing.Value : 0f); + ImGui.PushStyleVar(ImGuiStyleVar.Alpha, showText ? (float)Math.Min(logoEasing.Value, 1) : 0f); } // Drop shadow - using (ImRaii.PushColor(ImGuiCol.Text, 0xFF000000)) - { - for (int i = 0, to = (int)Math.Ceiling(1 * scale); i < to; i++) - { - ImGui.SetCursorPos(new Vector2(cursor.X, cursor.Y + i)); - ImGui.Text(entry.Name); - } - } - ImGui.SetCursorPos(cursor); - ImGui.Text(entry.Name); + var renderStyle = default(SeStringDrawParams); + renderStyle.FontSize = TargetFontSizePx; + ImGuiHelpers.CompileSeStringWrapped($"{entry.Name}", renderStyle); if (overrideAlpha) { @@ -439,7 +433,7 @@ private unsafe void OnVersionStringDraw(AddonEvent ev, AddonArgs args) var addon = (AtkUnitBase*)drawArgs.Addon; var textNode = addon->GetTextNodeById(3); - + // look and feel init. should be harmless to set. textNode->TextFlags |= (byte)TextFlags.MultiLine; textNode->AlignmentType = AlignmentType.TopLeft;