mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
chore: some imraii conversion
This commit is contained in:
parent
14ce85627d
commit
1ce98a2350
8 changed files with 115 additions and 109 deletions
|
|
@ -5,6 +5,7 @@ using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
|
||||||
using Dalamud.Game.ClientState.Keys;
|
using Dalamud.Game.ClientState.Keys;
|
||||||
|
using Dalamud.Interface.Raii;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
using ImGuiScene;
|
using ImGuiScene;
|
||||||
|
|
||||||
|
|
@ -161,9 +162,10 @@ public static class ImGuiHelpers
|
||||||
/// <param name="text">The text to write.</param>
|
/// <param name="text">The text to write.</param>
|
||||||
public static void SafeTextColoredWrapped(Vector4 color, string text)
|
public static void SafeTextColoredWrapped(Vector4 color, string text)
|
||||||
{
|
{
|
||||||
ImGui.PushStyleColor(ImGuiCol.Text, color);
|
using (ImRaii.PushColor(ImGuiCol.Text, color))
|
||||||
ImGui.TextWrapped(text.Replace("%", "%%"));
|
{
|
||||||
ImGui.PopStyleColor();
|
ImGui.TextWrapped(text.Replace("%", "%%"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ using Dalamud.Interface.Internal.Windows.PluginInstaller;
|
||||||
using Dalamud.Interface.Internal.Windows.SelfTest;
|
using Dalamud.Interface.Internal.Windows.SelfTest;
|
||||||
using Dalamud.Interface.Internal.Windows.Settings;
|
using Dalamud.Interface.Internal.Windows.Settings;
|
||||||
using Dalamud.Interface.Internal.Windows.StyleEditor;
|
using Dalamud.Interface.Internal.Windows.StyleEditor;
|
||||||
|
using Dalamud.Interface.Raii;
|
||||||
using Dalamud.Interface.Style;
|
using Dalamud.Interface.Style;
|
||||||
using Dalamud.Interface.Windowing;
|
using Dalamud.Interface.Windowing;
|
||||||
using Dalamud.Logging;
|
using Dalamud.Logging;
|
||||||
|
|
@ -522,7 +523,8 @@ internal class DalamudInterface : IDisposable, IServiceType
|
||||||
|
|
||||||
private void DrawCreditsDarkeningAnimation()
|
private void DrawCreditsDarkeningAnimation()
|
||||||
{
|
{
|
||||||
ImGui.PushStyleVar(ImGuiStyleVar.WindowRounding, 0f);
|
using var style = ImRaii.PushStyle(ImGuiStyleVar.WindowRounding, 0f);
|
||||||
|
|
||||||
ImGui.SetNextWindowPos(new Vector2(0, 0));
|
ImGui.SetNextWindowPos(new Vector2(0, 0));
|
||||||
ImGui.SetNextWindowSize(ImGuiHelpers.MainViewport.Size);
|
ImGui.SetNextWindowSize(ImGuiHelpers.MainViewport.Size);
|
||||||
ImGuiHelpers.ForceNextWindowMainViewport();
|
ImGuiHelpers.ForceNextWindowMainViewport();
|
||||||
|
|
@ -536,8 +538,6 @@ internal class DalamudInterface : IDisposable, IServiceType
|
||||||
ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoFocusOnAppearing | ImGuiWindowFlags.NoBringToFrontOnFocus |
|
ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoFocusOnAppearing | ImGuiWindowFlags.NoBringToFrontOnFocus |
|
||||||
ImGuiWindowFlags.NoNav);
|
ImGuiWindowFlags.NoNav);
|
||||||
ImGui.End();
|
ImGui.End();
|
||||||
|
|
||||||
ImGui.PopStyleVar();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawHiddenDevMenuOpener()
|
private void DrawHiddenDevMenuOpener()
|
||||||
|
|
@ -546,18 +546,17 @@ internal class DalamudInterface : IDisposable, IServiceType
|
||||||
|
|
||||||
if (!this.isImGuiDrawDevMenu && !condition.Any())
|
if (!this.isImGuiDrawDevMenu && !condition.Any())
|
||||||
{
|
{
|
||||||
ImGui.PushStyleColor(ImGuiCol.Button, Vector4.Zero);
|
using var color = ImRaii.PushColor(ImGuiCol.Button, Vector4.Zero);
|
||||||
ImGui.PushStyleColor(ImGuiCol.ButtonActive, Vector4.Zero);
|
color.Push(ImGuiCol.ButtonActive, Vector4.Zero);
|
||||||
ImGui.PushStyleColor(ImGuiCol.ButtonHovered, Vector4.Zero);
|
color.Push(ImGuiCol.ButtonHovered, Vector4.Zero);
|
||||||
ImGui.PushStyleColor(ImGuiCol.TextSelectedBg, new Vector4(0, 0, 0, 1));
|
color.Push(ImGuiCol.TextSelectedBg, new Vector4(0, 0, 0, 1));
|
||||||
ImGui.PushStyleColor(ImGuiCol.Border, new Vector4(0, 0, 0, 1));
|
color.Push(ImGuiCol.Border, new Vector4(0, 0, 0, 1));
|
||||||
ImGui.PushStyleColor(ImGuiCol.BorderShadow, new Vector4(0, 0, 0, 1));
|
color.Push(ImGuiCol.BorderShadow, new Vector4(0, 0, 0, 1));
|
||||||
ImGui.PushStyleColor(ImGuiCol.WindowBg, new Vector4(0, 0, 0, 1));
|
color.Push(ImGuiCol.WindowBg, new Vector4(0, 0, 0, 1));
|
||||||
|
|
||||||
ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, Vector2.Zero);
|
using var style = ImRaii.PushStyle(ImGuiStyleVar.WindowPadding, Vector2.Zero);
|
||||||
ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, Vector2.Zero);
|
style.Push(ImGuiStyleVar.WindowBorderSize, 0);
|
||||||
ImGui.PushStyleVar(ImGuiStyleVar.WindowBorderSize, 0);
|
style.Push(ImGuiStyleVar.FrameBorderSize, 0);
|
||||||
ImGui.PushStyleVar(ImGuiStyleVar.FrameBorderSize, 0);
|
|
||||||
|
|
||||||
var windowPos = ImGui.GetMainViewport().Pos + new Vector2(20);
|
var windowPos = ImGui.GetMainViewport().Pos + new Vector2(20);
|
||||||
ImGui.SetNextWindowPos(windowPos, ImGuiCond.Always);
|
ImGui.SetNextWindowPos(windowPos, ImGuiCond.Always);
|
||||||
|
|
@ -589,9 +588,6 @@ internal class DalamudInterface : IDisposable, IServiceType
|
||||||
|
|
||||||
ImGui.End();
|
ImGui.End();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.PopStyleVar(4);
|
|
||||||
ImGui.PopStyleColor(7);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ using CheapLoc;
|
||||||
using Dalamud.Configuration.Internal;
|
using Dalamud.Configuration.Internal;
|
||||||
using Dalamud.Interface.Colors;
|
using Dalamud.Interface.Colors;
|
||||||
using Dalamud.Interface.Internal.Windows.Settings.Tabs;
|
using Dalamud.Interface.Internal.Windows.Settings.Tabs;
|
||||||
|
using Dalamud.Interface.Raii;
|
||||||
using Dalamud.Interface.Windowing;
|
using Dalamud.Interface.Windowing;
|
||||||
using Dalamud.Plugin.Internal;
|
using Dalamud.Plugin.Internal;
|
||||||
using Dalamud.Utility;
|
using Dalamud.Utility;
|
||||||
|
|
@ -159,33 +160,27 @@ internal class SettingsWindow : Window
|
||||||
|
|
||||||
if (ImGui.BeginChild("###settingsFinishButton"))
|
if (ImGui.BeginChild("###settingsFinishButton"))
|
||||||
{
|
{
|
||||||
ImGui.PushStyleVar(ImGuiStyleVar.FrameRounding, 100f);
|
using var disabled = ImRaii.Disabled(this.tabs.Any(x => x.Entries.Any(y => !y.IsValid)));
|
||||||
ImGui.PushFont(InterfaceManager.IconFont);
|
|
||||||
|
|
||||||
var invalid = this.tabs.Any(x => x.Entries.Any(y => !y.IsValid));
|
using (ImRaii.PushStyle(ImGuiStyleVar.FrameRounding, 100f))
|
||||||
if (invalid)
|
|
||||||
ImGui.BeginDisabled();
|
|
||||||
|
|
||||||
if (ImGui.Button(FontAwesomeIcon.Save.ToIconString(), new Vector2(40)))
|
|
||||||
{
|
{
|
||||||
this.Save();
|
using var font = ImRaii.PushFont(InterfaceManager.IconFont);
|
||||||
|
|
||||||
if (!ImGui.IsKeyDown(ImGuiKey.ModShift))
|
if (ImGui.Button(FontAwesomeIcon.Save.ToIconString(), new Vector2(40)))
|
||||||
this.IsOpen = false;
|
{
|
||||||
|
this.Save();
|
||||||
|
|
||||||
|
if (!ImGui.IsKeyDown(ImGuiKey.ModShift))
|
||||||
|
this.IsOpen = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.PopStyleVar();
|
|
||||||
ImGui.PopFont();
|
|
||||||
|
|
||||||
if (ImGui.IsItemHovered())
|
if (ImGui.IsItemHovered())
|
||||||
{
|
{
|
||||||
ImGui.SetTooltip(!ImGui.IsKeyDown(ImGuiKey.ModShift)
|
ImGui.SetTooltip(!ImGui.IsKeyDown(ImGuiKey.ModShift)
|
||||||
? Loc.Localize("DalamudSettingsSaveAndExit", "Save changes and close")
|
? Loc.Localize("DalamudSettingsSaveAndExit", "Save changes and close")
|
||||||
: Loc.Localize("DalamudSettingsSaveAndExit", "Save changes"));
|
: Loc.Localize("DalamudSettingsSaveAndExit", "Save changes"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (invalid)
|
|
||||||
ImGui.EndDisabled();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.EndChild();
|
ImGui.EndChild();
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ using System.Numerics;
|
||||||
using CheapLoc;
|
using CheapLoc;
|
||||||
using Dalamud.Game.Gui;
|
using Dalamud.Game.Gui;
|
||||||
using Dalamud.Interface.GameFonts;
|
using Dalamud.Interface.GameFonts;
|
||||||
|
using Dalamud.Interface.Raii;
|
||||||
using Dalamud.Plugin.Internal;
|
using Dalamud.Plugin.Internal;
|
||||||
using Dalamud.Utility;
|
using Dalamud.Utility;
|
||||||
using FFXIVClientStructs.FFXIV.Client.Game.UI;
|
using FFXIVClientStructs.FFXIV.Client.Game.UI;
|
||||||
|
|
@ -243,46 +244,45 @@ Contribute at: https://github.com/goatcorp/Dalamud
|
||||||
this.resetNow = false;
|
this.resetNow = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, Vector2.Zero);
|
using (ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, Vector2.Zero))
|
||||||
|
|
||||||
ImGuiHelpers.ScaledDummy(0, windowSize.Y + 20f);
|
|
||||||
ImGui.Text(string.Empty);
|
|
||||||
|
|
||||||
const float imageSize = 190f;
|
|
||||||
ImGui.SameLine((ImGui.GetWindowWidth() / 2) - (imageSize / 2));
|
|
||||||
ImGui.Image(this.logoTexture.ImGuiHandle, ImGuiHelpers.ScaledVector2(imageSize));
|
|
||||||
|
|
||||||
ImGuiHelpers.ScaledDummy(0, 20f);
|
|
||||||
|
|
||||||
var windowX = ImGui.GetWindowSize().X;
|
|
||||||
|
|
||||||
foreach (var creditsLine in this.creditsText.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None))
|
|
||||||
{
|
{
|
||||||
var lineLenX = ImGui.CalcTextSize(creditsLine).X;
|
ImGuiHelpers.ScaledDummy(0, windowSize.Y + 20f);
|
||||||
|
ImGui.Text(string.Empty);
|
||||||
|
|
||||||
ImGui.Dummy(new Vector2((windowX / 2) - (lineLenX / 2), 0f));
|
const float imageSize = 190f;
|
||||||
ImGui.SameLine();
|
ImGui.SameLine((ImGui.GetWindowWidth() / 2) - (imageSize / 2));
|
||||||
ImGui.TextUnformatted(creditsLine);
|
ImGui.Image(this.logoTexture.ImGuiHandle, ImGuiHelpers.ScaledVector2(imageSize));
|
||||||
|
|
||||||
|
ImGuiHelpers.ScaledDummy(0, 20f);
|
||||||
|
|
||||||
|
var windowX = ImGui.GetWindowSize().X;
|
||||||
|
|
||||||
|
foreach (var creditsLine in this.creditsText.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None))
|
||||||
|
{
|
||||||
|
var lineLenX = ImGui.CalcTextSize(creditsLine).X;
|
||||||
|
|
||||||
|
ImGui.Dummy(new Vector2((windowX / 2) - (lineLenX / 2), 0f));
|
||||||
|
ImGui.SameLine();
|
||||||
|
ImGui.TextUnformatted(creditsLine);
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGuiHelpers.ScaledDummy(0, 40f);
|
||||||
|
|
||||||
|
if (this.thankYouFont != null)
|
||||||
|
{
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiHelpers.ScaledDummy(0, 40f);
|
|
||||||
|
|
||||||
if (this.thankYouFont != null)
|
|
||||||
{
|
|
||||||
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();
|
|
||||||
|
|
||||||
if (this.creditsThrottler.Elapsed.TotalMilliseconds > (1000.0f / CreditFps))
|
if (this.creditsThrottler.Elapsed.TotalMilliseconds > (1000.0f / CreditFps))
|
||||||
{
|
{
|
||||||
var curY = ImGui.GetScrollY();
|
var curY = ImGui.GetScrollY();
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ using Dalamud.Configuration;
|
||||||
using Dalamud.Configuration.Internal;
|
using Dalamud.Configuration.Internal;
|
||||||
using Dalamud.Interface.Colors;
|
using Dalamud.Interface.Colors;
|
||||||
using Dalamud.Interface.Components;
|
using Dalamud.Interface.Components;
|
||||||
|
using Dalamud.Interface.Raii;
|
||||||
using Dalamud.Plugin.Internal;
|
using Dalamud.Plugin.Internal;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
|
|
||||||
|
|
@ -57,10 +58,11 @@ public class DevPluginsSettingsEntry : SettingsEntry
|
||||||
ImGui.Text(this.Name);
|
ImGui.Text(this.Name);
|
||||||
if (this.devPluginLocationsChanged)
|
if (this.devPluginLocationsChanged)
|
||||||
{
|
{
|
||||||
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.HealerGreen);
|
using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.HealerGreen))
|
||||||
ImGui.SameLine();
|
{
|
||||||
ImGui.Text(Loc.Localize("DalamudSettingsChanged", "(Changed)"));
|
ImGui.SameLine();
|
||||||
ImGui.PopStyleColor();
|
ImGui.Text(Loc.Localize("DalamudSettingsChanged", "(Changed)"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiHelpers.SafeTextColoredWrapped(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingsDevPluginLocationsHint", "Add additional dev plugin load locations.\nThese can be either the directory or DLL path."));
|
ImGuiHelpers.SafeTextColoredWrapped(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingsDevPluginLocationsHint", "Add additional dev plugin load locations.\nThese can be either the directory or DLL path."));
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ using System.Linq;
|
||||||
using Dalamud.Configuration.Internal;
|
using Dalamud.Configuration.Internal;
|
||||||
|
|
||||||
using Dalamud.Interface.Colors;
|
using Dalamud.Interface.Colors;
|
||||||
|
using Dalamud.Interface.Raii;
|
||||||
using Dalamud.Utility;
|
using Dalamud.Utility;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
|
|
||||||
|
|
@ -121,9 +122,11 @@ internal sealed class SettingsEntry<T> : SettingsEntry
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudGrey);
|
using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudGrey))
|
||||||
ImGuiHelpers.SafeTextWrapped(this.Description);
|
{
|
||||||
ImGui.PopStyleColor();
|
ImGuiHelpers.SafeTextWrapped(this.Description);
|
||||||
|
ImGui.PopStyleColor();
|
||||||
|
}
|
||||||
|
|
||||||
if (this.CheckValidity != null)
|
if (this.CheckValidity != null)
|
||||||
{
|
{
|
||||||
|
|
@ -132,9 +135,11 @@ internal sealed class SettingsEntry<T> : SettingsEntry
|
||||||
|
|
||||||
if (!this.IsValid)
|
if (!this.IsValid)
|
||||||
{
|
{
|
||||||
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudRed);
|
using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudRed))
|
||||||
ImGui.Text(validityMsg);
|
{
|
||||||
ImGui.PopStyleColor();
|
ImGui.Text(validityMsg);
|
||||||
|
ImGui.PopStyleColor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -146,9 +151,11 @@ internal sealed class SettingsEntry<T> : SettingsEntry
|
||||||
|
|
||||||
if (warningMessage != null)
|
if (warningMessage != null)
|
||||||
{
|
{
|
||||||
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudRed);
|
using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudRed))
|
||||||
ImGui.Text(warningMessage);
|
{
|
||||||
ImGui.PopStyleColor();
|
ImGui.Text(warningMessage);
|
||||||
|
ImGui.PopStyleColor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ using Dalamud.Configuration;
|
||||||
using Dalamud.Configuration.Internal;
|
using Dalamud.Configuration.Internal;
|
||||||
using Dalamud.Interface.Colors;
|
using Dalamud.Interface.Colors;
|
||||||
using Dalamud.Interface.Components;
|
using Dalamud.Interface.Components;
|
||||||
|
using Dalamud.Interface.Raii;
|
||||||
using Dalamud.Plugin.Internal;
|
using Dalamud.Plugin.Internal;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
|
|
||||||
|
|
@ -53,10 +54,11 @@ public class ThirdRepoSettingsEntry : SettingsEntry
|
||||||
ImGui.Text(Loc.Localize("DalamudSettingsCustomRepo", "Custom Plugin Repositories"));
|
ImGui.Text(Loc.Localize("DalamudSettingsCustomRepo", "Custom Plugin Repositories"));
|
||||||
if (this.thirdRepoListChanged)
|
if (this.thirdRepoListChanged)
|
||||||
{
|
{
|
||||||
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.HealerGreen);
|
using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.HealerGreen))
|
||||||
ImGui.SameLine();
|
{
|
||||||
ImGui.Text(Loc.Localize("DalamudSettingsChanged", "(Changed)"));
|
ImGui.SameLine();
|
||||||
ImGui.PopStyleColor();
|
ImGui.Text(Loc.Localize("DalamudSettingsChanged", "(Changed)"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiHelpers.SafeTextColoredWrapped(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingCustomRepoHint", "Add custom plugin repositories."));
|
ImGuiHelpers.SafeTextColoredWrapped(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingCustomRepoHint", "Add custom plugin repositories."));
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ using Dalamud.Game;
|
||||||
using Dalamud.Game.ClientState;
|
using Dalamud.Game.ClientState;
|
||||||
using Dalamud.Game.Gui;
|
using Dalamud.Game.Gui;
|
||||||
using Dalamud.Interface.Animation.EasingFunctions;
|
using Dalamud.Interface.Animation.EasingFunctions;
|
||||||
|
using Dalamud.Interface.Raii;
|
||||||
using Dalamud.Interface.Windowing;
|
using Dalamud.Interface.Windowing;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
using ImGuiScene;
|
using ImGuiScene;
|
||||||
|
|
@ -169,23 +170,22 @@ internal class TitleScreenMenuWindow : Window, IDisposable
|
||||||
|
|
||||||
this.fadeOutEasing.Update();
|
this.fadeOutEasing.Update();
|
||||||
|
|
||||||
ImGui.PushStyleVar(ImGuiStyleVar.Alpha, (float)this.fadeOutEasing.Value);
|
using (ImRaii.PushStyle(ImGuiStyleVar.Alpha, (float)this.fadeOutEasing.Value))
|
||||||
|
|
||||||
for (var i = 0; i < tsm.Entries.Count; i++)
|
|
||||||
{
|
{
|
||||||
var entry = tsm.Entries[i];
|
for (var i = 0; i < tsm.Entries.Count; i++)
|
||||||
|
{
|
||||||
|
var entry = tsm.Entries[i];
|
||||||
|
|
||||||
var finalPos = (i + 1) * this.shadeTexture.Height * scale;
|
var finalPos = (i + 1) * this.shadeTexture.Height * scale;
|
||||||
|
|
||||||
this.DrawEntry(entry, i != 0, true, i == 0, false, false);
|
this.DrawEntry(entry, i != 0, true, i == 0, false, false);
|
||||||
|
|
||||||
var cursor = ImGui.GetCursorPos();
|
var cursor = ImGui.GetCursorPos();
|
||||||
cursor.Y = finalPos;
|
cursor.Y = finalPos;
|
||||||
ImGui.SetCursorPos(cursor);
|
ImGui.SetCursorPos(cursor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.PopStyleVar();
|
|
||||||
|
|
||||||
var isHover = ImGui.IsWindowHovered(ImGuiHoveredFlags.RootAndChildWindows |
|
var isHover = ImGui.IsWindowHovered(ImGuiHoveredFlags.RootAndChildWindows |
|
||||||
ImGuiHoveredFlags.AllowWhenBlockedByActiveItem);
|
ImGuiHoveredFlags.AllowWhenBlockedByActiveItem);
|
||||||
|
|
||||||
|
|
@ -254,9 +254,11 @@ internal class TitleScreenMenuWindow : Window, IDisposable
|
||||||
|
|
||||||
var initialCursor = ImGui.GetCursorPos();
|
var initialCursor = ImGui.GetCursorPos();
|
||||||
|
|
||||||
ImGui.PushStyleVar(ImGuiStyleVar.Alpha, (float)shadeEasing.Value);
|
|
||||||
ImGui.Image(this.shadeTexture.ImGuiHandle, new Vector2(this.shadeTexture.Width * scale, this.shadeTexture.Height * scale));
|
using (ImRaii.PushStyle(ImGuiStyleVar.Alpha, (float)shadeEasing.Value))
|
||||||
ImGui.PopStyleVar();
|
{
|
||||||
|
ImGui.Image(this.shadeTexture.ImGuiHandle, new Vector2(this.shadeTexture.Width * scale, this.shadeTexture.Height * scale));
|
||||||
|
}
|
||||||
|
|
||||||
var isHover = ImGui.IsItemHovered();
|
var isHover = ImGui.IsItemHovered();
|
||||||
if (isHover && (!shadeEasing.IsRunning || (shadeEasing.IsDone && shadeEasing.IsInverse)) && !inhibitFadeout)
|
if (isHover && (!shadeEasing.IsRunning || (shadeEasing.IsDone && shadeEasing.IsInverse)) && !inhibitFadeout)
|
||||||
|
|
@ -331,15 +333,15 @@ internal class TitleScreenMenuWindow : Window, IDisposable
|
||||||
}
|
}
|
||||||
|
|
||||||
// Drop shadow
|
// Drop shadow
|
||||||
ImGui.PushStyleColor(ImGuiCol.Text, 0xFF000000);
|
using (ImRaii.PushColor(ImGuiCol.Text, 0xFF000000))
|
||||||
for (int i = 0, i_ = (int)Math.Ceiling(1 * scale); i < i_; i++)
|
|
||||||
{
|
{
|
||||||
ImGui.SetCursorPos(new Vector2(cursor.X, cursor.Y + i));
|
for (int i = 0, i_ = (int)Math.Ceiling(1 * scale); i < i_; i++)
|
||||||
ImGui.Text(entry.Name);
|
{
|
||||||
|
ImGui.SetCursorPos(new Vector2(cursor.X, cursor.Y + i));
|
||||||
|
ImGui.Text(entry.Name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.PopStyleColor();
|
|
||||||
|
|
||||||
ImGui.SetCursorPos(cursor);
|
ImGui.SetCursorPos(cursor);
|
||||||
ImGui.Text(entry.Name);
|
ImGui.Text(entry.Name);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue