From 71d350fe1aec09b3830f1c3df2d06cefbe1046f3 Mon Sep 17 00:00:00 2001 From: goat <16760685+goaaats@users.noreply.github.com> Date: Tue, 7 Dec 2021 18:40:10 +0100 Subject: [PATCH] fix: clean up changelog window --- .../Interface/Internal/DalamudInterface.cs | 7 ++-- .../Internal/Windows/ChangelogWindow.cs | 34 +++++++++++++++++-- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/Dalamud/Interface/Internal/DalamudInterface.cs b/Dalamud/Interface/Internal/DalamudInterface.cs index ce7606a55..7161d6bc2 100644 --- a/Dalamud/Interface/Internal/DalamudInterface.cs +++ b/Dalamud/Interface/Internal/DalamudInterface.cs @@ -52,6 +52,8 @@ namespace Dalamud.Interface.Internal private readonly SelfTestWindow selfTestWindow; private readonly StyleEditorWindow styleEditorWindow; + private readonly TextureWrap logoTexture; + private ulong frameCount = 0; #if DEBUG @@ -63,8 +65,6 @@ namespace Dalamud.Interface.Internal private bool isImGuiDrawDemoWindow = false; private bool isImGuiDrawMetricsWindow = false; - private readonly TextureWrap logoTexture; - /// /// Initializes a new instance of the class. /// @@ -135,6 +135,7 @@ namespace Dalamud.Interface.Internal this.WindowSystem.RemoveAllWindows(); + this.changelogWindow.Dispose(); this.creditsWindow.Dispose(); this.consoleWindow.Dispose(); this.pluginWindow.Dispose(); @@ -391,7 +392,7 @@ namespace Dalamud.Interface.Internal ImGui.End(); } - + ImGui.PopStyleVar(3); ImGui.PopStyleColor(8); } diff --git a/Dalamud/Interface/Internal/Windows/ChangelogWindow.cs b/Dalamud/Interface/Internal/Windows/ChangelogWindow.cs index 55a37bf78..9188ccef8 100644 --- a/Dalamud/Interface/Internal/Windows/ChangelogWindow.cs +++ b/Dalamud/Interface/Internal/Windows/ChangelogWindow.cs @@ -1,17 +1,20 @@ +using System; using System.Diagnostics; +using System.IO; using System.Numerics; using Dalamud.Interface.Colors; using Dalamud.Interface.Windowing; using Dalamud.Utility; using ImGuiNET; +using ImGuiScene; namespace Dalamud.Interface.Internal.Windows { /// /// For major updates, an in-game Changelog window. /// - internal sealed class ChangelogWindow : Window + internal sealed class ChangelogWindow : Window, IDisposable { /// /// Whether the latest update warrants a changelog window. @@ -32,16 +35,24 @@ Thanks and have fun with the new expansion!"; private readonly string assemblyVersion = Util.AssemblyVersion; + private readonly TextureWrap logoTexture; + /// /// Initializes a new instance of the class. /// public ChangelogWindow() - : base("What's new in XIVLauncher?") + : base("What's new in XIVLauncher?", ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoResize) { this.Namespace = "DalamudChangelogWindow"; this.Size = new Vector2(885, 463); this.SizeCondition = ImGuiCond.Appearing; + + var interfaceManager = Service.Get(); + var dalamud = Service.Get(); + + this.logoTexture = + interfaceManager.LoadImage(Path.Combine(dalamud.AssetDirectory.FullName, "UIRes", "logo.png"))!; } /// @@ -52,6 +63,11 @@ Thanks and have fun with the new expansion!"; ImGuiHelpers.ScaledDummy(10); ImGui.Text("The following changes were introduced:"); + + ImGui.SameLine(); + ImGuiHelpers.ScaledDummy(0); + var imgCursor = ImGui.GetCursorPos(); + ImGui.TextWrapped(ChangeLog); ImGuiHelpers.ScaledDummy(5); @@ -118,6 +134,20 @@ Thanks and have fun with the new expansion!"; { this.IsOpen = false; } + + imgCursor.X += 520; + imgCursor.Y -= 30; + ImGui.SetCursorPos(imgCursor); + + ImGui.Image(this.logoTexture.ImGuiHandle, new Vector2(100)); + } + + /// + /// Dispose this window. + /// + public void Dispose() + { + this.logoTexture.Dispose(); } } }