mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-13 12:14:16 +01:00
feat: clean up credits window, various improvements
This commit is contained in:
parent
a78754ce22
commit
07607804bc
2 changed files with 56 additions and 7 deletions
|
|
@ -23,6 +23,13 @@ namespace Dalamud.Interface
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static float GlobalScale { get; private set; }
|
public static float GlobalScale { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a <see cref="Vector2"/> that is pre-scaled with the <see cref="GlobalScale"/> multiplier.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="x">Vector2 X & Y parameter.</param>
|
||||||
|
/// <returns>A scaled Vector2.</returns>
|
||||||
|
public static Vector2 ScaledVector2(float x) => new Vector2(x, x) * GlobalScale;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a <see cref="Vector2"/> that is pre-scaled with the <see cref="GlobalScale"/> multiplier.
|
/// Gets a <see cref="Vector2"/> that is pre-scaled with the <see cref="GlobalScale"/> multiplier.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ using System.Linq;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
|
||||||
using Dalamud.Game.Gui;
|
using Dalamud.Game.Gui;
|
||||||
|
using Dalamud.Interface.GameFonts;
|
||||||
using Dalamud.Interface.Windowing;
|
using Dalamud.Interface.Windowing;
|
||||||
using Dalamud.Plugin.Internal;
|
using Dalamud.Plugin.Internal;
|
||||||
using Dalamud.Utility;
|
using Dalamud.Utility;
|
||||||
|
|
@ -139,21 +140,21 @@ Join us at: https://discord.gg/3NMcUV5
|
||||||
|
|
||||||
Dalamud is licensed under AGPL v3 or later
|
Dalamud is licensed under AGPL v3 or later
|
||||||
Contribute at: https://github.com/goatsoft/Dalamud
|
Contribute at: https://github.com/goatsoft/Dalamud
|
||||||
|
|
||||||
|
|
||||||
Thank you for using XIVLauncher and Dalamud!
|
|
||||||
";
|
";
|
||||||
|
|
||||||
private readonly TextureWrap logoTexture;
|
private readonly TextureWrap logoTexture;
|
||||||
private readonly Stopwatch creditsThrottler;
|
private readonly Stopwatch creditsThrottler;
|
||||||
|
private readonly GameFontHandle thankYouFont;
|
||||||
|
|
||||||
private string creditsText;
|
private string creditsText;
|
||||||
|
|
||||||
|
private const string thankYouText = "Thank you!";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="CreditsWindow"/> class.
|
/// Initializes a new instance of the <see cref="CreditsWindow"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public CreditsWindow()
|
public CreditsWindow()
|
||||||
: base("Dalamud Credits", ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoResize, true)
|
: base("Dalamud Credits", ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoTitleBar, true)
|
||||||
{
|
{
|
||||||
var dalamud = Service<Dalamud>.Get();
|
var dalamud = Service<Dalamud>.Get();
|
||||||
var interfaceManager = Service<InterfaceManager>.Get();
|
var interfaceManager = Service<InterfaceManager>.Get();
|
||||||
|
|
@ -167,6 +168,9 @@ Thank you for using XIVLauncher and Dalamud!
|
||||||
this.PositionCondition = ImGuiCond.Always;
|
this.PositionCondition = ImGuiCond.Always;
|
||||||
|
|
||||||
this.BgAlpha = 0.8f;
|
this.BgAlpha = 0.8f;
|
||||||
|
|
||||||
|
var gfm = Service<GameFontManager>.Get();
|
||||||
|
this.thankYouFont = gfm.NewFontRef(new GameFontStyle(GameFontFamilyAndSize.TrumpGothic34));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
|
|
@ -218,11 +222,12 @@ Thank you for using XIVLauncher and Dalamud!
|
||||||
|
|
||||||
ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, Vector2.Zero);
|
ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, Vector2.Zero);
|
||||||
|
|
||||||
ImGuiHelpers.ScaledDummy(0, 340f);
|
ImGuiHelpers.ScaledDummy(0, windowSize.Y + 20f);
|
||||||
ImGui.Text(string.Empty);
|
ImGui.Text(string.Empty);
|
||||||
|
|
||||||
ImGui.SameLine(150f);
|
const float imageSize = 190f;
|
||||||
ImGui.Image(this.logoTexture.ImGuiHandle, ImGuiHelpers.ScaledVector2(190f, 190f));
|
ImGui.SameLine((ImGui.GetWindowWidth() / 2) - (imageSize / 2));
|
||||||
|
ImGui.Image(this.logoTexture.ImGuiHandle, ImGuiHelpers.ScaledVector2(imageSize));
|
||||||
|
|
||||||
ImGuiHelpers.ScaledDummy(0, 20f);
|
ImGuiHelpers.ScaledDummy(0, 20f);
|
||||||
|
|
||||||
|
|
@ -237,6 +242,19 @@ Thank you for using XIVLauncher and Dalamud!
|
||||||
ImGui.TextUnformatted(creditsLine);
|
ImGui.TextUnformatted(creditsLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGuiHelpers.ScaledDummy(0, 40f);
|
||||||
|
|
||||||
|
ImGui.PushFont(this.thankYouFont.ImFont);
|
||||||
|
var thankYouLenX = ImGui.CalcTextSize(thankYouText).X;
|
||||||
|
|
||||||
|
ImGui.Dummy(new Vector2((windowX / 2) - (thankYouLenX / 2), 0f));
|
||||||
|
ImGui.SameLine();
|
||||||
|
ImGui.TextUnformatted(thankYouText);
|
||||||
|
|
||||||
|
ImGui.PopFont();
|
||||||
|
|
||||||
|
ImGuiHelpers.ScaledDummy(0, windowSize.Y + 50f);
|
||||||
|
|
||||||
ImGui.PopStyleVar();
|
ImGui.PopStyleVar();
|
||||||
|
|
||||||
if (this.creditsThrottler.Elapsed.TotalMilliseconds > (1000.0f / CreditFPS))
|
if (this.creditsThrottler.Elapsed.TotalMilliseconds > (1000.0f / CreditFPS))
|
||||||
|
|
@ -248,9 +266,32 @@ Thank you for using XIVLauncher and Dalamud!
|
||||||
{
|
{
|
||||||
ImGui.SetScrollY(curY + 1);
|
ImGui.SetScrollY(curY + 1);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ImGui.SetScrollY(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.EndChild();
|
ImGui.EndChild();
|
||||||
|
|
||||||
|
ImGui.SetCursorPos(new Vector2(0));
|
||||||
|
ImGui.BeginChild("button", Vector2.Zero, false, ImGuiWindowFlags.NoScrollbar);
|
||||||
|
|
||||||
|
var closeButtonSize = new Vector2(30);
|
||||||
|
ImGui.PushFont(InterfaceManager.IconFont);
|
||||||
|
ImGui.SetCursorPos(new Vector2(windowSize.X - closeButtonSize.X - 5, 5));
|
||||||
|
ImGui.PushStyleColor(ImGuiCol.Button, Vector4.Zero);
|
||||||
|
ImGui.PushStyleColor(ImGuiCol.ButtonHovered, Vector4.Zero);
|
||||||
|
ImGui.PushStyleColor(ImGuiCol.ButtonActive, Vector4.Zero);
|
||||||
|
|
||||||
|
if (ImGui.Button(FontAwesomeIcon.Times.ToIconString(), closeButtonSize))
|
||||||
|
{
|
||||||
|
this.IsOpen = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.PopStyleColor(3);
|
||||||
|
ImGui.PopFont();
|
||||||
|
ImGui.EndChild();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -259,6 +300,7 @@ Thank you for using XIVLauncher and Dalamud!
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
this.logoTexture?.Dispose();
|
this.logoTexture?.Dispose();
|
||||||
|
this.thankYouFont?.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue