mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 05:04:15 +01:00
Re-add ImGui.NET, add compatibility shims
This commit is contained in:
parent
b2fd7cc9e1
commit
308b9e4575
15 changed files with 173 additions and 13 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
|
@ -19,3 +19,6 @@
|
||||||
[submodule "lib/Hexa.NET.ImGui"]
|
[submodule "lib/Hexa.NET.ImGui"]
|
||||||
path = lib/Hexa.NET.ImGui
|
path = lib/Hexa.NET.ImGui
|
||||||
url = https://github.com/HexaEngine/Hexa.NET.ImGui.git
|
url = https://github.com/HexaEngine/Hexa.NET.ImGui.git
|
||||||
|
[submodule "lib/ImGui.NET"]
|
||||||
|
path = lib/ImGui.NET
|
||||||
|
url = https://github.com/goatcorp/ImGui.NET.git
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Bindings", "Bindings", "{A2
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StandaloneImGuiTestbed", "imgui\StandaloneImGuiTestbed\StandaloneImGuiTestbed.csproj", "{4702A911-2513-478C-A434-2776393FDE77}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StandaloneImGuiTestbed", "imgui\StandaloneImGuiTestbed\StandaloneImGuiTestbed.csproj", "{4702A911-2513-478C-A434-2776393FDE77}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImGui.NET-472", "lib\ImGui.NET\src\ImGui.NET-472\ImGui.NET-472.csproj", "{FAD7F842-2E81-456F-8AE8-DFFEDC258EC3}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
|
@ -162,6 +164,10 @@ Global
|
||||||
{4702A911-2513-478C-A434-2776393FDE77}.Debug|Any CPU.Build.0 = Debug|x64
|
{4702A911-2513-478C-A434-2776393FDE77}.Debug|Any CPU.Build.0 = Debug|x64
|
||||||
{4702A911-2513-478C-A434-2776393FDE77}.Release|Any CPU.ActiveCfg = Release|x64
|
{4702A911-2513-478C-A434-2776393FDE77}.Release|Any CPU.ActiveCfg = Release|x64
|
||||||
{4702A911-2513-478C-A434-2776393FDE77}.Release|Any CPU.Build.0 = Release|x64
|
{4702A911-2513-478C-A434-2776393FDE77}.Release|Any CPU.Build.0 = Release|x64
|
||||||
|
{FAD7F842-2E81-456F-8AE8-DFFEDC258EC3}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||||
|
{FAD7F842-2E81-456F-8AE8-DFFEDC258EC3}.Debug|Any CPU.Build.0 = Debug|x64
|
||||||
|
{FAD7F842-2E81-456F-8AE8-DFFEDC258EC3}.Release|Any CPU.ActiveCfg = Release|x64
|
||||||
|
{FAD7F842-2E81-456F-8AE8-DFFEDC258EC3}.Release|Any CPU.Build.0 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
@ -184,6 +190,7 @@ Global
|
||||||
{5E6EDD75-AE95-43A6-9D67-95B840EB4B71} = {A217B3DF-607A-4EFB-B107-3C4809348043}
|
{5E6EDD75-AE95-43A6-9D67-95B840EB4B71} = {A217B3DF-607A-4EFB-B107-3C4809348043}
|
||||||
{9C70BD06-D52C-425E-9C14-5D66BC6046EF} = {A217B3DF-607A-4EFB-B107-3C4809348043}
|
{9C70BD06-D52C-425E-9C14-5D66BC6046EF} = {A217B3DF-607A-4EFB-B107-3C4809348043}
|
||||||
{4702A911-2513-478C-A434-2776393FDE77} = {A217B3DF-607A-4EFB-B107-3C4809348043}
|
{4702A911-2513-478C-A434-2776393FDE77} = {A217B3DF-607A-4EFB-B107-3C4809348043}
|
||||||
|
{FAD7F842-2E81-456F-8AE8-DFFEDC258EC3} = {DBE5345E-6594-4A59-B183-1C3D5592269D}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {79B65AC9-C940-410E-AB61-7EA7E12C7599}
|
SolutionGuid = {79B65AC9-C940-410E-AB61-7EA7E12C7599}
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,7 @@
|
||||||
<ProjectReference Include="..\imgui\Dalamud.Bindings.ImPlot\Dalamud.Bindings.ImPlot.csproj" />
|
<ProjectReference Include="..\imgui\Dalamud.Bindings.ImPlot\Dalamud.Bindings.ImPlot.csproj" />
|
||||||
<ProjectReference Include="..\lib\FFXIVClientStructs\FFXIVClientStructs\FFXIVClientStructs.csproj" />
|
<ProjectReference Include="..\lib\FFXIVClientStructs\FFXIVClientStructs\FFXIVClientStructs.csproj" />
|
||||||
<ProjectReference Include="..\lib\FFXIVClientStructs\InteropGenerator.Runtime\InteropGenerator.Runtime.csproj" />
|
<ProjectReference Include="..\lib\FFXIVClientStructs\InteropGenerator.Runtime\InteropGenerator.Runtime.csproj" />
|
||||||
|
<ProjectReference Include="..\lib\ImGui.NET\src\ImGui.NET-472\ImGui.NET-472.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ using System.Linq;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
|
||||||
using Dalamud.Bindings.ImGui;
|
using Dalamud.Bindings.ImGui;
|
||||||
|
using Dalamud.Interface.Internal;
|
||||||
using Dalamud.Interface.Utility;
|
using Dalamud.Interface.Utility;
|
||||||
using Dalamud.Utility;
|
using Dalamud.Utility;
|
||||||
|
|
||||||
|
|
@ -152,7 +153,7 @@ public partial class FileDialog
|
||||||
|
|
||||||
private void DrawPathComposer()
|
private void DrawPathComposer()
|
||||||
{
|
{
|
||||||
ImGui.PushFont(UiBuilder.IconFont);
|
ImGui.PushFont(InterfaceManager.IconFont);
|
||||||
if (ImGui.Button(this.pathInputActivated ? FontAwesomeIcon.Times.ToIconString() : FontAwesomeIcon.Edit.ToIconString()))
|
if (ImGui.Button(this.pathInputActivated ? FontAwesomeIcon.Times.ToIconString() : FontAwesomeIcon.Edit.ToIconString()))
|
||||||
{
|
{
|
||||||
this.pathInputActivated = !this.pathInputActivated;
|
this.pathInputActivated = !this.pathInputActivated;
|
||||||
|
|
@ -205,7 +206,7 @@ public partial class FileDialog
|
||||||
|
|
||||||
private void DrawSearchBar()
|
private void DrawSearchBar()
|
||||||
{
|
{
|
||||||
ImGui.PushFont(UiBuilder.IconFont);
|
ImGui.PushFont(InterfaceManager.IconFont);
|
||||||
if (ImGui.Button(FontAwesomeIcon.Home.ToIconString()))
|
if (ImGui.Button(FontAwesomeIcon.Home.ToIconString()))
|
||||||
{
|
{
|
||||||
this.SetPath(".");
|
this.SetPath(".");
|
||||||
|
|
@ -239,7 +240,7 @@ public partial class FileDialog
|
||||||
{
|
{
|
||||||
if (this.flags.HasFlag(ImGuiFileDialogFlags.DisableCreateDirectoryButton)) return;
|
if (this.flags.HasFlag(ImGuiFileDialogFlags.DisableCreateDirectoryButton)) return;
|
||||||
|
|
||||||
ImGui.PushFont(UiBuilder.IconFont);
|
ImGui.PushFont(InterfaceManager.IconFont);
|
||||||
if (ImGui.Button(FontAwesomeIcon.FolderPlus.ToIconString()) && !this.createDirectoryMode)
|
if (ImGui.Button(FontAwesomeIcon.FolderPlus.ToIconString()) && !this.createDirectoryMode)
|
||||||
{
|
{
|
||||||
this.createDirectoryMode = true;
|
this.createDirectoryMode = true;
|
||||||
|
|
@ -328,7 +329,7 @@ public partial class FileDialog
|
||||||
this.selectedSideBar = qa.Text;
|
this.selectedSideBar = qa.Text;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.PushFont(UiBuilder.IconFont);
|
ImGui.PushFont(InterfaceManager.IconFont);
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGui.SetCursorPosX(0);
|
ImGui.SetCursorPosX(0);
|
||||||
ImGui.TextUnformatted(qa.Icon.ToIconString());
|
ImGui.TextUnformatted(qa.Icon.ToIconString());
|
||||||
|
|
@ -493,7 +494,7 @@ public partial class FileDialog
|
||||||
{
|
{
|
||||||
const ImGuiSelectableFlags flags = ImGuiSelectableFlags.AllowDoubleClick | ImGuiSelectableFlags.SpanAllColumns;
|
const ImGuiSelectableFlags flags = ImGuiSelectableFlags.AllowDoubleClick | ImGuiSelectableFlags.SpanAllColumns;
|
||||||
|
|
||||||
ImGui.PushFont(UiBuilder.IconFont);
|
ImGui.PushFont(InterfaceManager.IconFont);
|
||||||
|
|
||||||
ImGui.TextUnformatted(icon.ToIconString());
|
ImGui.TextUnformatted(icon.ToIconString());
|
||||||
ImGui.PopFont();
|
ImGui.PopFont();
|
||||||
|
|
|
||||||
|
|
@ -720,7 +720,7 @@ internal partial class InterfaceManager : IInternalDisposableService
|
||||||
// NOTE (Chiv) Explicitly deactivate on dalamud boot
|
// NOTE (Chiv) Explicitly deactivate on dalamud boot
|
||||||
ImGui.GetIO().ConfigFlags &= ~ImGuiConfigFlags.NavEnableGamepad;
|
ImGui.GetIO().ConfigFlags &= ~ImGuiConfigFlags.NavEnableGamepad;
|
||||||
|
|
||||||
ImGuiHelpers.MainViewport = ImGui.GetMainViewport();
|
ImGuiHelpers.MainViewportNew = ImGui.GetMainViewport();
|
||||||
|
|
||||||
Log.Information("[IM] Scene & ImGui setup OK!");
|
Log.Information("[IM] Scene & ImGui setup OK!");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -672,6 +672,6 @@ internal unsafe class UiDebug
|
||||||
|
|
||||||
position += ImGuiHelpers.MainViewport.Pos;
|
position += ImGuiHelpers.MainViewport.Pos;
|
||||||
|
|
||||||
ImGui.GetForegroundDrawList(ImGuiHelpers.MainViewport).AddRect(position, position + size, nodeVisible ? 0xFF00FF00 : 0xFF0000FF);
|
ImGui.GetForegroundDrawList(ImGuiHelpers.MainViewportNew).AddRect(position, position + size, nodeVisible ? 0xFF00FF00 : 0xFF0000FF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3885,7 +3885,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
||||||
{
|
{
|
||||||
var positionOffset = ImGuiHelpers.ScaledVector2(0.0f, 1.0f);
|
var positionOffset = ImGuiHelpers.ScaledVector2(0.0f, 1.0f);
|
||||||
var cursorStart = ImGui.GetCursorPos() + positionOffset;
|
var cursorStart = ImGui.GetCursorPos() + positionOffset;
|
||||||
ImGui.PushFont(UiBuilder.IconFont);
|
ImGui.PushFont(InterfaceManager.IconFont);
|
||||||
|
|
||||||
ImGui.PushStyleColor(ImGuiCol.Text, outline);
|
ImGui.PushStyleColor(ImGuiCol.Text, outline);
|
||||||
foreach (var x in Enumerable.Range(-1, 3))
|
foreach (var x in Enumerable.Range(-1, 3))
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ public class SettingsTabDtr : SettingsTab
|
||||||
// TODO: Maybe we can also resort the rest of the bar in the future?
|
// TODO: Maybe we can also resort the rest of the bar in the future?
|
||||||
// var isRequired = search is Configuration.SearchSetting.Internal or Configuration.SearchSetting.MacroLinks;
|
// var isRequired = search is Configuration.SearchSetting.Internal or Configuration.SearchSetting.MacroLinks;
|
||||||
|
|
||||||
ImGui.PushFont(UiBuilder.IconFont);
|
ImGui.PushFont(UiBuilder.IconFontNew);
|
||||||
|
|
||||||
var arrowUpText = $"{FontAwesomeIcon.ArrowUp.ToIconString()}##{title}";
|
var arrowUpText = $"{FontAwesomeIcon.ArrowUp.ToIconString()}##{title}";
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
|
|
|
||||||
|
|
@ -333,19 +333,67 @@ public sealed class UiBuilder : IDisposable, IUiBuilder
|
||||||
/// Gets the default Dalamud font - supporting all game languages and icons.<br />
|
/// Gets the default Dalamud font - supporting all game languages and icons.<br />
|
||||||
/// <strong>Accessing this static property outside of <see cref="Draw"/> is dangerous and not supported.</strong>
|
/// <strong>Accessing this static property outside of <see cref="Draw"/> is dangerous and not supported.</strong>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static ImFontPtr DefaultFont => InterfaceManager.DefaultFont;
|
public static ImFontPtr DefaultFontNew => InterfaceManager.DefaultFont;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the default Dalamud icon font based on FontAwesome 5 Free solid.<br />
|
/// Gets the default Dalamud icon font based on FontAwesome 5 Free solid.<br />
|
||||||
/// <strong>Accessing this static property outside of <see cref="Draw"/> is dangerous and not supported.</strong>
|
/// <strong>Accessing this static property outside of <see cref="Draw"/> is dangerous and not supported.</strong>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static ImFontPtr IconFont => InterfaceManager.IconFont;
|
public static ImFontPtr IconFontNew => InterfaceManager.IconFont;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the default Dalamud monospaced font based on Inconsolata Regular.<br />
|
/// Gets the default Dalamud monospaced font based on Inconsolata Regular.<br />
|
||||||
/// <strong>Accessing this static property outside of <see cref="Draw"/> is dangerous and not supported.</strong>
|
/// <strong>Accessing this static property outside of <see cref="Draw"/> is dangerous and not supported.</strong>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static ImFontPtr MonoFont => InterfaceManager.MonoFont;
|
public static ImFontPtr MonoFontNew => InterfaceManager.MonoFont;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the default Dalamud font - supporting all game languages and icons.<br />
|
||||||
|
/// <strong>Accessing this static property outside of <see cref="Draw"/> is dangerous and not supported.</strong>
|
||||||
|
/// </summary>
|
||||||
|
[ImGuiBindingsToDo("Remove, rename New variant.")]
|
||||||
|
public static ImGuiNET.ImFontPtr DefaultFont
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
unsafe
|
||||||
|
{
|
||||||
|
return new ImGuiNET.ImFontPtr((nint)InterfaceManager.DefaultFont.Handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the default Dalamud icon font based on FontAwesome 5 Free solid.<br />
|
||||||
|
/// <strong>Accessing this static property outside of <see cref="Draw"/> is dangerous and not supported.</strong>
|
||||||
|
/// </summary>
|
||||||
|
[ImGuiBindingsToDo("Remove, rename New variant.")]
|
||||||
|
public static ImGuiNET.ImFontPtr IconFont
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
unsafe
|
||||||
|
{
|
||||||
|
return new ImGuiNET.ImFontPtr((nint)InterfaceManager.IconFont.Handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the default Dalamud monospaced font based on Inconsolata Regular.<br />
|
||||||
|
/// <strong>Accessing this static property outside of <see cref="Draw"/> is dangerous and not supported.</strong>
|
||||||
|
/// </summary>
|
||||||
|
[ImGuiBindingsToDo("Remove, rename New variant.")]
|
||||||
|
public static ImGuiNET.ImFontPtr MonoFont
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
unsafe
|
||||||
|
{
|
||||||
|
return new ImGuiNET.ImFontPtr((nint)InterfaceManager.MonoFont.Handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the default font specifications.
|
/// Gets the default font specifications.
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,9 @@ using Dalamud.Interface.ImGuiSeStringRenderer.Internal;
|
||||||
using Dalamud.Interface.ManagedFontAtlas;
|
using Dalamud.Interface.ManagedFontAtlas;
|
||||||
using Dalamud.Interface.ManagedFontAtlas.Internals;
|
using Dalamud.Interface.ManagedFontAtlas.Internals;
|
||||||
using Dalamud.Interface.Utility.Raii;
|
using Dalamud.Interface.Utility.Raii;
|
||||||
|
using Dalamud.Utility;
|
||||||
|
|
||||||
|
using ImGuiViewport = ImGuiNET.ImGuiViewport;
|
||||||
using VirtualKey = Dalamud.Game.ClientState.Keys.VirtualKey;
|
using VirtualKey = Dalamud.Game.ClientState.Keys.VirtualKey;
|
||||||
|
|
||||||
namespace Dalamud.Interface.Utility;
|
namespace Dalamud.Interface.Utility;
|
||||||
|
|
@ -31,7 +33,22 @@ public static partial class ImGuiHelpers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the main viewport.
|
/// Gets the main viewport.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static ImGuiViewportPtr MainViewport { get; internal set; }
|
public static ImGuiViewportPtr MainViewportNew { get; internal set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the main viewport.
|
||||||
|
/// </summary>
|
||||||
|
[ImGuiBindingsToDo("Remove and rename MainViewportNew to MainViewport")]
|
||||||
|
public static ImGuiNET.ImGuiViewportPtr MainViewport
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
unsafe
|
||||||
|
{
|
||||||
|
return new ImGuiNET.ImGuiViewportPtr((nint)MainViewportNew.Handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the global Dalamud scale.
|
/// Gets the global Dalamud scale.
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ using System.Linq;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
|
||||||
using Dalamud.Bindings.ImGui;
|
using Dalamud.Bindings.ImGui;
|
||||||
|
using Dalamud.Utility;
|
||||||
|
|
||||||
namespace Dalamud.Interface.Utility.Raii;
|
namespace Dalamud.Interface.Utility.Raii;
|
||||||
|
|
||||||
|
|
@ -16,6 +17,14 @@ public static partial class ImRaii
|
||||||
public static Color PushColor(ImGuiCol idx, Vector4 color, bool condition = true)
|
public static Color PushColor(ImGuiCol idx, Vector4 color, bool condition = true)
|
||||||
=> new Color().Push(idx, color, condition);
|
=> new Color().Push(idx, color, condition);
|
||||||
|
|
||||||
|
[ImGuiBindingsToDo("Remove.")]
|
||||||
|
public static Color PushColor(ImGuiNET.ImGuiCol idx, uint color, bool condition = true)
|
||||||
|
=> new Color().Push(idx, color, condition);
|
||||||
|
|
||||||
|
[ImGuiBindingsToDo("Remove.")]
|
||||||
|
public static Color PushColor(ImGuiNET.ImGuiCol idx, Vector4 color, bool condition = true)
|
||||||
|
=> new Color().Push(idx, color, condition);
|
||||||
|
|
||||||
// Push colors that revert all current color changes made temporarily.
|
// Push colors that revert all current color changes made temporarily.
|
||||||
public static Color DefaultColors()
|
public static Color DefaultColors()
|
||||||
{
|
{
|
||||||
|
|
@ -31,6 +40,7 @@ public static partial class ImRaii
|
||||||
internal static readonly List<(ImGuiCol, uint)> Stack = new();
|
internal static readonly List<(ImGuiCol, uint)> Stack = new();
|
||||||
private int count;
|
private int count;
|
||||||
|
|
||||||
|
[ImGuiBindingsToDo("Remove.")]
|
||||||
public Color Push(ImGuiCol idx, uint color, bool condition = true)
|
public Color Push(ImGuiCol idx, uint color, bool condition = true)
|
||||||
{
|
{
|
||||||
if (condition)
|
if (condition)
|
||||||
|
|
@ -43,6 +53,7 @@ public static partial class ImRaii
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[ImGuiBindingsToDo("Remove.")]
|
||||||
public Color Push(ImGuiCol idx, Vector4 color, bool condition = true)
|
public Color Push(ImGuiCol idx, Vector4 color, bool condition = true)
|
||||||
{
|
{
|
||||||
if (condition)
|
if (condition)
|
||||||
|
|
@ -55,6 +66,12 @@ public static partial class ImRaii
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Color Push(ImGuiNET.ImGuiCol idx, uint color, bool condition = true)
|
||||||
|
=> this.Push((ImGuiCol)idx, color, condition);
|
||||||
|
|
||||||
|
public Color Push(ImGuiNET.ImGuiCol idx, Vector4 color, bool condition = true)
|
||||||
|
=> this.Push((ImGuiCol)idx, color, condition);
|
||||||
|
|
||||||
public void Pop(int num = 1)
|
public void Pop(int num = 1)
|
||||||
{
|
{
|
||||||
num = Math.Min(num, this.count);
|
num = Math.Min(num, this.count);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using Dalamud.Bindings.ImGui;
|
using Dalamud.Bindings.ImGui;
|
||||||
|
using Dalamud.Utility;
|
||||||
|
|
||||||
namespace Dalamud.Interface.Utility.Raii;
|
namespace Dalamud.Interface.Utility.Raii;
|
||||||
|
|
||||||
|
|
@ -9,6 +10,10 @@ public static partial class ImRaii
|
||||||
public static Font PushFont(ImFontPtr font, bool condition = true)
|
public static Font PushFont(ImFontPtr font, bool condition = true)
|
||||||
=> condition ? new Font().Push(font) : new Font();
|
=> condition ? new Font().Push(font) : new Font();
|
||||||
|
|
||||||
|
[ImGuiBindingsToDo("Remove.")]
|
||||||
|
public static Font PushFont(ImGuiNET.ImFontPtr font, bool condition = true)
|
||||||
|
=> condition ? new Font().Push(font) : new Font();
|
||||||
|
|
||||||
// Push the default font if any other font is currently pushed.
|
// Push the default font if any other font is currently pushed.
|
||||||
public static Font DefaultFont()
|
public static Font DefaultFont()
|
||||||
=> new Font().Push(Font.DefaultPushed, Font.FontPushCounter > 0);
|
=> new Font().Push(Font.DefaultPushed, Font.FontPushCounter > 0);
|
||||||
|
|
@ -36,6 +41,12 @@ public static partial class ImRaii
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[ImGuiBindingsToDo("Remove.")]
|
||||||
|
public unsafe Font Push(ImGuiNET.ImFontPtr font, bool condition = true)
|
||||||
|
{
|
||||||
|
return this.Push(new ImFontPtr((ImFont*)font.NativePtr), condition);
|
||||||
|
}
|
||||||
|
|
||||||
public void Pop(int num = 1)
|
public void Pop(int num = 1)
|
||||||
{
|
{
|
||||||
num = Math.Min(num, this.count);
|
num = Math.Min(num, this.count);
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ using Dalamud.Interface.Internal;
|
||||||
using Dalamud.Interface.Utility;
|
using Dalamud.Interface.Utility;
|
||||||
using Dalamud.Interface.Windowing.Persistence;
|
using Dalamud.Interface.Windowing.Persistence;
|
||||||
using Dalamud.Logging.Internal;
|
using Dalamud.Logging.Internal;
|
||||||
|
using Dalamud.Utility;
|
||||||
|
|
||||||
using FFXIVClientStructs.FFXIV.Client.UI;
|
using FFXIVClientStructs.FFXIV.Client.UI;
|
||||||
using PInvoke;
|
using PInvoke;
|
||||||
|
|
||||||
|
|
@ -56,6 +58,34 @@ public abstract class Window
|
||||||
this.ForceMainWindow = forceMainWindow;
|
this.ForceMainWindow = forceMainWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="Window"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">The name/ID of this window.
|
||||||
|
/// If you have multiple windows with the same name, you will need to
|
||||||
|
/// append a unique ID to it by specifying it after "###" behind the window title.
|
||||||
|
/// </param>
|
||||||
|
/// <param name="flags">The <see cref="ImGuiWindowFlags"/> of this window.</param>
|
||||||
|
/// <param name="forceMainWindow">Whether this window should be limited to the main game window.</param>
|
||||||
|
[ImGuiBindingsToDo("Remove.")]
|
||||||
|
protected Window(
|
||||||
|
string name, ImGuiNET.ImGuiWindowFlags flags = ImGuiNET.ImGuiWindowFlags.None, bool forceMainWindow = false)
|
||||||
|
: this(name, (ImGuiWindowFlags)flags, forceMainWindow)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="Window"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">The name/ID of this window.
|
||||||
|
/// If you have multiple windows with the same name, you will need to
|
||||||
|
/// append a unique ID to it by specifying it after "###" behind the window title.
|
||||||
|
/// </param>
|
||||||
|
protected Window(string name)
|
||||||
|
: this(name, ImGuiWindowFlags.None)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Flags to control window behavior.
|
/// Flags to control window behavior.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
24
Dalamud/Utility/ImGuiBindingsToDoAttribute.cs
Normal file
24
Dalamud/Utility/ImGuiBindingsToDoAttribute.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
namespace Dalamud.Utility;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Utility class for marking something to be changed for when the new bindings are fully adopted, for ease of lookup.
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.All, Inherited = false)]
|
||||||
|
internal sealed class ImGuiBindingsToDoAttribute : Attribute
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Marks that this should be made internal.
|
||||||
|
/// </summary>
|
||||||
|
public const string MakeInternal = "Make internal.";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="ImGuiBindingsToDoAttribute"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="what">The explanation.</param>
|
||||||
|
/// <param name="what2">The explanation 2.</param>
|
||||||
|
public ImGuiBindingsToDoAttribute(string what, string what2 = "")
|
||||||
|
{
|
||||||
|
_ = what;
|
||||||
|
_ = what2;
|
||||||
|
}
|
||||||
|
}
|
||||||
1
lib/ImGui.NET
Submodule
1
lib/ImGui.NET
Submodule
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 98304cfd0bf86cf176732d60eb5dba6fc351f737
|
||||||
Loading…
Add table
Add a link
Reference in a new issue