fix: clean up changelog window

This commit is contained in:
goat 2021-12-07 18:40:10 +01:00
parent 8d8b64e25c
commit 71d350fe1a
No known key found for this signature in database
GPG key ID: 7773BB5B43BA52E5
2 changed files with 36 additions and 5 deletions

View file

@ -52,6 +52,8 @@ namespace Dalamud.Interface.Internal
private readonly SelfTestWindow selfTestWindow; private readonly SelfTestWindow selfTestWindow;
private readonly StyleEditorWindow styleEditorWindow; private readonly StyleEditorWindow styleEditorWindow;
private readonly TextureWrap logoTexture;
private ulong frameCount = 0; private ulong frameCount = 0;
#if DEBUG #if DEBUG
@ -63,8 +65,6 @@ namespace Dalamud.Interface.Internal
private bool isImGuiDrawDemoWindow = false; private bool isImGuiDrawDemoWindow = false;
private bool isImGuiDrawMetricsWindow = false; private bool isImGuiDrawMetricsWindow = false;
private readonly TextureWrap logoTexture;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="DalamudInterface"/> class. /// Initializes a new instance of the <see cref="DalamudInterface"/> class.
/// </summary> /// </summary>
@ -135,6 +135,7 @@ namespace Dalamud.Interface.Internal
this.WindowSystem.RemoveAllWindows(); this.WindowSystem.RemoveAllWindows();
this.changelogWindow.Dispose();
this.creditsWindow.Dispose(); this.creditsWindow.Dispose();
this.consoleWindow.Dispose(); this.consoleWindow.Dispose();
this.pluginWindow.Dispose(); this.pluginWindow.Dispose();
@ -391,7 +392,7 @@ namespace Dalamud.Interface.Internal
ImGui.End(); ImGui.End();
} }
ImGui.PopStyleVar(3); ImGui.PopStyleVar(3);
ImGui.PopStyleColor(8); ImGui.PopStyleColor(8);
} }

View file

@ -1,17 +1,20 @@
using System;
using System.Diagnostics; using System.Diagnostics;
using System.IO;
using System.Numerics; using System.Numerics;
using Dalamud.Interface.Colors; using Dalamud.Interface.Colors;
using Dalamud.Interface.Windowing; using Dalamud.Interface.Windowing;
using Dalamud.Utility; using Dalamud.Utility;
using ImGuiNET; using ImGuiNET;
using ImGuiScene;
namespace Dalamud.Interface.Internal.Windows namespace Dalamud.Interface.Internal.Windows
{ {
/// <summary> /// <summary>
/// For major updates, an in-game Changelog window. /// For major updates, an in-game Changelog window.
/// </summary> /// </summary>
internal sealed class ChangelogWindow : Window internal sealed class ChangelogWindow : Window, IDisposable
{ {
/// <summary> /// <summary>
/// Whether the latest update warrants a changelog window. /// 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 string assemblyVersion = Util.AssemblyVersion;
private readonly TextureWrap logoTexture;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="ChangelogWindow"/> class. /// Initializes a new instance of the <see cref="ChangelogWindow"/> class.
/// </summary> /// </summary>
public ChangelogWindow() public ChangelogWindow()
: base("What's new in XIVLauncher?") : base("What's new in XIVLauncher?", ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoResize)
{ {
this.Namespace = "DalamudChangelogWindow"; this.Namespace = "DalamudChangelogWindow";
this.Size = new Vector2(885, 463); this.Size = new Vector2(885, 463);
this.SizeCondition = ImGuiCond.Appearing; this.SizeCondition = ImGuiCond.Appearing;
var interfaceManager = Service<InterfaceManager>.Get();
var dalamud = Service<Dalamud>.Get();
this.logoTexture =
interfaceManager.LoadImage(Path.Combine(dalamud.AssetDirectory.FullName, "UIRes", "logo.png"))!;
} }
/// <inheritdoc/> /// <inheritdoc/>
@ -52,6 +63,11 @@ Thanks and have fun with the new expansion!";
ImGuiHelpers.ScaledDummy(10); ImGuiHelpers.ScaledDummy(10);
ImGui.Text("The following changes were introduced:"); ImGui.Text("The following changes were introduced:");
ImGui.SameLine();
ImGuiHelpers.ScaledDummy(0);
var imgCursor = ImGui.GetCursorPos();
ImGui.TextWrapped(ChangeLog); ImGui.TextWrapped(ChangeLog);
ImGuiHelpers.ScaledDummy(5); ImGuiHelpers.ScaledDummy(5);
@ -118,6 +134,20 @@ Thanks and have fun with the new expansion!";
{ {
this.IsOpen = false; this.IsOpen = false;
} }
imgCursor.X += 520;
imgCursor.Y -= 30;
ImGui.SetCursorPos(imgCursor);
ImGui.Image(this.logoTexture.ImGuiHandle, new Vector2(100));
}
/// <summary>
/// Dispose this window.
/// </summary>
public void Dispose()
{
this.logoTexture.Dispose();
} }
} }
} }