Manual overloads for ImGui functions accepting text (#2319)

* wip2

* Implement AutoUtf8Buffer

* reformat

* Work on manual bindings

* restructure

* Name scripts properly

* Update utility functions to use ImU8String

* add overloads

* Add more overloads

* Use ImGuiWindow from gen, support AddCallback

* Use LibraryImport for custom ImGuiNative functinos

* Make manual overloads for string-returning functinos

* Make all overloads with self as its first parameter extension methods

* Fix overload resolution by removing unnecessary

* in => scoped in

* Fix compilation errors
This commit is contained in:
srkizer 2025-08-05 03:14:00 +09:00 committed by GitHub
parent 0c63541864
commit c69329f592
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
293 changed files with 61312 additions and 754 deletions

View file

@ -1,3 +1,5 @@
using System.Numerics;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Internal.UiDebug2.Utility;
using Dalamud.Interface.Utility.Raii;
@ -110,7 +112,7 @@ public unsafe partial class AddonTree
}
catch (Exception ex)
{
ImGui.TextColored(new(1, 0, 0, 1), $"{ex}");
ImGui.TextColored(new Vector4(1, 0, 0, 1), $"{ex}");
}
}
}

View file

@ -121,7 +121,7 @@ public unsafe partial class AddonTree : IDisposable
ImGui.SameLine();
ImGui.SameLine();
ImGui.TextColored(isVisible ? new(0.1f, 1f, 0.1f, 1f) : new(0.6f, 0.6f, 0.6f, 1), isVisible ? "Visible" : "Not Visible");
ImGui.TextColored(isVisible ? new Vector4(0.1f, 1f, 0.1f, 1f) : new(0.6f, 0.6f, 0.6f, 1), isVisible ? "Visible" : "Not Visible");
ImGui.SameLine(ImGui.GetWindowWidth() - 100);

View file

@ -57,11 +57,11 @@ public static class Events
ImGui.TableNextColumn();
ImGui.TextUnformatted($"{evt->State.StateFlags}");
ImGui.TableNextColumn();
ImGui.TextUnformatted($"{evt->State.UnkFlags1}");
ImGui.TextUnformatted($"{evt->State.ReturnFlags}");
ImGui.TableNextColumn();
ImGuiHelpers.ClickToCopyText($"{(nint)evt->Target:X}", null, new Vector4(0.6f, 0.6f, 0.6f, 1));
ImGuiHelpers.ClickToCopyText($"{(nint)evt->Target:X}", default, new Vector4(0.6f, 0.6f, 0.6f, 1));
ImGui.TableNextColumn();
ImGuiHelpers.ClickToCopyText($"{(nint)evt->Listener:X}", null, new Vector4(0.6f, 0.6f, 0.6f, 1));
ImGuiHelpers.ClickToCopyText($"{(nint)evt->Listener:X}", default, new Vector4(0.6f, 0.6f, 0.6f, 1));
evt = evt->NextEvent;
}
}

View file

@ -321,7 +321,7 @@ internal unsafe partial class TextNodeTree
ImGui.Text("Font:");
ImGui.TableNextColumn();
ImGui.SetNextItemWidth(150);
if (ImGui.Combo($"##{(nint)this.Node:X}fontType", ref fontIndex, FontNames, FontList.Count))
if (ImGui.Combo($"##{(nint)this.Node:X}fontType", ref fontIndex, FontNames))
{
this.TxtNode->FontType = FontList[fontIndex];
}

View file

@ -226,13 +226,13 @@ internal unsafe partial class ImageNodeTree : ResNodeTree
ImGui.TableNextColumn();
ImGui.TextColored(!hiRes ? new(1) : new(0.6f, 0.6f, 0.6f, 1), "Standard:\t");
ImGui.TextColored(!hiRes ? new Vector4(1) : new(0.6f, 0.6f, 0.6f, 1), "Standard:\t");
ImGui.SameLine();
var cursX = ImGui.GetCursorPosX();
PrintPartCoords(u / 2f, v / 2f, width / 2f, height / 2f);
ImGui.TextColored(hiRes ? new(1) : new(0.6f, 0.6f, 0.6f, 1), "Hi-Res:\t");
ImGui.TextColored(hiRes ? new Vector4(1) : new(0.6f, 0.6f, 0.6f, 1), "Hi-Res:\t");
ImGui.SameLine();
ImGui.SetCursorPosX(cursX);

View file

@ -1,3 +1,4 @@
using System.Numerics;
using System.Runtime.InteropServices;
using Dalamud.Bindings.ImGui;
@ -46,7 +47,7 @@ internal unsafe partial class TextNodeTree : ResNodeTree
return;
}
ImGui.TextColored(new(1), "Text:");
ImGui.TextColored(new Vector4(1), "Text:");
ImGui.SameLine();
try

View file

@ -74,7 +74,7 @@ public readonly unsafe partial struct TimelineTree
("Frame Time", $"{this.NodeTimeline->FrameTime:F2} ({this.NodeTimeline->FrameTime * 30:F0})"));
PrintFieldValuePairs(("Active Label Id", $"{this.NodeTimeline->ActiveLabelId}"), ("Duration", $"{this.NodeTimeline->LabelFrameIdxDuration}"), ("End Frame", $"{this.NodeTimeline->LabelEndFrameIdx}"));
ImGui.TextColored(new(0.6f, 0.6f, 0.6f, 1), "Animation List");
ImGui.TextColored(new Vector4(0.6f, 0.6f, 0.6f, 1), "Animation List");
for (var a = 0; a < animationCount; a++)
{

View file

@ -28,7 +28,7 @@ internal static class Gui
var grey60 = new Vector4(0.6f, 0.6f, 0.6f, 1);
if (copy)
{
ImGuiHelpers.ClickToCopyText(value, null, grey60);
ImGuiHelpers.ClickToCopyText(value, default, grey60);
}
else
{