This commit is contained in:
Soreepeong 2025-07-22 14:46:12 +09:00
parent 11aef2f4d6
commit f391ac57d3
13 changed files with 787 additions and 413 deletions

View file

@ -13,7 +13,6 @@ public ref struct AutoUtf8Buffer : IDisposable
private const int TotalBufferSize = 1024; private const int TotalBufferSize = 1024;
private const int FixedBufferSize = TotalBufferSize - 8 - 8 - 8 - 1; private const int FixedBufferSize = TotalBufferSize - 8 - 8 - 8 - 1;
private const int MinimumRentSize = TotalBufferSize * 2; private const int MinimumRentSize = TotalBufferSize * 2;
private byte[]? rentedBuffer; private byte[]? rentedBuffer;
private ReadOnlySpan<byte> span; private ReadOnlySpan<byte> span;
private IFormatProvider? formatProvider; private IFormatProvider? formatProvider;
@ -38,30 +37,26 @@ public ref struct AutoUtf8Buffer : IDisposable
IncreaseBuffer(out _, literalLength); IncreaseBuffer(out _, literalLength);
} }
public AutoUtf8Buffer(int literalLength, int formattedCount, IFormatProvider? formatProvider) public AutoUtf8Buffer(int literalLength, int formattedCount, IFormatProvider? formatProvider) : this(
: this(literalLength, formattedCount) literalLength,
formattedCount)
{ {
this.formatProvider = formatProvider; this.formatProvider = formatProvider;
} }
public AutoUtf8Buffer(ReadOnlySpan<byte> text) public unsafe AutoUtf8Buffer(ReadOnlySpan<byte> text)
{ {
this.state = State.Initialized; this.state = State.Initialized;
if (text.IsEmpty) if (text.IsEmpty)
{ {
unsafe this.span = MemoryMarshal.CreateSpan(ref this.fixedBuffer[0], 0);
{ this.fixedBuffer[0] = 0;
this.span = MemoryMarshal.CreateSpan(ref this.fixedBuffer[0], 0);
this.fixedBuffer[0] = 0;
}
this.state |= State.NullTerminated | State.OwnedSpan; this.state |= State.NullTerminated | State.OwnedSpan;
} }
else else
{ {
this.span = text; this.span = text;
if (Unsafe.Add(ref Unsafe.AsRef(in text[0]), text.Length) == 0) if (Unsafe.Add(ref Unsafe.AsRef(in text[0]), text.Length) == 0) this.state |= State.NullTerminated;
this.state |= State.NullTerminated;
} }
} }
@ -125,7 +120,6 @@ public ref struct AutoUtf8Buffer : IDisposable
{ {
if ((this.state & State.OwnedSpan) != 0) if ((this.state & State.OwnedSpan) != 0)
this.span = MemoryMarshal.CreateSpan(ref this.fixedBuffer[0], this.span.Length); this.span = MemoryMarshal.CreateSpan(ref this.fixedBuffer[0], this.span.Length);
if ((this.state & State.NullTerminated) == 0) if ((this.state & State.NullTerminated) == 0)
{ {
if (this.span.Length + 1 < FixedBufferSize) if (this.span.Length + 1 < FixedBufferSize)
@ -151,8 +145,8 @@ public ref struct AutoUtf8Buffer : IDisposable
} }
private unsafe Span<byte> EffectiveBuffer => private unsafe Span<byte> EffectiveBuffer =>
this.rentedBuffer is { } rentedBuffer this.rentedBuffer is { } buf
? rentedBuffer.AsSpan() ? buf.AsSpan()
: MemoryMarshal.CreateSpan(ref this.fixedBuffer[0], FixedBufferSize); : MemoryMarshal.CreateSpan(ref this.fixedBuffer[0], FixedBufferSize);
private Span<byte> RemainingBuffer => this.EffectiveBuffer[this.span.Length..]; private Span<byte> RemainingBuffer => this.EffectiveBuffer[this.span.Length..];
@ -171,17 +165,17 @@ public ref struct AutoUtf8Buffer : IDisposable
public void Dispose() public void Dispose()
{ {
if (this.rentedBuffer is { } rentedBuffer) if (this.rentedBuffer is { } buf)
{ {
this.rentedBuffer = null; this.rentedBuffer = null;
this.span = default; this.span = default;
ArrayPool<byte>.Shared.Return(rentedBuffer); ArrayPool<byte>.Shared.Return(buf);
} }
this.state = State.None; this.state = State.None;
} }
public AutoUtf8Buffer MoveOrDefault([InterpolatedStringHandlerArgument] AutoUtf8Buffer other) public AutoUtf8Buffer MoveOrDefault(AutoUtf8Buffer other)
{ {
if (this.IsInitialized) if (this.IsInitialized)
{ {

View file

@ -5,39 +5,43 @@ namespace Dalamud.Bindings.ImGui;
public unsafe partial struct ImDrawList public unsafe partial struct ImDrawList
{ {
public void AddText(Vector2 pos, uint col, [InterpolatedStringHandlerArgument] AutoUtf8Buffer text) public void AddText(Vector2 pos, uint col, AutoUtf8Buffer text)
{ {
fixed (ImDrawList* thisPtr = &this) fixed (ImDrawList* thisPtr = &this) ImGui.AddText(thisPtr, pos, col, text);
ImGui.AddText(thisPtr, pos, col, text);
} }
public void AddText( public void AddText(
ImFontPtr font, float fontSize, Vector2 pos, uint col, [InterpolatedStringHandlerArgument] AutoUtf8Buffer text, float wrapWidth, ImFontPtr font, float fontSize, Vector2 pos, uint col, AutoUtf8Buffer text, float wrapWidth,
scoped in Vector4 cpuFineClipRect) scoped in Vector4 cpuFineClipRect)
{ {
fixed (ImDrawList* thisPtr = &this) fixed (ImDrawList* thisPtr =
ImGui.AddText(thisPtr, font, fontSize, pos, col, text, wrapWidth, cpuFineClipRect); &this) ImGui.AddText(thisPtr, font, fontSize, pos, col, text, wrapWidth, cpuFineClipRect);
} }
public void AddText( public void AddText(
ImFontPtr font, float fontSize, Vector2 pos, uint col, [InterpolatedStringHandlerArgument] AutoUtf8Buffer text, float wrapWidth = 0f) ImFontPtr font, float fontSize, Vector2 pos, uint col, AutoUtf8Buffer text, float wrapWidth = 0f)
{ {
fixed (ImDrawList* thisPtr = &this) fixed (ImDrawList* thisPtr = &this) ImGui.AddText(thisPtr, font, fontSize, pos, col, text, wrapWidth);
ImGui.AddText(thisPtr, font, fontSize, pos, col, text, wrapWidth);
} }
} }
public partial struct ImDrawListPtr public partial struct ImDrawListPtr
{ {
public void AddText(Vector2 pos, uint col, [InterpolatedStringHandlerArgument] AutoUtf8Buffer text) => public void AddText(Vector2 pos, uint col, AutoUtf8Buffer text) => ImGui.AddText(this, pos, col, text);
ImGui.AddText(this, pos, col, text);
public void AddText( public void AddText(
ImFontPtr font, float fontSize, Vector2 pos, uint col, [InterpolatedStringHandlerArgument] AutoUtf8Buffer text, float wrapWidth, ImFontPtr font, float fontSize, Vector2 pos, uint col, AutoUtf8Buffer text, float wrapWidth,
scoped in Vector4 cpuFineClipRect) => scoped in Vector4 cpuFineClipRect) => ImGui.AddText(
ImGui.AddText(this, font, fontSize, pos, col, text, wrapWidth, cpuFineClipRect); this,
font,
fontSize,
pos,
col,
text,
wrapWidth,
cpuFineClipRect);
public void AddText( public void AddText(
ImFontPtr font, float fontSize, Vector2 pos, uint col, [InterpolatedStringHandlerArgument] AutoUtf8Buffer text, float wrapWidth = 0f) => ImFontPtr font, float fontSize, Vector2 pos, uint col, AutoUtf8Buffer text, float wrapWidth = 0f) =>
ImGui.AddText(this, font, fontSize, pos, col, text, wrapWidth); ImGui.AddText(this, font, fontSize, pos, col, text, wrapWidth);
} }

View file

@ -5,29 +5,35 @@ namespace Dalamud.Bindings.ImGui;
public unsafe partial struct ImFont public unsafe partial struct ImFont
{ {
public readonly int CalcWordWrapPositionA( public readonly int CalcWordWrapPositionA(float scale, ReadOnlySpan<byte> text, float wrapWidth)
float scale, ReadOnlySpan<byte> text, float wrapWidth)
{ {
fixed (ImFont* thisPtr = &this) fixed (ImFont* thisPtr = &this) return ImGui.CalcWordWrapPositionA(thisPtr, scale, text, wrapWidth);
return ImGui.CalcWordWrapPositionA(thisPtr, scale, text, wrapWidth);
} }
public readonly void RenderText( public readonly void RenderText(
ImDrawListPtr drawList, float size, Vector2 pos, uint col, Vector4 clipRect, ImDrawListPtr drawList, float size, Vector2 pos, uint col, Vector4 clipRect, AutoUtf8Buffer text,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer text, float wrapWidth = 0.0f, bool cpuFineClip = false) float wrapWidth = 0.0f, bool cpuFineClip = false)
{ {
fixed (ImFont* thisPtr = &this) fixed (ImFont* thisPtr =
ImGui.RenderText(thisPtr, drawList, size, pos, col, clipRect, text, wrapWidth, cpuFineClip); &this) ImGui.RenderText(thisPtr, drawList, size, pos, col, clipRect, text, wrapWidth, cpuFineClip);
} }
} }
public partial struct ImFontPtr public partial struct ImFontPtr
{ {
public readonly int CalcWordWrapPositionA(float scale, [InterpolatedStringHandlerArgument] AutoUtf8Buffer text, float wrapWidth) => public readonly int CalcWordWrapPositionA(float scale, AutoUtf8Buffer text, float wrapWidth) =>
ImGui.CalcWordWrapPositionA(this, scale, text, wrapWidth); ImGui.CalcWordWrapPositionA(this, scale, text, wrapWidth);
public readonly void RenderText( public readonly void RenderText(
ImDrawListPtr drawList, float size, Vector2 pos, uint col, Vector4 clipRect, [InterpolatedStringHandlerArgument] AutoUtf8Buffer text, ImDrawListPtr drawList, float size, Vector2 pos, uint col, Vector4 clipRect, AutoUtf8Buffer text,
float wrapWidth = 0.0f, bool cpuFineClip = false) => float wrapWidth = 0.0f, bool cpuFineClip = false) => ImGui.RenderText(
ImGui.RenderText(this, drawList, size, pos, col, clipRect, text, wrapWidth, cpuFineClip); this,
drawList,
size,
pos,
col,
clipRect,
text,
wrapWidth,
cpuFineClip);
} }

View file

@ -4,14 +4,13 @@ namespace Dalamud.Bindings.ImGui;
public unsafe partial struct ImFontGlyphRangesBuilder public unsafe partial struct ImFontGlyphRangesBuilder
{ {
public void AddText([InterpolatedStringHandlerArgument] AutoUtf8Buffer text) public void AddText(AutoUtf8Buffer text)
{ {
fixed (ImFontGlyphRangesBuilder* thisPtr = &this) fixed (ImFontGlyphRangesBuilder* thisPtr = &this) ImGui.AddText(thisPtr, text);
ImGui.AddText(thisPtr, text);
} }
} }
public partial struct ImFontGlyphRangesBuilderPtr public partial struct ImFontGlyphRangesBuilderPtr
{ {
public void AddText([InterpolatedStringHandlerArgument] AutoUtf8Buffer text) => ImGui.AddText(this, text); public void AddText(AutoUtf8Buffer text) => ImGui.AddText(this, text);
} }

View file

@ -8,7 +8,7 @@ namespace Dalamud.Bindings.ImGui;
public static unsafe partial class ImGui public static unsafe partial class ImGui
{ {
public static bool ColorEdit3( public static bool ColorEdit3(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref Vector3 col, ImGuiColorEditFlags flags = ImGuiColorEditFlags.None) AutoUtf8Buffer label, scoped ref Vector3 col, ImGuiColorEditFlags flags = ImGuiColorEditFlags.None)
{ {
fixed (byte* labelPtr = label.NullTerminatedSpan) fixed (byte* labelPtr = label.NullTerminatedSpan)
fixed (Vector3* colPtr = &col) fixed (Vector3* colPtr = &col)
@ -20,7 +20,7 @@ public static unsafe partial class ImGui
} }
public static bool ColorEdit4( public static bool ColorEdit4(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref Vector4 col, ImGuiColorEditFlags flags = ImGuiColorEditFlags.None) AutoUtf8Buffer label, scoped ref Vector4 col, ImGuiColorEditFlags flags = ImGuiColorEditFlags.None)
{ {
fixed (byte* labelPtr = label.NullTerminatedSpan) fixed (byte* labelPtr = label.NullTerminatedSpan)
fixed (Vector4* colPtr = &col) fixed (Vector4* colPtr = &col)
@ -32,7 +32,7 @@ public static unsafe partial class ImGui
} }
public static bool ColorPicker3( public static bool ColorPicker3(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref Vector3 col, ImGuiColorEditFlags flags = ImGuiColorEditFlags.None) AutoUtf8Buffer label, scoped ref Vector3 col, ImGuiColorEditFlags flags = ImGuiColorEditFlags.None)
{ {
fixed (byte* labelPtr = label.NullTerminatedSpan) fixed (byte* labelPtr = label.NullTerminatedSpan)
fixed (Vector3* colPtr = &col) fixed (Vector3* colPtr = &col)
@ -44,7 +44,7 @@ public static unsafe partial class ImGui
} }
public static bool ColorPicker4( public static bool ColorPicker4(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref Vector4 col, ImGuiColorEditFlags flags = ImGuiColorEditFlags.None) AutoUtf8Buffer label, scoped ref Vector4 col, ImGuiColorEditFlags flags = ImGuiColorEditFlags.None)
{ {
fixed (byte* labelPtr = label.NullTerminatedSpan) fixed (byte* labelPtr = label.NullTerminatedSpan)
fixed (Vector4* colPtr = &col) fixed (Vector4* colPtr = &col)
@ -56,7 +56,7 @@ public static unsafe partial class ImGui
} }
public static bool ColorPicker4( public static bool ColorPicker4(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref Vector4 col, ImGuiColorEditFlags flags, scoped in Vector4 refCol) AutoUtf8Buffer label, scoped ref Vector4 col, ImGuiColorEditFlags flags, scoped in Vector4 refCol)
{ {
fixed (byte* labelPtr = label.NullTerminatedSpan) fixed (byte* labelPtr = label.NullTerminatedSpan)
fixed (Vector4* colPtr = &col) fixed (Vector4* colPtr = &col)
@ -68,7 +68,7 @@ public static unsafe partial class ImGui
} }
} }
public static bool ColorPicker4([InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref Vector4 col, scoped in Vector4 refCol) public static bool ColorPicker4(AutoUtf8Buffer label, scoped ref Vector4 col, scoped in Vector4 refCol)
{ {
fixed (byte* labelPtr = label.NullTerminatedSpan) fixed (byte* labelPtr = label.NullTerminatedSpan)
fixed (Vector4* colPtr = &col) fixed (Vector4* colPtr = &col)

View file

@ -9,148 +9,299 @@ namespace Dalamud.Bindings.ImGui;
public static unsafe partial class ImGui public static unsafe partial class ImGui
{ {
public static bool DragSByte( public static bool DragSByte(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref sbyte v, float vSpeed = 1.0f, sbyte vMin = 0, sbyte vMax = 0, AutoUtf8Buffer label, scoped ref sbyte v, float vSpeed = 1.0f, sbyte vMin = 0, sbyte vMax = 0,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => DragScalar(
DragScalar(label, ImGuiDataType.S8, ref v, vSpeed, vMin, vMax, format.MoveOrDefault("%hhd"u8), flags); label,
ImGuiDataType.S8,
ref v,
vSpeed,
vMin,
vMax,
format.MoveOrDefault("%hhd"u8),
flags);
public static bool DragSByte( public static bool DragSByte(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Span<sbyte> v, float vSpeed = 1.0f, sbyte vMin = 0, sbyte vMax = 0, AutoUtf8Buffer label, Span<sbyte> v, float vSpeed = 1.0f, sbyte vMin = 0, sbyte vMax = 0,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => DragScalar(
DragScalar(label, ImGuiDataType.S8, v, vSpeed, vMin, vMax, format.MoveOrDefault("%hhd"u8), flags); label,
ImGuiDataType.S8,
v,
vSpeed,
vMin,
vMax,
format.MoveOrDefault("%hhd"u8),
flags);
public static bool DragByte( public static bool DragByte(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref byte v, float vSpeed = 1.0f, byte vMin = 0, byte vMax = 0, AutoUtf8Buffer label, scoped ref byte v, float vSpeed = 1.0f, byte vMin = 0, byte vMax = 0,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => DragScalar(
DragScalar(label, ImGuiDataType.U8, ref v, vSpeed, vMin, vMax, format.MoveOrDefault("%hhu"u8), flags); label,
ImGuiDataType.U8,
ref v,
vSpeed,
vMin,
vMax,
format.MoveOrDefault("%hhu"u8),
flags);
public static bool DragByte( public static bool DragByte(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Span<byte> v, float vSpeed = 1.0f, byte vMin = 0, byte vMax = 0, AutoUtf8Buffer label, Span<byte> v, float vSpeed = 1.0f, byte vMin = 0, byte vMax = 0,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => DragScalar(
DragScalar(label, ImGuiDataType.U8, v, vSpeed, vMin, vMax, format.MoveOrDefault("%hhu"u8), flags); label,
ImGuiDataType.U8,
v,
vSpeed,
vMin,
vMax,
format.MoveOrDefault("%hhu"u8),
flags);
public static bool DragShort( public static bool DragShort(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref short v, float vSpeed = 1.0f, short vMin = 0, short vMax = 0, AutoUtf8Buffer label, scoped ref short v, float vSpeed = 1.0f, short vMin = 0, short vMax = 0,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => DragScalar(
DragScalar(label, ImGuiDataType.S16, ref v, vSpeed, vMin, vMax, format.MoveOrDefault("%hd"u8), flags); label,
ImGuiDataType.S16,
ref v,
vSpeed,
vMin,
vMax,
format.MoveOrDefault("%hd"u8),
flags);
public static bool DragShort( public static bool DragShort(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Span<short> v, float vSpeed = 1.0f, short vMin = 0, short vMax = 0, AutoUtf8Buffer label, Span<short> v, float vSpeed = 1.0f, short vMin = 0, short vMax = 0,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => DragScalar(
DragScalar(label, ImGuiDataType.S16, v, vSpeed, vMin, vMax, format.MoveOrDefault("%hd"u8), flags); label,
ImGuiDataType.S16,
v,
vSpeed,
vMin,
vMax,
format.MoveOrDefault("%hd"u8),
flags);
public static bool DragUShort( public static bool DragUShort(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref ushort v, float vSpeed = 1.0f, ushort vMin = 0, ushort vMax = 0, AutoUtf8Buffer label, scoped ref ushort v, float vSpeed = 1.0f, ushort vMin = 0, ushort vMax = 0,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => DragScalar(
DragScalar(label, ImGuiDataType.U16, ref v, vSpeed, vMin, vMax, format.MoveOrDefault("%hu"u8), flags); label,
ImGuiDataType.U16,
ref v,
vSpeed,
vMin,
vMax,
format.MoveOrDefault("%hu"u8),
flags);
public static bool DragUShort( public static bool DragUShort(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Span<ushort> v, float vSpeed = 1.0f, ushort vMin = 0, ushort vMax = 0, AutoUtf8Buffer label, Span<ushort> v, float vSpeed = 1.0f, ushort vMin = 0, ushort vMax = 0,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => DragScalar(
DragScalar(label, ImGuiDataType.U16, v, vSpeed, vMin, vMax, format.MoveOrDefault("%hu"u8), flags); label,
ImGuiDataType.U16,
v,
vSpeed,
vMin,
vMax,
format.MoveOrDefault("%hu"u8),
flags);
public static bool DragInt( public static bool DragInt(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref int v, float vSpeed = 1.0f, int vMin = 0, int vMax = 0, AutoUtf8Buffer label, scoped ref int v, float vSpeed = 1.0f, int vMin = 0, int vMax = 0,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => DragScalar(
DragScalar(label, ImGuiDataType.S32, ref v, vSpeed, vMin, vMax, format.MoveOrDefault("%d"u8), flags); label,
ImGuiDataType.S32,
ref v,
vSpeed,
vMin,
vMax,
format.MoveOrDefault("%d"u8),
flags);
public static bool DragInt( public static bool DragInt(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Span<int> v, float vSpeed = 1.0f, int vMin = 0, int vMax = 0, AutoUtf8Buffer label, Span<int> v, float vSpeed = 1.0f, int vMin = 0,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => int vMax = 0, AutoUtf8Buffer format = default,
DragScalar(label, ImGuiDataType.S32, v, vSpeed, vMin, vMax, format.MoveOrDefault("%d"u8), flags); ImGuiSliderFlags flags = ImGuiSliderFlags.None) => DragScalar(
label,
ImGuiDataType.S32,
v,
vSpeed,
vMin,
vMax,
format.MoveOrDefault("%d"u8),
flags);
public static bool DragUInt( public static bool DragUInt(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref uint v, float vSpeed = 1.0f, uint vMin = 0, uint vMax = 0, AutoUtf8Buffer label, scoped ref uint v, float vSpeed = 1.0f, uint vMin = 0,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => uint vMax = 0, AutoUtf8Buffer format = default,
DragScalar(label, ImGuiDataType.U32, ref v, vSpeed, vMin, vMax, format.MoveOrDefault("%u"u8), flags); ImGuiSliderFlags flags = ImGuiSliderFlags.None) => DragScalar(
label,
ImGuiDataType.U32,
ref v,
vSpeed,
vMin,
vMax,
format.MoveOrDefault("%u"u8),
flags);
public static bool DragUInt( public static bool DragUInt(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Span<uint> v, float vSpeed = 1.0f, uint vMin = 0, uint vMax = 0, AutoUtf8Buffer label, Span<uint> v, float vSpeed = 1.0f, uint vMin = 0,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => uint vMax = 0, AutoUtf8Buffer format = default,
DragScalar(label, ImGuiDataType.U32, v, vSpeed, vMin, vMax, format.MoveOrDefault("%u"u8), flags); ImGuiSliderFlags flags = ImGuiSliderFlags.None) => DragScalar(
label,
ImGuiDataType.U32,
v,
vSpeed,
vMin,
vMax,
format.MoveOrDefault("%u"u8),
flags);
public static bool DragLong( public static bool DragLong(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref long v, float vSpeed = 1.0f, long vMin = 0, long vMax = 0, AutoUtf8Buffer label, scoped ref long v, float vSpeed = 1.0f, long vMin = 0,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => long vMax = 0, AutoUtf8Buffer format = default,
DragScalar(label, ImGuiDataType.S64, ref v, vSpeed, vMin, vMax, format.MoveOrDefault("%I64d"u8), flags); ImGuiSliderFlags flags = ImGuiSliderFlags.None) => DragScalar(
label,
ImGuiDataType.S64,
ref v,
vSpeed,
vMin,
vMax,
format.MoveOrDefault("%I64d"u8),
flags);
public static bool DragLong( public static bool DragLong(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Span<long> v, float vSpeed = 1.0f, long vMin = 0, long vMax = 0, AutoUtf8Buffer label, Span<long> v, float vSpeed = 1.0f, long vMin = 0,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => long vMax = 0, AutoUtf8Buffer format = default,
DragScalar(label, ImGuiDataType.S64, v, vSpeed, vMin, vMax, format.MoveOrDefault("%I64d"u8), flags); ImGuiSliderFlags flags = ImGuiSliderFlags.None) => DragScalar(
label,
ImGuiDataType.S64,
v,
vSpeed,
vMin,
vMax,
format.MoveOrDefault("%I64d"u8),
flags);
public static bool DragULong( public static bool DragULong(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref ulong v, float vSpeed = 1.0f, ulong vMin = 0, ulong vMax = 0, AutoUtf8Buffer label, scoped ref ulong v, float vSpeed = 1.0f,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => ulong vMin = 0, ulong vMax = 0, AutoUtf8Buffer format = default,
DragScalar(label, ImGuiDataType.U64, ref v, vSpeed, vMin, vMax, format.MoveOrDefault("%I64u"u8), flags); ImGuiSliderFlags flags = ImGuiSliderFlags.None) => DragScalar(
label,
ImGuiDataType.U64,
ref v,
vSpeed,
vMin,
vMax,
format.MoveOrDefault("%I64u"u8),
flags);
public static bool DragULong( public static bool DragULong(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Span<ulong> v, float vSpeed = 1.0f, ulong vMin = 0, ulong vMax = 0, AutoUtf8Buffer label, Span<ulong> v, float vSpeed = 1.0f, ulong vMin = 0,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => ulong vMax = 0, AutoUtf8Buffer format = default,
DragScalar(label, ImGuiDataType.U64, v, vSpeed, vMin, vMax, format.MoveOrDefault("%I64u"u8), flags); ImGuiSliderFlags flags = ImGuiSliderFlags.None) => DragScalar(
label,
ImGuiDataType.U64,
v,
vSpeed,
vMin,
vMax,
format.MoveOrDefault("%I64u"u8),
flags);
public static bool DragFloat( public static bool DragFloat(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref float v, float vSpeed = 1.0f, float vMin = 0.0f, float vMax = 0.0f, AutoUtf8Buffer label, scoped ref float v, float vSpeed = 1.0f,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => float vMin = 0.0f, float vMax = 0.0f, AutoUtf8Buffer format = default,
DragScalar(label, ImGuiDataType.Float, ref v, vSpeed, vMin, vMax, format.MoveOrDefault("%.3f"u8), flags); ImGuiSliderFlags flags = ImGuiSliderFlags.None) => DragScalar(
label,
ImGuiDataType.Float,
ref v,
vSpeed,
vMin,
vMax,
format.MoveOrDefault("%.3f"u8),
flags);
public static bool DragFloat( public static bool DragFloat(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Span<float> v, float vSpeed = 1.0f, float vMin = 0.0f, float vMax = 0.0f, AutoUtf8Buffer label, Span<float> v, float vSpeed = 1.0f, float vMin = 0.0f,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => float vMax = 0.0f, AutoUtf8Buffer format = default,
DragScalar(label, ImGuiDataType.Float, v, vSpeed, vMin, vMax, format.MoveOrDefault("%.3f"u8), flags); ImGuiSliderFlags flags = ImGuiSliderFlags.None) => DragScalar(
label,
ImGuiDataType.Float,
v,
vSpeed,
vMin,
vMax,
format.MoveOrDefault("%.3f"u8),
flags);
public static bool DragFloat2( public static bool DragFloat2(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref Vector2 v, float vSpeed = 1.0f, float vMin = 0.0f, float vMax = 0.0f, AutoUtf8Buffer label, scoped ref Vector2 v, float vSpeed = 1.0f,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => float vMin = 0.0f, float vMax = 0.0f, AutoUtf8Buffer format = default,
DragScalar( ImGuiSliderFlags flags = ImGuiSliderFlags.None) => DragScalar(
label, label,
ImGuiDataType.Float, ImGuiDataType.Float,
MemoryMarshal.Cast<Vector2, float>(new(ref v)), MemoryMarshal.Cast<Vector2, float>(new(ref v)),
vSpeed, vSpeed,
vMin, vMin,
vMax, vMax,
format.MoveOrDefault("%.3f"u8), format.MoveOrDefault("%.3f"u8),
flags); flags);
public static bool DragFloat3( public static bool DragFloat3(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref Vector3 v, float vSpeed = 1.0f, float vMin = 0.0f, float vMax = 0.0f, AutoUtf8Buffer label, scoped ref Vector3 v, float vSpeed = 1.0f,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => float vMin = 0.0f, float vMax = 0.0f, AutoUtf8Buffer format = default,
DragScalar( ImGuiSliderFlags flags = ImGuiSliderFlags.None) => DragScalar(
label, label,
ImGuiDataType.Float, ImGuiDataType.Float,
MemoryMarshal.Cast<Vector3, float>(new(ref v)), MemoryMarshal.Cast<Vector3, float>(new(ref v)),
vSpeed, vSpeed,
vMin, vMin,
vMax, vMax,
format.MoveOrDefault("%.3f"u8), format.MoveOrDefault("%.3f"u8),
flags); flags);
public static bool DragFloat4( public static bool DragFloat4(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref Vector4 v, float vSpeed = 1.0f, float vMin = 0.0f, float vMax = 0.0f, AutoUtf8Buffer label, scoped ref Vector4 v, float vSpeed = 1.0f,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => float vMin = 0.0f, float vMax = 0.0f, AutoUtf8Buffer format = default,
DragScalar( ImGuiSliderFlags flags = ImGuiSliderFlags.None) => DragScalar(
label, label,
ImGuiDataType.Float, ImGuiDataType.Float,
MemoryMarshal.Cast<Vector4, float>(new(ref v)), MemoryMarshal.Cast<Vector4, float>(new(ref v)),
vSpeed, vSpeed,
vMin, vMin,
vMax, vMax,
format.MoveOrDefault("%.3f"u8), format.MoveOrDefault("%.3f"u8),
flags); flags);
public static bool DragDouble( public static bool DragDouble(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref double v, float vSpeed = 1.0f, double vMin = 0.0f, double vMax = 0.0f, AutoUtf8Buffer label, scoped ref double v, float vSpeed = 1.0f,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => double vMin = 0.0f, double vMax = 0.0f, AutoUtf8Buffer format = default,
DragScalar(label, ImGuiDataType.Double, ref v, vSpeed, vMin, vMax, format.MoveOrDefault("%.3f"u8), flags); ImGuiSliderFlags flags = ImGuiSliderFlags.None) => DragScalar(
label,
ImGuiDataType.Double,
ref v,
vSpeed,
vMin,
vMax,
format.MoveOrDefault("%.3f"u8),
flags);
public static bool DragDouble( public static bool DragDouble(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Span<double> v, float vSpeed = 1.0f, double vMin = 0.0f, double vMax = 0.0f, AutoUtf8Buffer label, Span<double> v, float vSpeed = 1.0f,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => double vMin = 0.0f, double vMax = 0.0f, AutoUtf8Buffer format = default,
DragScalar(label, ImGuiDataType.Double, v, vSpeed, vMin, vMax, format.MoveOrDefault("%.3f"u8), flags); ImGuiSliderFlags flags = ImGuiSliderFlags.None) => DragScalar(
label,
ImGuiDataType.Double,
v,
vSpeed,
vMin,
vMax,
format.MoveOrDefault("%.3f"u8),
flags);
public static bool DragScalar<T>( public static bool DragScalar<T>(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, ImGuiDataType dataType, scoped ref T v, float vSpeed, scoped in T vMin, scoped in T vMax, AutoUtf8Buffer label, ImGuiDataType dataType, scoped ref T v, float vSpeed,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) scoped in T vMin, scoped in T vMax, AutoUtf8Buffer format = default,
where T : unmanaged, INumber<T>, IBinaryNumber<T> ImGuiSliderFlags flags = ImGuiSliderFlags.None) where T : unmanaged, INumber<T>, IBinaryNumber<T>
{ {
fixed (byte* labelPtr = label.NullTerminatedSpan) fixed (byte* labelPtr = label.NullTerminatedSpan)
fixed (byte* formatPtr = format.IsInitialized ? format.NullTerminatedSpan : null) fixed (byte* formatPtr = format.IsInitialized ? format.NullTerminatedSpan : null)
@ -158,15 +309,7 @@ public static unsafe partial class ImGui
fixed (T* vMinPtr = &vMin) fixed (T* vMinPtr = &vMin)
fixed (T* vMaxPtr = &vMax) fixed (T* vMaxPtr = &vMax)
{ {
var res = ImGuiNative.DragScalar( var res = ImGuiNative.DragScalar(labelPtr, dataType, vPtr, vSpeed, vMinPtr, vMaxPtr, formatPtr, flags) != 0;
labelPtr,
dataType,
vPtr,
vSpeed,
vMinPtr,
vMaxPtr,
formatPtr,
flags) != 0;
label.Dispose(); label.Dispose();
format.Dispose(); format.Dispose();
return res; return res;
@ -174,9 +317,9 @@ public static unsafe partial class ImGui
} }
public static bool DragScalar<T>( public static bool DragScalar<T>(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, ImGuiDataType dataType, Span<T> v, float vSpeed, scoped in T vMin, scoped in T vMax, AutoUtf8Buffer label, ImGuiDataType dataType, Span<T> v, float vSpeed,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) scoped in T vMin, scoped in T vMax, AutoUtf8Buffer format = default,
where T : unmanaged, INumber<T>, IBinaryNumber<T> ImGuiSliderFlags flags = ImGuiSliderFlags.None) where T : unmanaged, INumber<T>, IBinaryNumber<T>
{ {
fixed (byte* labelPtr = label.NullTerminatedSpan) fixed (byte* labelPtr = label.NullTerminatedSpan)
fixed (byte* formatPtr = format.IsInitialized ? format.NullTerminatedSpan : null) fixed (byte* formatPtr = format.IsInitialized ? format.NullTerminatedSpan : null)
@ -201,8 +344,10 @@ public static unsafe partial class ImGui
} }
public static bool DragFloatRange2( public static bool DragFloatRange2(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, ref float vCurrentMin, ref float vCurrentMax, float vSpeed = 1.0f, float vMin = 0.0f, AutoUtf8Buffer label, scoped ref float vCurrentMin,
float vMax = 0.0f, [InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, [InterpolatedStringHandlerArgument] AutoUtf8Buffer formatMax = default, scoped ref float vCurrentMax, float vSpeed = 1.0f, float vMin = 0.0f, float vMax = 0.0f,
AutoUtf8Buffer format = default,
AutoUtf8Buffer formatMax = default,
ImGuiSliderFlags flags = ImGuiSliderFlags.None) ImGuiSliderFlags flags = ImGuiSliderFlags.None)
{ {
fixed (byte* labelPtr = label.NullTerminatedSpan) fixed (byte* labelPtr = label.NullTerminatedSpan)
@ -229,8 +374,10 @@ public static unsafe partial class ImGui
} }
public static bool DragIntRange2( public static bool DragIntRange2(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, ref int vCurrentMin, ref int vCurrentMax, float vSpeed = 1.0f, int vMin = 0, int vMax = 0, AutoUtf8Buffer label, scoped ref int vCurrentMin,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, [InterpolatedStringHandlerArgument] AutoUtf8Buffer formatMax = default, scoped ref int vCurrentMax, float vSpeed = 1.0f, int vMin = 0, int vMax = 0,
AutoUtf8Buffer format = default,
AutoUtf8Buffer formatMax = default,
ImGuiSliderFlags flags = ImGuiSliderFlags.None) ImGuiSliderFlags flags = ImGuiSliderFlags.None)
{ {
fixed (byte* labelPtr = label.NullTerminatedSpan) fixed (byte* labelPtr = label.NullTerminatedSpan)

View file

@ -9,98 +9,200 @@ namespace Dalamud.Bindings.ImGui;
public static unsafe partial class ImGui public static unsafe partial class ImGui
{ {
public static bool InputSByte( public static bool InputSByte(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref sbyte data, sbyte step = 0, sbyte stepFast = 0, AutoUtf8Buffer label, scoped ref sbyte data, sbyte step = 0, sbyte stepFast = 0,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => AutoUtf8Buffer format = default, ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => InputScalar(
InputScalar(label, ImGuiDataType.S8, ref data, step, stepFast, format.MoveOrDefault("%hhd"u8), flags); label,
ImGuiDataType.S8,
ref data,
step,
stepFast,
format.MoveOrDefault("%hhd"u8),
flags);
public static bool InputSByte( public static bool InputSByte(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Span<sbyte> data, sbyte step = 0, sbyte stepFast = 0, AutoUtf8Buffer label, Span<sbyte> data, sbyte step = 0, sbyte stepFast = 0, AutoUtf8Buffer format = default,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => InputScalar(
InputScalar(label, ImGuiDataType.S8, data, step, stepFast, format.MoveOrDefault("%hhd"u8), flags); label,
ImGuiDataType.S8,
data,
step,
stepFast,
format.MoveOrDefault("%hhd"u8),
flags);
public static bool InputByte( public static bool InputByte(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref byte data, byte step = 0, byte stepFast = 0, AutoUtf8Buffer label, scoped ref byte data, byte step = 0, byte stepFast = 0, AutoUtf8Buffer format = default,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => InputScalar(
InputScalar(label, ImGuiDataType.U8, ref data, step, stepFast, format.MoveOrDefault("%hhu"u8), flags); label,
ImGuiDataType.U8,
ref data,
step,
stepFast,
format.MoveOrDefault("%hhu"u8),
flags);
public static bool InputByte( public static bool InputByte(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Span<byte> data, byte step = 0, byte stepFast = 0, AutoUtf8Buffer label, Span<byte> data, byte step = 0, byte stepFast = 0, AutoUtf8Buffer format = default,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => InputScalar(
InputScalar(label, ImGuiDataType.U8, data, step, stepFast, format.MoveOrDefault("%hhu"u8), flags); label,
ImGuiDataType.U8,
data,
step,
stepFast,
format.MoveOrDefault("%hhu"u8),
flags);
public static bool InputShort( public static bool InputShort(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref short data, short step = 0, short stepFast = 0, AutoUtf8Buffer label, scoped ref short data, short step = 0, short stepFast = 0,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => AutoUtf8Buffer format = default, ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => InputScalar(
InputScalar(label, ImGuiDataType.S16, ref data, step, stepFast, format.MoveOrDefault("%hd"u8), flags); label,
ImGuiDataType.S16,
ref data,
step,
stepFast,
format.MoveOrDefault("%hd"u8),
flags);
public static bool InputShort( public static bool InputShort(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Span<short> data, short step = 0, short stepFast = 0, AutoUtf8Buffer label, Span<short> data, short step = 0, short stepFast = 0, AutoUtf8Buffer format = default,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => InputScalar(
InputScalar(label, ImGuiDataType.S16, data, step, stepFast, format.MoveOrDefault("%hd"u8), flags); label,
ImGuiDataType.S16,
data,
step,
stepFast,
format.MoveOrDefault("%hd"u8),
flags);
public static bool InputUShort( public static bool InputUShort(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref ushort data, ushort step = 0, ushort stepFast = 0, AutoUtf8Buffer label, scoped ref ushort data, ushort step = 0, ushort stepFast = 0,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => AutoUtf8Buffer format = default, ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => InputScalar(
InputScalar(label, ImGuiDataType.U16, ref data, step, stepFast, format.MoveOrDefault("%hu"u8), flags); label,
ImGuiDataType.U16,
ref data,
step,
stepFast,
format.MoveOrDefault("%hu"u8),
flags);
public static bool InputUShort( public static bool InputUShort(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Span<ushort> data, ushort step = 0, ushort stepFast = 0, AutoUtf8Buffer label, Span<ushort> data, ushort step = 0, ushort stepFast = 0, AutoUtf8Buffer format = default,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => InputScalar(
InputScalar(label, ImGuiDataType.U16, data, step, stepFast, format.MoveOrDefault("%hu"u8), flags); label,
ImGuiDataType.U16,
data,
step,
stepFast,
format.MoveOrDefault("%hu"u8),
flags);
public static bool InputInt( public static bool InputInt(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref int data, int step = 0, int stepFast = 0, AutoUtf8Buffer label, scoped ref int data, int step = 0, int stepFast = 0, AutoUtf8Buffer format = default,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => InputScalar(
InputScalar(label, ImGuiDataType.S32, ref data, step, stepFast, format.MoveOrDefault("%d"u8), flags); label,
ImGuiDataType.S32,
ref data,
step,
stepFast,
format.MoveOrDefault("%d"u8),
flags);
public static bool InputInt( public static bool InputInt(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Span<int> data, int step = 0, int stepFast = 0, AutoUtf8Buffer label, Span<int> data, int step = 0, int stepFast = 0, AutoUtf8Buffer format = default,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => InputScalar(
InputScalar(label, ImGuiDataType.S32, data, step, stepFast, format.MoveOrDefault("%d"u8), flags); label,
ImGuiDataType.S32,
data,
step,
stepFast,
format.MoveOrDefault("%d"u8),
flags);
public static bool InputUInt( public static bool InputUInt(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref uint data, uint step = 0, uint stepFast = 0, AutoUtf8Buffer label, scoped ref uint data, uint step = 0, uint stepFast = 0, AutoUtf8Buffer format = default,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => InputScalar(
InputScalar(label, ImGuiDataType.U32, ref data, step, stepFast, format.MoveOrDefault("%u"u8), flags); label,
ImGuiDataType.U32,
ref data,
step,
stepFast,
format.MoveOrDefault("%u"u8),
flags);
public static bool InputUInt( public static bool InputUInt(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Span<uint> data, uint step = 0, uint stepFast = 0, AutoUtf8Buffer label, Span<uint> data, uint step = 0, uint stepFast = 0, AutoUtf8Buffer format = default,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => InputScalar(
InputScalar(label, ImGuiDataType.U32, data, step, stepFast, format.MoveOrDefault("%u"u8), flags); label,
ImGuiDataType.U32,
data,
step,
stepFast,
format.MoveOrDefault("%u"u8),
flags);
public static bool InputLong( public static bool InputLong(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref long data, long step = 0, long stepFast = 0, AutoUtf8Buffer label, scoped ref long data, long step = 0, long stepFast = 0, AutoUtf8Buffer format = default,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => InputScalar(
InputScalar(label, ImGuiDataType.S64, ref data, step, stepFast, format.MoveOrDefault("%I64d"u8), flags); label,
ImGuiDataType.S64,
ref data,
step,
stepFast,
format.MoveOrDefault("%I64d"u8),
flags);
public static bool InputLong( public static bool InputLong(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Span<long> data, long step = 0, long stepFast = 0, AutoUtf8Buffer label, Span<long> data, long step = 0, long stepFast = 0, AutoUtf8Buffer format = default,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => InputScalar(
InputScalar(label, ImGuiDataType.S64, data, step, stepFast, format.MoveOrDefault("%I64d"u8), flags); label,
ImGuiDataType.S64,
data,
step,
stepFast,
format.MoveOrDefault("%I64d"u8),
flags);
public static bool InputULong( public static bool InputULong(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref ulong data, ulong step = 0, ulong stepFast = 0, AutoUtf8Buffer label, scoped ref ulong data, ulong step = 0, ulong stepFast = 0,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => AutoUtf8Buffer format = default, ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => InputScalar(
InputScalar(label, ImGuiDataType.U64, ref data, step, stepFast, format.MoveOrDefault("%I64u"u8), flags); label,
ImGuiDataType.U64,
ref data,
step,
stepFast,
format.MoveOrDefault("%I64u"u8),
flags);
public static bool InputULong( public static bool InputULong(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Span<ulong> data, ulong step = 0, ulong stepFast = 0, AutoUtf8Buffer label, Span<ulong> data, ulong step = 0, ulong stepFast = 0, AutoUtf8Buffer format = default,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => InputScalar(
InputScalar(label, ImGuiDataType.U64, data, step, stepFast, format.MoveOrDefault("%I64u"u8), flags); label,
ImGuiDataType.U64,
data,
step,
stepFast,
format.MoveOrDefault("%I64u"u8),
flags);
public static bool InputFloat( public static bool InputFloat(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref float data, float step = 0.0f, float stepFast = 0.0f, AutoUtf8Buffer label, scoped ref float data, float step = 0.0f,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => float stepFast = 0.0f,
AutoUtf8Buffer format = default,
ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) =>
InputScalar(label, ImGuiDataType.Float, ref data, step, stepFast, format.MoveOrDefault("%.3f"u8), flags); InputScalar(label, ImGuiDataType.Float, ref data, step, stepFast, format.MoveOrDefault("%.3f"u8), flags);
public static bool InputFloat( public static bool InputFloat(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Span<float> data, float step = 0.0f, float stepFast = 0.0f, AutoUtf8Buffer label, Span<float> data, float step = 0.0f,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => float stepFast = 0.0f,
AutoUtf8Buffer format = default,
ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) =>
InputScalar(label, ImGuiDataType.Float, data, step, stepFast, format.MoveOrDefault("%.3f"u8), flags); InputScalar(label, ImGuiDataType.Float, data, step, stepFast, format.MoveOrDefault("%.3f"u8), flags);
public static bool InputFloat2( public static bool InputFloat2(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref Vector2 data, float step = 0.0f, float stepFast = 0.0f, AutoUtf8Buffer label, scoped ref Vector2 data, float step = 0.0f,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => float stepFast = 0.0f,
AutoUtf8Buffer format = default,
ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) =>
InputScalar( InputScalar(
label, label,
ImGuiDataType.Float, ImGuiDataType.Float,
@ -111,8 +213,10 @@ public static unsafe partial class ImGui
flags); flags);
public static bool InputFloat3( public static bool InputFloat3(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref Vector3 data, float step = 0.0f, float stepFast = 0.0f, AutoUtf8Buffer label, scoped ref Vector3 data, float step = 0.0f,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => float stepFast = 0.0f,
AutoUtf8Buffer format = default,
ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) =>
InputScalar( InputScalar(
label, label,
ImGuiDataType.Float, ImGuiDataType.Float,
@ -123,8 +227,10 @@ public static unsafe partial class ImGui
flags); flags);
public static bool InputFloat4( public static bool InputFloat4(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref Vector4 data, float step = 0.0f, float stepFast = 0.0f, AutoUtf8Buffer label, scoped ref Vector4 data, float step = 0.0f,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => float stepFast = 0.0f,
AutoUtf8Buffer format = default,
ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) =>
InputScalar( InputScalar(
label, label,
ImGuiDataType.Float, ImGuiDataType.Float,
@ -135,18 +241,24 @@ public static unsafe partial class ImGui
flags); flags);
public static bool InputDouble( public static bool InputDouble(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref double data, double step = 0.0f, double stepFast = 0.0f, AutoUtf8Buffer label, scoped ref double data, double step = 0.0f,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => double stepFast = 0.0f,
AutoUtf8Buffer format = default,
ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) =>
InputScalar(label, ImGuiDataType.Double, ref data, step, stepFast, format.MoveOrDefault("%.3f"u8), flags); InputScalar(label, ImGuiDataType.Double, ref data, step, stepFast, format.MoveOrDefault("%.3f"u8), flags);
public static bool InputDouble( public static bool InputDouble(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Span<double> data, double step = 0.0f, double stepFast = 0.0f, AutoUtf8Buffer label, Span<double> data, double step = 0.0f,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) => double stepFast = 0.0f,
AutoUtf8Buffer format = default,
ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) =>
InputScalar(label, ImGuiDataType.Double, data, step, stepFast, format.MoveOrDefault("%.3f"u8), flags); InputScalar(label, ImGuiDataType.Double, data, step, stepFast, format.MoveOrDefault("%.3f"u8), flags);
public static bool InputScalar<T>( public static bool InputScalar<T>(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, ImGuiDataType dataType, scoped ref T data, scoped in T step, scoped in T stepFast, AutoUtf8Buffer label, ImGuiDataType dataType, scoped ref T data,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) scoped in T step, scoped in T stepFast,
AutoUtf8Buffer format = default,
ImGuiInputTextFlags flags = ImGuiInputTextFlags.None)
where T : unmanaged, IBinaryNumber<T> where T : unmanaged, IBinaryNumber<T>
{ {
fixed (byte* labelPtr = label.NullTerminatedSpan) fixed (byte* labelPtr = label.NullTerminatedSpan)
@ -170,8 +282,10 @@ public static unsafe partial class ImGui
} }
public static bool InputScalar<T>( public static bool InputScalar<T>(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, ImGuiDataType dataType, Span<T> data, scoped in T step, scoped in T stepFast, AutoUtf8Buffer label, ImGuiDataType dataType, Span<T> data,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) scoped in T step, scoped in T stepFast,
AutoUtf8Buffer format = default,
ImGuiInputTextFlags flags = ImGuiInputTextFlags.None)
where T : unmanaged, INumber<T>, IBinaryNumber<T> where T : unmanaged, INumber<T>, IBinaryNumber<T>
{ {
fixed (byte* labelPtr = label.NullTerminatedSpan) fixed (byte* labelPtr = label.NullTerminatedSpan)

View file

@ -9,7 +9,7 @@ namespace Dalamud.Bindings.ImGui;
public static unsafe partial class ImGui public static unsafe partial class ImGui
{ {
public static ImFontPtr AddFontFromFileTTF( public static ImFontPtr AddFontFromFileTTF(
ImFontAtlasPtr self, [InterpolatedStringHandlerArgument] AutoUtf8Buffer filename, float sizePixels, ImFontConfigPtr fontCfg = default, ImFontAtlasPtr self, AutoUtf8Buffer filename, float sizePixels, ImFontConfigPtr fontCfg = default,
ushort* glyphRanges = null) ushort* glyphRanges = null)
{ {
fixed (byte* filenamePtr = filename.NullTerminatedSpan) fixed (byte* filenamePtr = filename.NullTerminatedSpan)
@ -21,7 +21,7 @@ public static unsafe partial class ImGui
} }
public static ImFontPtr AddFontFromMemoryCompressedBase85TTF( public static ImFontPtr AddFontFromMemoryCompressedBase85TTF(
ImFontAtlasPtr self, [InterpolatedStringHandlerArgument] AutoUtf8Buffer compressedFontDatabase85, float sizePixels, ImFontAtlasPtr self, AutoUtf8Buffer compressedFontDatabase85, float sizePixels,
ImFontConfigPtr fontCfg = default, ushort* glyphRanges = null) ImFontConfigPtr fontCfg = default, ushort* glyphRanges = null)
{ {
fixed (byte* compressedFontDatabase85Ptr = compressedFontDatabase85.NullTerminatedSpan) fixed (byte* compressedFontDatabase85Ptr = compressedFontDatabase85.NullTerminatedSpan)
@ -77,20 +77,16 @@ public static unsafe partial class ImGui
public static ref void* GetVoidPtrRef(ImGuiStoragePtr self, uint key, void* defaultValue = null) => public static ref void* GetVoidPtrRef(ImGuiStoragePtr self, uint key, void* defaultValue = null) =>
ref *ImGuiNative.GetVoidPtrRef(self.Handle, key, defaultValue); ref *ImGuiNative.GetVoidPtrRef(self.Handle, key, defaultValue);
public static ref T* GetPtrRef<T>(ImGuiStoragePtr self, uint key, T* defaultValue = null) public static ref T* GetPtrRef<T>(ImGuiStoragePtr self, uint key, T* defaultValue = null) where T : unmanaged =>
where T : unmanaged =>
ref *(T**)ImGuiNative.GetVoidPtrRef(self.Handle, key, defaultValue); ref *(T**)ImGuiNative.GetVoidPtrRef(self.Handle, key, defaultValue);
public static ref T GetRef<T>(ImGuiStoragePtr self, uint key, T defaultValue = default) public static ref T GetRef<T>(ImGuiStoragePtr self, uint key, T defaultValue = default) where T : unmanaged
where T : unmanaged
{ {
if (sizeof(T) > sizeof(void*)) if (sizeof(T) > sizeof(void*)) throw new ArgumentOutOfRangeException(nameof(T), typeof(T), null);
throw new ArgumentOutOfRangeException(nameof(T), typeof(T), null);
return ref *(T*)ImGuiNative.GetVoidPtrRef(self.Handle, key, *(void**)&defaultValue); return ref *(T*)ImGuiNative.GetVoidPtrRef(self.Handle, key, *(void**)&defaultValue);
} }
public static uint GetID([InterpolatedStringHandlerArgument] AutoUtf8Buffer strId) public static uint GetID(AutoUtf8Buffer strId)
{ {
fixed (byte* strIdPtr = strId.Span) fixed (byte* strIdPtr = strId.Span)
{ {
@ -101,12 +97,10 @@ public static unsafe partial class ImGui
} }
public static uint GetID(nint ptrId) => ImGuiNative.GetID((void*)ptrId); public static uint GetID(nint ptrId) => ImGuiNative.GetID((void*)ptrId);
public static uint GetID(nuint ptrId) => ImGuiNative.GetID((void*)ptrId); public static uint GetID(nuint ptrId) => ImGuiNative.GetID((void*)ptrId);
public static uint GetID(void* ptrId) => ImGuiNative.GetID(ptrId); public static uint GetID(void* ptrId) => ImGuiNative.GetID(ptrId);
public static void PushID([InterpolatedStringHandlerArgument] AutoUtf8Buffer strId) public static void PushID(AutoUtf8Buffer strId)
{ {
fixed (byte* strIdPtr = strId.Span) fixed (byte* strIdPtr = strId.Span)
{ {
@ -116,11 +110,11 @@ public static unsafe partial class ImGui
} }
public static void PushID(nint ptrId) => ImGuiNative.PushID((void*)ptrId); public static void PushID(nint ptrId) => ImGuiNative.PushID((void*)ptrId);
public static void PushID(nuint ptrId) => ImGuiNative.PushID((void*)ptrId); public static void PushID(nuint ptrId) => ImGuiNative.PushID((void*)ptrId);
public static void PushID(void* ptrId) => ImGuiNative.PushID(ptrId); public static void PushID(void* ptrId) =>
ImGuiNative.PushID(ptrId);
}
// DISCARDED: PlotHistogram // DISCARDED: PlotHistogram
// DISCARDED: PlotLines // DISCARDED: PlotLines
}

View file

@ -9,110 +9,217 @@ namespace Dalamud.Bindings.ImGui;
public static unsafe partial class ImGui public static unsafe partial class ImGui
{ {
public static bool SliderSByte( public static bool SliderSByte(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref sbyte v, sbyte vMin = 0, sbyte vMax = 0, AutoUtf8Buffer label, scoped ref sbyte v, sbyte vMin = 0, sbyte vMax = 0, AutoUtf8Buffer format = default,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => ImGuiSliderFlags flags = ImGuiSliderFlags.None) => SliderScalar(
SliderScalar(label, ImGuiDataType.S8, ref v, vMin, vMax, format.MoveOrDefault("%hhd"u8), flags); label,
ImGuiDataType.S8,
ref v,
vMin,
vMax,
format.MoveOrDefault("%hhd"u8),
flags);
public static bool SliderSByte( public static bool SliderSByte(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Span<sbyte> v, sbyte vMin = 0, sbyte vMax = 0, AutoUtf8Buffer label, Span<sbyte> v, sbyte vMin = 0, sbyte vMax = 0, AutoUtf8Buffer format = default,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => ImGuiSliderFlags flags = ImGuiSliderFlags.None) => SliderScalar(
SliderScalar(label, ImGuiDataType.S8, v, vMin, vMax, format.MoveOrDefault("%hhd"u8), flags); label,
ImGuiDataType.S8,
v,
vMin,
vMax,
format.MoveOrDefault("%hhd"u8),
flags);
public static bool SliderByte( public static bool SliderByte(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref byte v, byte vMin = 0, byte vMax = 0, AutoUtf8Buffer label, scoped ref byte v, byte vMin = 0, byte vMax = 0, AutoUtf8Buffer format = default,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => ImGuiSliderFlags flags = ImGuiSliderFlags.None) => SliderScalar(
SliderScalar(label, ImGuiDataType.U8, ref v, vMin, vMax, format.MoveOrDefault("%hhu"u8), flags); label,
ImGuiDataType.U8,
ref v,
vMin,
vMax,
format.MoveOrDefault("%hhu"u8),
flags);
public static bool SliderByte( public static bool SliderByte(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Span<byte> v, byte vMin = 0, byte vMax = 0, AutoUtf8Buffer label, Span<byte> v, byte vMin = 0, byte vMax = 0, AutoUtf8Buffer format = default,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => ImGuiSliderFlags flags = ImGuiSliderFlags.None) => SliderScalar(
SliderScalar(label, ImGuiDataType.U8, v, vMin, vMax, format.MoveOrDefault("%hhu"u8), flags); label,
ImGuiDataType.U8,
v,
vMin,
vMax,
format.MoveOrDefault("%hhu"u8),
flags);
public static bool SliderShort( public static bool SliderShort(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref short v, short vMin = 0, short vMax = 0, AutoUtf8Buffer label, scoped ref short v, short vMin = 0, short vMax = 0, AutoUtf8Buffer format = default,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => ImGuiSliderFlags flags = ImGuiSliderFlags.None) => SliderScalar(
SliderScalar(label, ImGuiDataType.S16, ref v, vMin, vMax, format.MoveOrDefault("%hd"u8), flags); label,
ImGuiDataType.S16,
ref v,
vMin,
vMax,
format.MoveOrDefault("%hd"u8),
flags);
public static bool SliderShort( public static bool SliderShort(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Span<short> v, short vMin = 0, short vMax = 0, AutoUtf8Buffer label, Span<short> v, short vMin = 0, short vMax = 0, AutoUtf8Buffer format = default,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => ImGuiSliderFlags flags = ImGuiSliderFlags.None) => SliderScalar(
SliderScalar(label, ImGuiDataType.S16, v, vMin, vMax, format.MoveOrDefault("%hd"u8), flags); label,
ImGuiDataType.S16,
v,
vMin,
vMax,
format.MoveOrDefault("%hd"u8),
flags);
public static bool SliderUShort( public static bool SliderUShort(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref ushort v, ushort vMin = 0, ushort vMax = 0, AutoUtf8Buffer label, scoped ref ushort v, ushort vMin = 0, ushort vMax = 0, AutoUtf8Buffer format = default,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => ImGuiSliderFlags flags = ImGuiSliderFlags.None) => SliderScalar(
SliderScalar(label, ImGuiDataType.U16, ref v, vMin, vMax, format.MoveOrDefault("%hu"u8), flags); label,
ImGuiDataType.U16,
ref v,
vMin,
vMax,
format.MoveOrDefault("%hu"u8),
flags);
public static bool SliderUShort( public static bool SliderUShort(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Span<ushort> v, ushort vMin = 0, ushort vMax = 0, AutoUtf8Buffer label, Span<ushort> v, ushort vMin = 0, ushort vMax = 0, AutoUtf8Buffer format = default,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => ImGuiSliderFlags flags = ImGuiSliderFlags.None) => SliderScalar(
SliderScalar(label, ImGuiDataType.U16, v, vMin, vMax, format.MoveOrDefault("%hu"u8), flags); label,
ImGuiDataType.U16,
v,
vMin,
vMax,
format.MoveOrDefault("%hu"u8),
flags);
public static bool SliderInt( public static bool SliderInt(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref int v, int vMin = 0, int vMax = 0, AutoUtf8Buffer label, scoped ref int v, int vMin = 0, int vMax = 0, AutoUtf8Buffer format = default,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => ImGuiSliderFlags flags = ImGuiSliderFlags.None) => SliderScalar(
SliderScalar(label, ImGuiDataType.S32, ref v, vMin, vMax, format.MoveOrDefault("%d"u8), flags); label,
ImGuiDataType.S32,
ref v,
vMin,
vMax,
format.MoveOrDefault("%d"u8),
flags);
public static bool SliderInt( public static bool SliderInt(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Span<int> v, int vMin = 0, int vMax = 0, AutoUtf8Buffer label, Span<int> v, int vMin = 0, int vMax = 0, AutoUtf8Buffer format = default,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => ImGuiSliderFlags flags = ImGuiSliderFlags.None) => SliderScalar(
SliderScalar(label, ImGuiDataType.S32, v, vMin, vMax, format.MoveOrDefault("%d"u8), flags); label,
ImGuiDataType.S32,
v,
vMin,
vMax,
format.MoveOrDefault("%d"u8),
flags);
public static bool SliderUInt( public static bool SliderUInt(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref uint v, uint vMin = 0, uint vMax = 0, AutoUtf8Buffer label, scoped ref uint v, uint vMin = 0, uint vMax = 0, AutoUtf8Buffer format = default,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => ImGuiSliderFlags flags = ImGuiSliderFlags.None) => SliderScalar(
SliderScalar(label, ImGuiDataType.U32, ref v, vMin, vMax, format.MoveOrDefault("%u"u8), flags); label,
ImGuiDataType.U32,
ref v,
vMin,
vMax,
format.MoveOrDefault("%u"u8),
flags);
public static bool SliderUInt( public static bool SliderUInt(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Span<uint> v, uint vMin = 0, uint vMax = 0, AutoUtf8Buffer label, Span<uint> v, uint vMin = 0, uint vMax = 0, AutoUtf8Buffer format = default,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => ImGuiSliderFlags flags = ImGuiSliderFlags.None) => SliderScalar(
SliderScalar(label, ImGuiDataType.U32, v, vMin, vMax, format.MoveOrDefault("%u"u8), flags); label,
ImGuiDataType.U32,
v,
vMin,
vMax,
format.MoveOrDefault("%u"u8),
flags);
public static bool SliderLong( public static bool SliderLong(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref long v, long vMin = 0, long vMax = 0, AutoUtf8Buffer label, scoped ref long v, long vMin = 0, long vMax = 0, AutoUtf8Buffer format = default,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => ImGuiSliderFlags flags = ImGuiSliderFlags.None) => SliderScalar(
SliderScalar(label, ImGuiDataType.S64, ref v, vMin, vMax, format.MoveOrDefault("%I64d"u8), flags); label,
ImGuiDataType.S64,
ref v,
vMin,
vMax,
format.MoveOrDefault("%I64d"u8),
flags);
public static bool SliderLong( public static bool SliderLong(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Span<long> v, long vMin = 0, long vMax = 0, AutoUtf8Buffer label, Span<long> v, long vMin = 0, long vMax = 0, AutoUtf8Buffer format = default,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => ImGuiSliderFlags flags = ImGuiSliderFlags.None) => SliderScalar(
SliderScalar(label, ImGuiDataType.S64, v, vMin, vMax, format.MoveOrDefault("%I64d"u8), flags); label,
ImGuiDataType.S64,
v,
vMin,
vMax,
format.MoveOrDefault("%I64d"u8),
flags);
public static bool SliderULong( public static bool SliderULong(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref ulong v, ulong vMin = 0, ulong vMax = 0, AutoUtf8Buffer label, scoped ref ulong v, ulong vMin = 0, ulong vMax = 0, AutoUtf8Buffer format = default,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => ImGuiSliderFlags flags = ImGuiSliderFlags.None) => SliderScalar(
SliderScalar(label, ImGuiDataType.U64, ref v, vMin, vMax, format.MoveOrDefault("%I64u"u8), flags); label,
ImGuiDataType.U64,
ref v,
vMin,
vMax,
format.MoveOrDefault("%I64u"u8),
flags);
public static bool SliderULong( public static bool SliderULong(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Span<ulong> v, ulong vMin = 0, ulong vMax = 0, AutoUtf8Buffer label, Span<ulong> v, ulong vMin = 0, ulong vMax = 0, AutoUtf8Buffer format = default,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => ImGuiSliderFlags flags = ImGuiSliderFlags.None) => SliderScalar(
SliderScalar(label, ImGuiDataType.U64, v, vMin, vMax, format.MoveOrDefault("%I64u"u8), flags); label,
ImGuiDataType.U64,
v,
vMin,
vMax,
format.MoveOrDefault("%I64u"u8),
flags);
public static bool SliderFloat( public static bool SliderFloat(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref float v, float vMin = 0.0f, float vMax = 0.0f, AutoUtf8Buffer label, scoped ref float v, float vMin = 0.0f, float vMax = 0.0f, AutoUtf8Buffer format = default,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => ImGuiSliderFlags flags = ImGuiSliderFlags.None) => SliderScalar(
SliderScalar(label, ImGuiDataType.Float, ref v, vMin, vMax, format.MoveOrDefault("%.3f"u8), flags); label,
ImGuiDataType.Float,
ref v,
vMin,
vMax,
format.MoveOrDefault("%.3f"u8),
flags);
public static bool SliderFloat( public static bool SliderFloat(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Span<float> v, float vMin = 0.0f, float vMax = 0.0f, AutoUtf8Buffer label, Span<float> v, float vMin = 0.0f, float vMax = 0.0f, AutoUtf8Buffer format = default,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => ImGuiSliderFlags flags = ImGuiSliderFlags.None) => SliderScalar(
SliderScalar(label, ImGuiDataType.Float, v, vMin, vMax, format.MoveOrDefault("%.3f"u8), flags); label,
ImGuiDataType.Float,
v,
vMin,
vMax,
format.MoveOrDefault("%.3f"u8),
flags);
public static bool SliderFloat2( public static bool SliderFloat2(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref Vector2 v, float vMin = 0.0f, float vMax = 0.0f, AutoUtf8Buffer label, scoped ref Vector2 v, float vMin = 0.0f, float vMax = 0.0f,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => SliderScalar(
SliderScalar( label,
label, ImGuiDataType.Float,
ImGuiDataType.Float, MemoryMarshal.Cast<Vector2, float>(new(ref v)),
MemoryMarshal.Cast<Vector2, float>(new(ref v)), vMin,
vMin, vMax,
vMax, format.MoveOrDefault("%.3f"u8),
format.MoveOrDefault("%.3f"u8), flags);
flags);
public static bool SliderFloat3( public static bool SliderFloat3(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref Vector3 v, float vMin = 0.0f, float vMax = 0.0f, AutoUtf8Buffer label, scoped ref Vector3 v, float vMin = 0.0f, float vMax = 0.0f,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) =>
SliderScalar( SliderScalar(
label, label,
ImGuiDataType.Float, ImGuiDataType.Float,
@ -123,8 +230,10 @@ public static unsafe partial class ImGui
flags); flags);
public static bool SliderFloat4( public static bool SliderFloat4(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref Vector4 v, float vMin = 0.0f, float vMax = 0.0f, AutoUtf8Buffer label, scoped ref Vector4 v, float vMin = 0.0f,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => float vMax = 0.0f,
AutoUtf8Buffer format = default,
ImGuiSliderFlags flags = ImGuiSliderFlags.None) =>
SliderScalar( SliderScalar(
label, label,
ImGuiDataType.Float, ImGuiDataType.Float,
@ -135,18 +244,24 @@ public static unsafe partial class ImGui
flags); flags);
public static bool SliderDouble( public static bool SliderDouble(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, scoped ref double v, double vMin = 0.0f, double vMax = 0.0f, AutoUtf8Buffer label, scoped ref double v, double vMin = 0.0f,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => double vMax = 0.0f,
AutoUtf8Buffer format = default,
ImGuiSliderFlags flags = ImGuiSliderFlags.None) =>
SliderScalar(label, ImGuiDataType.Double, ref v, vMin, vMax, format.MoveOrDefault("%.3f"u8), flags); SliderScalar(label, ImGuiDataType.Double, ref v, vMin, vMax, format.MoveOrDefault("%.3f"u8), flags);
public static bool SliderDouble( public static bool SliderDouble(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Span<double> v, double vMin = 0.0f, double vMax = 0.0f, AutoUtf8Buffer label, Span<double> v, double vMin = 0.0f,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => double vMax = 0.0f,
AutoUtf8Buffer format = default,
ImGuiSliderFlags flags = ImGuiSliderFlags.None) =>
SliderScalar(label, ImGuiDataType.Double, v, vMin, vMax, format.MoveOrDefault("%.3f"u8), flags); SliderScalar(label, ImGuiDataType.Double, v, vMin, vMax, format.MoveOrDefault("%.3f"u8), flags);
public static bool SliderScalar<T>( public static bool SliderScalar<T>(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, ImGuiDataType dataType, scoped ref T v, scoped in T vMin, scoped in T vMax, AutoUtf8Buffer label, ImGuiDataType dataType, scoped ref T v,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) scoped in T vMin, scoped in T vMax,
AutoUtf8Buffer format = default,
ImGuiSliderFlags flags = ImGuiSliderFlags.None)
where T : unmanaged, IBinaryNumber<T> where T : unmanaged, IBinaryNumber<T>
{ {
fixed (byte* labelPtr = label.NullTerminatedSpan) fixed (byte* labelPtr = label.NullTerminatedSpan)
@ -170,8 +285,10 @@ public static unsafe partial class ImGui
} }
public static bool SliderScalar<T>( public static bool SliderScalar<T>(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, ImGuiDataType dataType, Span<T> v, scoped in T vMin, scoped in T vMax, AutoUtf8Buffer label, ImGuiDataType dataType, Span<T> v, scoped in T vMin,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) scoped in T vMax,
AutoUtf8Buffer format = default,
ImGuiSliderFlags flags = ImGuiSliderFlags.None)
where T : unmanaged, INumber<T>, IBinaryNumber<T> where T : unmanaged, INumber<T>, IBinaryNumber<T>
{ {
fixed (byte* labelPtr = label.NullTerminatedSpan) fixed (byte* labelPtr = label.NullTerminatedSpan)
@ -196,8 +313,10 @@ public static unsafe partial class ImGui
} }
public static bool SliderAngle( public static bool SliderAngle(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, ref float vRad, float vDegreesMin = -360.0f, float vDegreesMax = +360.0f, AutoUtf8Buffer label, ref float vRad, float vDegreesMin = -360.0f,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) float vDegreesMax = +360.0f,
AutoUtf8Buffer format = default,
ImGuiSliderFlags flags = ImGuiSliderFlags.None)
{ {
fixed (byte* labelPtr = label.NullTerminatedSpan) fixed (byte* labelPtr = label.NullTerminatedSpan)
fixed (byte* formatPtr = format.IsInitialized ? format.NullTerminatedSpan : "%.0f deg"u8) fixed (byte* formatPtr = format.IsInitialized ? format.NullTerminatedSpan : "%.0f deg"u8)
@ -217,59 +336,72 @@ public static unsafe partial class ImGui
} }
public static bool VSliderSByte( public static bool VSliderSByte(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Vector2 size, scoped ref sbyte v, sbyte vMin, sbyte vMax, [InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, AutoUtf8Buffer label, Vector2 size, scoped ref sbyte v, sbyte vMin,
sbyte vMax, AutoUtf8Buffer format = default,
ImGuiSliderFlags flags = ImGuiSliderFlags.None) => ImGuiSliderFlags flags = ImGuiSliderFlags.None) =>
VSliderScalar(label, size, ImGuiDataType.S8, ref v, vMin, vMax, format.MoveOrDefault("%hhd"), flags); VSliderScalar(label, size, ImGuiDataType.S8, ref v, vMin, vMax, format.MoveOrDefault("%hhd"), flags);
public static bool VSliderByte( public static bool VSliderByte(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Vector2 size, scoped ref byte v, byte vMin, byte vMax, [InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, AutoUtf8Buffer label, Vector2 size, scoped ref byte v, byte vMin, byte vMax,
AutoUtf8Buffer format = default,
ImGuiSliderFlags flags = ImGuiSliderFlags.None) => ImGuiSliderFlags flags = ImGuiSliderFlags.None) =>
VSliderScalar(label, size, ImGuiDataType.U8, ref v, vMin, vMax, format.MoveOrDefault("%hhu"), flags); VSliderScalar(label, size, ImGuiDataType.U8, ref v, vMin, vMax, format.MoveOrDefault("%hhu"), flags);
public static bool VSliderShort( public static bool VSliderShort(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Vector2 size, scoped ref short v, short vMin, short vMax, [InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, AutoUtf8Buffer label, Vector2 size, scoped ref short v, short vMin,
short vMax, AutoUtf8Buffer format = default,
ImGuiSliderFlags flags = ImGuiSliderFlags.None) => ImGuiSliderFlags flags = ImGuiSliderFlags.None) =>
VSliderScalar(label, size, ImGuiDataType.S16, ref v, vMin, vMax, format.MoveOrDefault("%hd"), flags); VSliderScalar(label, size, ImGuiDataType.S16, ref v, vMin, vMax, format.MoveOrDefault("%hd"), flags);
public static bool VSliderUShort( public static bool VSliderUShort(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Vector2 size, scoped ref ushort v, ushort vMin, ushort vMax, AutoUtf8Buffer label, Vector2 size, scoped ref ushort v, ushort vMin,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) => ushort vMax,
AutoUtf8Buffer format = default,
ImGuiSliderFlags flags = ImGuiSliderFlags.None) =>
VSliderScalar(label, size, ImGuiDataType.U16, ref v, vMin, vMax, format.MoveOrDefault("%hu"), flags); VSliderScalar(label, size, ImGuiDataType.U16, ref v, vMin, vMax, format.MoveOrDefault("%hu"), flags);
public static bool VSliderInt( public static bool VSliderInt(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Vector2 size, scoped ref int v, int vMin, int vMax, [InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, AutoUtf8Buffer label, Vector2 size, scoped ref int v, int vMin, int vMax,
AutoUtf8Buffer format = default,
ImGuiSliderFlags flags = ImGuiSliderFlags.None) => ImGuiSliderFlags flags = ImGuiSliderFlags.None) =>
VSliderScalar(label, size, ImGuiDataType.S32, ref v, vMin, vMax, format.MoveOrDefault("%d"), flags); VSliderScalar(label, size, ImGuiDataType.S32, ref v, vMin, vMax, format.MoveOrDefault("%d"), flags);
public static bool VSliderUInt( public static bool VSliderUInt(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Vector2 size, scoped ref uint v, uint vMin, uint vMax, [InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, AutoUtf8Buffer label, Vector2 size, scoped ref uint v, uint vMin, uint vMax,
AutoUtf8Buffer format = default,
ImGuiSliderFlags flags = ImGuiSliderFlags.None) => ImGuiSliderFlags flags = ImGuiSliderFlags.None) =>
VSliderScalar(label, size, ImGuiDataType.U32, ref v, vMin, vMax, format.MoveOrDefault("%u"), flags); VSliderScalar(label, size, ImGuiDataType.U32, ref v, vMin, vMax, format.MoveOrDefault("%u"), flags);
public static bool VSliderLong( public static bool VSliderLong(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Vector2 size, scoped ref long v, long vMin, long vMax, [InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, AutoUtf8Buffer label, Vector2 size, scoped ref long v, long vMin, long vMax,
AutoUtf8Buffer format = default,
ImGuiSliderFlags flags = ImGuiSliderFlags.None) => ImGuiSliderFlags flags = ImGuiSliderFlags.None) =>
VSliderScalar(label, size, ImGuiDataType.S32, ref v, vMin, vMax, format.MoveOrDefault("%I64d"), flags); VSliderScalar(label, size, ImGuiDataType.S32, ref v, vMin, vMax, format.MoveOrDefault("%I64d"), flags);
public static bool VSliderULong( public static bool VSliderULong(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Vector2 size, scoped ref ulong v, ulong vMin, ulong vMax, [InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, AutoUtf8Buffer label, Vector2 size, scoped ref ulong v, ulong vMin,
ulong vMax, AutoUtf8Buffer format = default,
ImGuiSliderFlags flags = ImGuiSliderFlags.None) => ImGuiSliderFlags flags = ImGuiSliderFlags.None) =>
VSliderScalar(label, size, ImGuiDataType.U32, ref v, vMin, vMax, format.MoveOrDefault("%I64u"), flags); VSliderScalar(label, size, ImGuiDataType.U32, ref v, vMin, vMax, format.MoveOrDefault("%I64u"), flags);
public static bool VSliderFloat( public static bool VSliderFloat(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Vector2 size, scoped ref float v, float vMin, float vMax, [InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, AutoUtf8Buffer label, Vector2 size, scoped ref float v, float vMin,
float vMax, AutoUtf8Buffer format = default,
ImGuiSliderFlags flags = ImGuiSliderFlags.None) => ImGuiSliderFlags flags = ImGuiSliderFlags.None) =>
VSliderScalar(label, size, ImGuiDataType.Float, ref v, vMin, vMax, format.MoveOrDefault("%.03f"), flags); VSliderScalar(label, size, ImGuiDataType.Float, ref v, vMin, vMax, format.MoveOrDefault("%.03f"), flags);
public static bool VSliderDouble( public static bool VSliderDouble(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Vector2 size, scoped ref double v, double vMin, double vMax, AutoUtf8Buffer label, Vector2 size, scoped ref double v, double vMin,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, double vMax,
AutoUtf8Buffer format = default,
ImGuiSliderFlags flags = ImGuiSliderFlags.None) => ImGuiSliderFlags flags = ImGuiSliderFlags.None) =>
VSliderScalar(label, size, ImGuiDataType.Double, ref v, vMin, vMax, format.MoveOrDefault("%.03f"), flags); VSliderScalar(label, size, ImGuiDataType.Double, ref v, vMin, vMax, format.MoveOrDefault("%.03f"), flags);
public static bool VSliderScalar<T>( public static bool VSliderScalar<T>(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer label, Vector2 size, ImGuiDataType dataType, scoped ref T data, scoped in T min, scoped in T max, AutoUtf8Buffer label, Vector2 size, ImGuiDataType dataType,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer format = default, ImGuiSliderFlags flags = ImGuiSliderFlags.None) scoped ref T data, scoped in T min, scoped in T max,
AutoUtf8Buffer format = default,
ImGuiSliderFlags flags = ImGuiSliderFlags.None)
where T : unmanaged, IBinaryNumber<T> where T : unmanaged, IBinaryNumber<T>
{ {
fixed (byte* labelPtr = label.NullTerminatedSpan) fixed (byte* labelPtr = label.NullTerminatedSpan)

View file

@ -1,28 +1,25 @@
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.Numerics; using System.Numerics;
using System.Runtime.CompilerServices;
namespace Dalamud.Bindings.ImGui; namespace Dalamud.Bindings.ImGui;
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public static unsafe partial class ImGui public static unsafe partial class ImGui
{ {
public static void AddText(ImFontGlyphRangesBuilderPtr self, [InterpolatedStringHandlerArgument] AutoUtf8Buffer text) public static void AddText(ImFontGlyphRangesBuilderPtr self, AutoUtf8Buffer text)
{ {
fixed (byte* textPtr = text.Span) fixed (byte* textPtr = text.Span) ImGuiNative.AddText(self.Handle, textPtr, textPtr + text.Length);
ImGuiNative.AddText(self.Handle, textPtr, textPtr + text.Length);
text.Dispose(); text.Dispose();
} }
public static void AddText(ImDrawListPtr self, Vector2 pos, uint col, [InterpolatedStringHandlerArgument] AutoUtf8Buffer text) public static void AddText(ImDrawListPtr self, Vector2 pos, uint col, AutoUtf8Buffer text)
{ {
fixed (byte* textPtr = text.Span) fixed (byte* textPtr = text.Span) ImGuiNative.AddText(self.Handle, pos, col, textPtr, textPtr + text.Length);
ImGuiNative.AddText(self.Handle, pos, col, textPtr, textPtr + text.Length);
text.Dispose(); text.Dispose();
} }
public static void AddText( public static void AddText(
ImDrawListPtr self, ImFontPtr font, float fontSize, Vector2 pos, uint col, [InterpolatedStringHandlerArgument] AutoUtf8Buffer text, float wrapWidth, ImDrawListPtr self, ImFontPtr font, float fontSize, Vector2 pos, uint col, AutoUtf8Buffer text, float wrapWidth,
scoped in Vector4 cpuFineClipRect) scoped in Vector4 cpuFineClipRect)
{ {
fixed (byte* textPtr = text.Span) fixed (byte* textPtr = text.Span)
@ -41,43 +38,30 @@ public static unsafe partial class ImGui
} }
public static void AddText( public static void AddText(
ImDrawListPtr self, ImFontPtr font, float fontSize, Vector2 pos, uint col, [InterpolatedStringHandlerArgument] AutoUtf8Buffer text, ImDrawListPtr self, ImFontPtr font, float fontSize, Vector2 pos, uint col, AutoUtf8Buffer text,
float wrapWidth = 0f) float wrapWidth = 0f)
{ {
fixed (byte* textPtr = text.Span) fixed (byte* textPtr = text.Span)
ImGuiNative.AddText( ImGuiNative.AddText(self.Handle, font, fontSize, pos, col, textPtr, textPtr + text.Length, wrapWidth, null);
self.Handle,
font,
fontSize,
pos,
col,
textPtr,
textPtr + text.Length,
wrapWidth,
null);
text.Dispose(); text.Dispose();
} }
public static void append(ImGuiTextBufferPtr self, [InterpolatedStringHandlerArgument] AutoUtf8Buffer str) public static void append(ImGuiTextBufferPtr self, AutoUtf8Buffer str)
{ {
fixed (byte* strPtr = str.Span) fixed (byte* strPtr = str.Span) ImGuiNative.append(self.Handle, strPtr, strPtr + str.Length);
ImGuiNative.append(self.Handle, strPtr, strPtr + str.Length);
str.Dispose(); str.Dispose();
} }
public static void BulletText([InterpolatedStringHandlerArgument] AutoUtf8Buffer text) public static void BulletText(AutoUtf8Buffer text)
{ {
ImGuiWindow* window = ImGuiP.GetCurrentWindow(); ImGuiWindow* window = ImGuiP.GetCurrentWindow();
if (window->SkipItems != 0) if (window->SkipItems != 0) return;
return;
scoped ref var g = ref *GetCurrentContext().Handle; scoped ref var g = ref *GetCurrentContext().Handle;
scoped ref readonly var style = ref g.Style; scoped ref readonly var style = ref g.Style;
var labelSize = CalcTextSize(text.Span); var labelSize = CalcTextSize(text.Span);
var totalSize = new Vector2( var totalSize = new Vector2(
g.FontSize + (labelSize.X > 0.0f ? (labelSize.X + style.FramePadding.X * 2) : 0.0f), g.FontSize + (labelSize.X > 0.0f ? (labelSize.X + style.FramePadding.X * 2) : 0.0f),
labelSize.Y); // Empty text doesn't add padding labelSize.Y); // Empty text doesn't add padding
var pos = window->DC.CursorPos; var pos = window->DC.CursorPos;
pos.Y += window->DC.CurrLineTextBaseOffset; pos.Y += window->DC.CurrLineTextBaseOffset;
ImGuiP.ItemSize(totalSize, 0.0f); ImGuiP.ItemSize(totalSize, 0.0f);
@ -95,7 +79,7 @@ public static unsafe partial class ImGui
} }
public static Vector2 CalcTextSize( public static Vector2 CalcTextSize(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer text, bool hideTextAfterDoubleHash = false, float wrapWidth = -1.0f) AutoUtf8Buffer text, bool hideTextAfterDoubleHash = false, float wrapWidth = -1.0f)
{ {
var @out = Vector2.Zero; var @out = Vector2.Zero;
fixed (byte* textPtr = text.Span) fixed (byte* textPtr = text.Span)
@ -110,7 +94,7 @@ public static unsafe partial class ImGui
} }
public static Vector2 CalcTextSizeA( public static Vector2 CalcTextSizeA(
ImFontPtr self, float size, float maxWidth, float wrapWidth, [InterpolatedStringHandlerArgument] AutoUtf8Buffer text, out int remaining) ImFontPtr self, float size, float maxWidth, float wrapWidth, AutoUtf8Buffer text, out int remaining)
{ {
var @out = Vector2.Zero; var @out = Vector2.Zero;
fixed (byte* textPtr = text.Span) fixed (byte* textPtr = text.Span)
@ -132,7 +116,8 @@ public static unsafe partial class ImGui
return @out; return @out;
} }
public static int CalcWordWrapPositionA(ImFontPtr font, float scale, [InterpolatedStringHandlerArgument] AutoUtf8Buffer text, float wrapWidth) public static int CalcWordWrapPositionA(
ImFontPtr font, float scale, AutoUtf8Buffer text, float wrapWidth)
{ {
fixed (byte* ptr = text.Span) fixed (byte* ptr = text.Span)
{ {
@ -143,14 +128,17 @@ public static unsafe partial class ImGui
} }
} }
public static void InsertChars(ImGuiInputTextCallbackDataPtr self, int pos, [InterpolatedStringHandlerArgument] AutoUtf8Buffer text) public static void InsertChars(
ImGuiInputTextCallbackDataPtr self, int pos, AutoUtf8Buffer text)
{ {
fixed (byte* ptr = text.Span) fixed (byte* ptr = text.Span)
ImGuiNative.InsertChars(self.Handle, pos, ptr, ptr + text.Length); ImGuiNative.InsertChars(self.Handle, pos, ptr, ptr + text.Length);
text.Dispose(); text.Dispose();
} }
public static void LabelText([InterpolatedStringHandlerArgument] AutoUtf8Buffer label, [InterpolatedStringHandlerArgument] AutoUtf8Buffer text) public static void LabelText(
AutoUtf8Buffer label,
AutoUtf8Buffer text)
{ {
var window = ImGuiP.GetCurrentWindow().Handle; var window = ImGuiP.GetCurrentWindow().Handle;
if (window->SkipItems != 0) if (window->SkipItems != 0)
@ -195,7 +183,7 @@ public static unsafe partial class ImGui
text.Dispose(); text.Dispose();
} }
public static void LogText([InterpolatedStringHandlerArgument] AutoUtf8Buffer text) public static void LogText(AutoUtf8Buffer text)
{ {
var g = GetCurrentContext(); var g = GetCurrentContext();
if (!g.LogFile.IsNull) if (!g.LogFile.IsNull)
@ -213,7 +201,7 @@ public static unsafe partial class ImGui
text.Dispose(); text.Dispose();
} }
public static void PassFilter(ImGuiTextFilterPtr self, [InterpolatedStringHandlerArgument] AutoUtf8Buffer text) public static void PassFilter(ImGuiTextFilterPtr self, AutoUtf8Buffer text)
{ {
fixed (byte* textPtr = text.Span) fixed (byte* textPtr = text.Span)
ImGuiNative.PassFilter(self.Handle, textPtr, textPtr + text.Length); ImGuiNative.PassFilter(self.Handle, textPtr, textPtr + text.Length);
@ -222,7 +210,7 @@ public static unsafe partial class ImGui
public static void RenderText( public static void RenderText(
ImFontPtr self, ImDrawListPtr drawList, float size, Vector2 pos, uint col, Vector4 clipRect, ImFontPtr self, ImDrawListPtr drawList, float size, Vector2 pos, uint col, Vector4 clipRect,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer text, float wrapWidth = 0.0f, bool cpuFineClip = false) AutoUtf8Buffer text, float wrapWidth = 0.0f, bool cpuFineClip = false)
{ {
fixed (byte* textPtr = text.Span) fixed (byte* textPtr = text.Span)
ImGuiNative.RenderText( ImGuiNative.RenderText(
@ -239,7 +227,7 @@ public static unsafe partial class ImGui
text.Dispose(); text.Dispose();
} }
public static void SetTooltip([InterpolatedStringHandlerArgument] AutoUtf8Buffer text) public static void SetTooltip(AutoUtf8Buffer text)
{ {
ImGuiP.BeginTooltipEx(ImGuiTooltipFlags.OverridePreviousTooltip, ImGuiWindowFlags.None); ImGuiP.BeginTooltipEx(ImGuiTooltipFlags.OverridePreviousTooltip, ImGuiWindowFlags.None);
Text(text.Span); Text(text.Span);
@ -247,14 +235,14 @@ public static unsafe partial class ImGui
text.Dispose(); text.Dispose();
} }
public static void Text([InterpolatedStringHandlerArgument] AutoUtf8Buffer text) public static void Text(AutoUtf8Buffer text)
{ {
fixed (byte* ptr = text.Span) fixed (byte* ptr = text.Span)
ImGuiNative.TextUnformatted(ptr, ptr + text.Length); ImGuiNative.TextUnformatted(ptr, ptr + text.Length);
text.Dispose(); text.Dispose();
} }
public static void TextColored(uint col, [InterpolatedStringHandlerArgument] AutoUtf8Buffer text) public static void TextColored(uint col, AutoUtf8Buffer text)
{ {
PushStyleColor(ImGuiCol.Text, col); PushStyleColor(ImGuiCol.Text, col);
Text(text.Span); Text(text.Span);
@ -262,7 +250,7 @@ public static unsafe partial class ImGui
text.Dispose(); text.Dispose();
} }
public static void TextColored(scoped in Vector4 col, [InterpolatedStringHandlerArgument] AutoUtf8Buffer text) public static void TextColored(scoped in Vector4 col, AutoUtf8Buffer text)
{ {
PushStyleColor(ImGuiCol.Text, col); PushStyleColor(ImGuiCol.Text, col);
Text(text.Span); Text(text.Span);
@ -270,19 +258,19 @@ public static unsafe partial class ImGui
text.Dispose(); text.Dispose();
} }
public static void TextDisabled([InterpolatedStringHandlerArgument] AutoUtf8Buffer text) public static void TextDisabled(AutoUtf8Buffer text)
{ {
TextColored(*GetStyleColorVec4(ImGuiCol.TextDisabled), text.Span); TextColored(*GetStyleColorVec4(ImGuiCol.TextDisabled), text.Span);
text.Dispose(); text.Dispose();
} }
public static void TextUnformatted([InterpolatedStringHandlerArgument] AutoUtf8Buffer text) public static void TextUnformatted(AutoUtf8Buffer text)
{ {
Text(text.Span); Text(text.Span);
text.Dispose(); text.Dispose();
} }
public static void TextWrapped([InterpolatedStringHandlerArgument] AutoUtf8Buffer text) public static void TextWrapped(AutoUtf8Buffer text)
{ {
scoped ref var g = ref *GetCurrentContext().Handle; scoped ref var g = ref *GetCurrentContext().Handle;
var needBackup = g.CurrentWindow->DC.TextWrapPos < 0.0f; // Keep existing wrap position if one is already set var needBackup = g.CurrentWindow->DC.TextWrapPos < 0.0f; // Keep existing wrap position if one is already set
@ -294,7 +282,7 @@ public static unsafe partial class ImGui
text.Dispose(); text.Dispose();
} }
public static bool TreeNode([InterpolatedStringHandlerArgument] AutoUtf8Buffer label) public static bool TreeNode(AutoUtf8Buffer label)
{ {
var window = ImGuiP.GetCurrentWindow(); var window = ImGuiP.GetCurrentWindow();
if (window.SkipItems) if (window.SkipItems)
@ -316,7 +304,8 @@ public static unsafe partial class ImGui
} }
public static bool TreeNodeEx( public static bool TreeNodeEx(
[InterpolatedStringHandlerArgument] AutoUtf8Buffer id, ImGuiTreeNodeFlags flags = ImGuiTreeNodeFlags.None, [InterpolatedStringHandlerArgument] AutoUtf8Buffer label = default) AutoUtf8Buffer id, ImGuiTreeNodeFlags flags = ImGuiTreeNodeFlags.None,
AutoUtf8Buffer label = default)
{ {
var window = ImGuiP.GetCurrentWindow(); var window = ImGuiP.GetCurrentWindow();
bool res; bool res;

View file

@ -4,14 +4,13 @@ namespace Dalamud.Bindings.ImGui;
public unsafe partial struct ImGuiInputTextCallbackData public unsafe partial struct ImGuiInputTextCallbackData
{ {
public void InsertChars(int pos, [InterpolatedStringHandlerArgument] AutoUtf8Buffer text) public void InsertChars(int pos, AutoUtf8Buffer text)
{ {
fixed (ImGuiInputTextCallbackData* thisPtr = &this) fixed (ImGuiInputTextCallbackData* thisPtr = &this) ImGui.InsertChars(thisPtr, pos, text);
ImGui.InsertChars(thisPtr, pos, text);
} }
} }
public partial struct ImGuiInputTextCallbackDataPtr public partial struct ImGuiInputTextCallbackDataPtr
{ {
public void InsertChars(int pos, [InterpolatedStringHandlerArgument] AutoUtf8Buffer text) => ImGui.InsertChars(this, pos, text); public void InsertChars(int pos, AutoUtf8Buffer text) => ImGui.InsertChars(this, pos, text);
} }

View file

@ -7,7 +7,7 @@ namespace Dalamud.Bindings.ImGui;
public static unsafe partial class ImGuiP public static unsafe partial class ImGuiP
{ {
public static void DebugLog([InterpolatedStringHandlerArgument] AutoUtf8Buffer text) public static void DebugLog(AutoUtf8Buffer text)
{ {
var g = ImGui.GetCurrentContext().Handle; var g = ImGui.GetCurrentContext().Handle;
ImGui.append(&g->DebugLogBuf, $"[{g->FrameCount:00000}] "); ImGui.append(&g->DebugLogBuf, $"[{g->FrameCount:00000}] ");
@ -40,7 +40,7 @@ public static unsafe partial class ImGuiP
return before.Length; return before.Length;
} }
public static uint GetID(ImGuiWindowPtr self, [InterpolatedStringHandlerArgument] AutoUtf8Buffer str) public static uint GetID(ImGuiWindowPtr self, AutoUtf8Buffer str)
{ {
fixed (byte* strPtr = str.Span) fixed (byte* strPtr = str.Span)
{ {
@ -55,16 +55,14 @@ public static unsafe partial class ImGuiP
} }
public static uint GetID(ImGuiWindowPtr self, void* ptr) => ImGuiPNative.GetID(self.Handle, ptr); public static uint GetID(ImGuiWindowPtr self, void* ptr) => ImGuiPNative.GetID(self.Handle, ptr);
public static uint GetID(ImGuiWindowPtr self, int n) => ImGuiPNative.GetID(self.Handle, n); public static uint GetID(ImGuiWindowPtr self, int n) => ImGuiPNative.GetID(self.Handle, n);
public static uint ImHashData(ReadOnlySpan<byte> data, uint seed = 0) public static uint ImHashData(ReadOnlySpan<byte> data, uint seed = 0)
{ {
fixed (byte* ptr = data) fixed (byte* ptr = data) return ImGuiPNative.ImHashData(ptr, (nuint)data.Length, seed);
return ImGuiPNative.ImHashData(ptr, (nuint)data.Length, seed);
} }
public static uint ImHashStr([InterpolatedStringHandlerArgument] AutoUtf8Buffer data, uint seed = 0) public static uint ImHashStr(AutoUtf8Buffer data, uint seed = 0)
{ {
fixed (byte* ptr = data.Span) fixed (byte* ptr = data.Span)
{ {
@ -133,7 +131,7 @@ public static unsafe partial class ImGuiP
return i; return i;
} }
public static void LogRenderedText(scoped in Vector2 refPos, [InterpolatedStringHandlerArgument] AutoUtf8Buffer text) public static void LogRenderedText(scoped in Vector2 refPos, AutoUtf8Buffer text)
{ {
fixed (Vector2* refPosPtr = &refPos) fixed (Vector2* refPosPtr = &refPos)
fixed (byte* textPtr = text.Span) fixed (byte* textPtr = text.Span)
@ -141,14 +139,15 @@ public static unsafe partial class ImGuiP
text.Dispose(); text.Dispose();
} }
public static void RenderText(Vector2 pos, [InterpolatedStringHandlerArgument] AutoUtf8Buffer text, bool hideTextAfterHash = true) public static void RenderText(Vector2 pos, AutoUtf8Buffer text, bool hideTextAfterHash = true)
{ {
fixed (byte* textPtr = text.Span) fixed (byte* textPtr = text.Span)
ImGuiPNative.RenderText(pos, textPtr, textPtr + text.Length, hideTextAfterHash ? (byte)1 : (byte)0); ImGuiPNative.RenderText(pos, textPtr, textPtr + text.Length, hideTextAfterHash ? (byte)1 : (byte)0);
text.Dispose(); text.Dispose();
} }
public static void RenderTextWrapped(Vector2 pos, [InterpolatedStringHandlerArgument] AutoUtf8Buffer text, float wrapWidth) public static void RenderTextWrapped(
Vector2 pos, AutoUtf8Buffer text, float wrapWidth)
{ {
fixed (byte* textPtr = text.Span) fixed (byte* textPtr = text.Span)
ImGuiPNative.RenderTextWrapped(pos, textPtr, textPtr + text.Length, wrapWidth); ImGuiPNative.RenderTextWrapped(pos, textPtr, textPtr + text.Length, wrapWidth);
@ -156,7 +155,8 @@ public static unsafe partial class ImGuiP
} }
public static void RenderTextClipped( public static void RenderTextClipped(
scoped in Vector2 posMin, scoped in Vector2 posMax, [InterpolatedStringHandlerArgument] AutoUtf8Buffer text, scoped in Vector2? textSizeIfKnown = null, scoped in Vector2 posMin, scoped in Vector2 posMax, AutoUtf8Buffer text,
scoped in Vector2? textSizeIfKnown = null,
scoped in Vector2 align = default, scoped in ImRect? clipRect = null) scoped in Vector2 align = default, scoped in ImRect? clipRect = null)
{ {
var textSizeIfKnownOrDefault = textSizeIfKnown ?? default; var textSizeIfKnownOrDefault = textSizeIfKnown ?? default;
@ -174,7 +174,8 @@ public static unsafe partial class ImGuiP
} }
public static void RenderTextClippedEx( public static void RenderTextClippedEx(
ImDrawListPtr drawList, scoped in Vector2 posMin, scoped in Vector2 posMax, [InterpolatedStringHandlerArgument] AutoUtf8Buffer text, ImDrawListPtr drawList, scoped in Vector2 posMin, scoped in Vector2 posMax,
AutoUtf8Buffer text,
scoped in Vector2? textSizeIfKnown = null, scoped in Vector2 align = default, scoped in ImRect? clipRect = null) scoped in Vector2? textSizeIfKnown = null, scoped in Vector2 align = default, scoped in ImRect? clipRect = null)
{ {
var textSizeIfKnownOrDefault = textSizeIfKnown ?? default; var textSizeIfKnownOrDefault = textSizeIfKnown ?? default;
@ -194,7 +195,7 @@ public static unsafe partial class ImGuiP
public static void RenderTextEllipsis( public static void RenderTextEllipsis(
ImDrawListPtr drawList, scoped in Vector2 posMin, scoped in Vector2 posMax, float clipMaxX, float ellipsisMaxX, ImDrawListPtr drawList, scoped in Vector2 posMin, scoped in Vector2 posMax, float clipMaxX, float ellipsisMaxX,
[InterpolatedStringHandlerArgument] AutoUtf8Buffer text, scoped in Vector2? textSizeIfKnown = null) AutoUtf8Buffer text, scoped in Vector2? textSizeIfKnown = null)
{ {
var textSizeIfKnownOrDefault = textSizeIfKnown ?? default; var textSizeIfKnownOrDefault = textSizeIfKnown ?? default;
fixed (byte* textPtr = text.Span) fixed (byte* textPtr = text.Span)

View file

@ -4,30 +4,25 @@ namespace Dalamud.Bindings.ImGui;
public unsafe partial struct ImGuiWindow public unsafe partial struct ImGuiWindow
{ {
public readonly uint GetID([InterpolatedStringHandlerArgument] AutoUtf8Buffer str) public readonly uint GetID(AutoUtf8Buffer str)
{ {
fixed (ImGuiWindow* thisPtr = &this) fixed (ImGuiWindow* thisPtr = &this) return ImGuiP.GetID(thisPtr, str);
return ImGuiP.GetID(thisPtr, str);
} }
public readonly uint GetID(void* ptr) public readonly uint GetID(void* ptr)
{ {
fixed (ImGuiWindow* thisPtr = &this) fixed (ImGuiWindow* thisPtr = &this) return ImGuiP.GetID(thisPtr, ptr);
return ImGuiP.GetID(thisPtr, ptr);
} }
public readonly uint GetID(int n) public readonly uint GetID(int n)
{ {
fixed (ImGuiWindow* thisPtr = &this) fixed (ImGuiWindow* thisPtr = &this) return ImGuiP.GetID(thisPtr, n);
return ImGuiP.GetID(thisPtr, n);
} }
} }
public unsafe partial struct ImGuiWindowPtr public unsafe partial struct ImGuiWindowPtr
{ {
public readonly uint GetID([InterpolatedStringHandlerArgument] AutoUtf8Buffer str) => ImGuiP.GetID(this.Handle, str); public readonly uint GetID(AutoUtf8Buffer str) => ImGuiP.GetID(this.Handle, str);
public readonly uint GetID(void* ptr) => ImGuiP.GetID(this.Handle, ptr); public readonly uint GetID(void* ptr) => ImGuiP.GetID(this.Handle, ptr);
public readonly uint GetID(int n) => ImGuiP.GetID(this.Handle, n); public readonly uint GetID(int n) => ImGuiP.GetID(this.Handle, n);
} }