Make manual overloads for string-returning functinos

This commit is contained in:
Soreepeong 2025-08-04 19:29:18 +09:00
parent 334a02e69a
commit 4b1857e40d
12 changed files with 239 additions and 462 deletions

View file

@ -23,7 +23,14 @@ $tmp = Get-Content -Path "$PSScriptRoot\imgui\Dalamud.Bindings.ImGui\Generated\E
$tmp = $tmp.Replace("unchecked((int)GamepadStart)", "unchecked((int)ImGuiKey.GamepadStart)").Trim() $tmp = $tmp.Replace("unchecked((int)GamepadStart)", "unchecked((int)ImGuiKey.GamepadStart)").Trim()
$tmp | Set-Content -Path "$PSScriptRoot\imgui\Dalamud.Bindings.ImGui\Generated\Enums\ImGuiKeyPrivate.cs" -Encoding ascii $tmp | Set-Content -Path "$PSScriptRoot\imgui\Dalamud.Bindings.ImGui\Generated\Enums\ImGuiKeyPrivate.cs" -Encoding ascii
Remove-Item -Path "$PSScriptRoot\imgui\Dalamud.Bindings.ImGui\Generated\Handles\ImTextureID.cs" -Force try
{
Remove-Item -Path "$PSScriptRoot\imgui\Dalamud.Bindings.ImGui\Generated\Handles\ImTextureID.cs" -Force
}
catch [System.Management.Automation.ItemNotFoundException]
{
# pass
}
foreach ($sourcePath in $sourcePaths) foreach ($sourcePath in $sourcePaths)
{ {
@ -188,8 +195,19 @@ foreach ($sourcePath in $sourcePaths)
foreach ($overload in $methods) foreach ($overload in $methods)
{ {
# discard formatting functions or functions accepting (begin, end) or (data, size) pairs $returnType = $overload.Groups["return"].Value.Trim()
$argDef = $overload.Groups["args"].Value $argDef = $overload.Groups["args"].Value
# discard functions returning a string of some sort
if ($returnType -eq "string" -and
$methodName.EndsWith("S"))
{
$null = $discardMethods.Add($methodName.Substring(0, $methodName.Length - 1))
$null = $discardMethods.Add($methodName)
break
}
# discard formatting functions or functions accepting (begin, end) or (data, size) pairs
if ($argDef.Contains("fmt") -or if ($argDef.Contains("fmt") -or
$argDef -match "\btext\b" -or $argDef -match "\btext\b" -or
# $argDef.Contains("byte* textEnd") -or # $argDef.Contains("byte* textEnd") -or

View file

@ -894,16 +894,6 @@ public unsafe partial class ImGui
{ {
ImGuiNative.ShowUserGuide(); ImGuiNative.ShowUserGuide();
} }
public static byte* GetVersion()
{
byte* ret = ImGuiNative.GetVersion();
return ret;
}
public static string GetVersionS()
{
string ret = Utils.DecodeStringUTF8(ImGuiNative.GetVersion());
return ret;
}
public static void StyleColorsDark(ImGuiStylePtr dst) public static void StyleColorsDark(ImGuiStylePtr dst)
{ {
ImGuiNative.StyleColorsDark(dst); ImGuiNative.StyleColorsDark(dst);
@ -1814,26 +1804,6 @@ public unsafe partial class ImGui
int ret = ImGuiNative.TableGetRowIndex(); int ret = ImGuiNative.TableGetRowIndex();
return ret; return ret;
} }
public static byte* TableGetColumnName(int columnN)
{
byte* ret = ImGuiNative.TableGetColumnName(columnN);
return ret;
}
public static byte* TableGetColumnName()
{
byte* ret = ImGuiNative.TableGetColumnName((int)(-1));
return ret;
}
public static string TableGetColumnNameS()
{
string ret = Utils.DecodeStringUTF8(ImGuiNative.TableGetColumnName((int)(-1)));
return ret;
}
public static string TableGetColumnNameS(int columnN)
{
string ret = Utils.DecodeStringUTF8(ImGuiNative.TableGetColumnName(columnN));
return ret;
}
public static ImGuiTableColumnFlags TableGetColumnFlags(int columnN) public static ImGuiTableColumnFlags TableGetColumnFlags(int columnN)
{ {
ImGuiTableColumnFlags ret = ImGuiNative.TableGetColumnFlags(columnN); ImGuiTableColumnFlags ret = ImGuiNative.TableGetColumnFlags(columnN);
@ -2446,16 +2416,6 @@ public unsafe partial class ImGui
ImDrawListSharedDataPtr ret = ImGuiNative.GetDrawListSharedData(); ImDrawListSharedDataPtr ret = ImGuiNative.GetDrawListSharedData();
return ret; return ret;
} }
public static byte* GetStyleColorName(ImGuiCol idx)
{
byte* ret = ImGuiNative.GetStyleColorName(idx);
return ret;
}
public static string GetStyleColorNameS(ImGuiCol idx)
{
string ret = Utils.DecodeStringUTF8(ImGuiNative.GetStyleColorName(idx));
return ret;
}
public static void SetStateStorage(ImGuiStoragePtr storage) public static void SetStateStorage(ImGuiStoragePtr storage)
{ {
ImGuiNative.SetStateStorage(storage); ImGuiNative.SetStateStorage(storage);
@ -2669,16 +2629,6 @@ public unsafe partial class ImGui
int ret = ImGuiNative.GetKeyPressedAmount(key, repeatDelay, rate); int ret = ImGuiNative.GetKeyPressedAmount(key, repeatDelay, rate);
return ret; return ret;
} }
public static byte* GetKeyName(ImGuiKey key)
{
byte* ret = ImGuiNative.GetKeyName(key);
return ret;
}
public static string GetKeyNameS(ImGuiKey key)
{
string ret = Utils.DecodeStringUTF8(ImGuiNative.GetKeyName(key));
return ret;
}
public static void SetNextFrameWantCaptureKeyboard(bool wantCaptureKeyboard) public static void SetNextFrameWantCaptureKeyboard(bool wantCaptureKeyboard)
{ {
ImGuiNative.SetNextFrameWantCaptureKeyboard(wantCaptureKeyboard ? (byte)1 : (byte)0); ImGuiNative.SetNextFrameWantCaptureKeyboard(wantCaptureKeyboard ? (byte)1 : (byte)0);
@ -2879,36 +2829,6 @@ public unsafe partial class ImGui
{ {
ImGuiNative.SetNextFrameWantCaptureMouse(wantCaptureMouse ? (byte)1 : (byte)0); ImGuiNative.SetNextFrameWantCaptureMouse(wantCaptureMouse ? (byte)1 : (byte)0);
} }
public static byte* GetClipboardText()
{
byte* ret = ImGuiNative.GetClipboardText();
return ret;
}
public static string GetClipboardTextS()
{
string ret = Utils.DecodeStringUTF8(ImGuiNative.GetClipboardText());
return ret;
}
public static byte* SaveIniSettingsToMemory(nuint* outIniSize)
{
byte* ret = ImGuiNative.SaveIniSettingsToMemory(outIniSize);
return ret;
}
public static byte* SaveIniSettingsToMemory()
{
byte* ret = ImGuiNative.SaveIniSettingsToMemory((nuint*)(default));
return ret;
}
public static string SaveIniSettingsToMemoryS()
{
string ret = Utils.DecodeStringUTF8(ImGuiNative.SaveIniSettingsToMemory((nuint*)(default)));
return ret;
}
public static string SaveIniSettingsToMemoryS(nuint* outIniSize)
{
string ret = Utils.DecodeStringUTF8(ImGuiNative.SaveIniSettingsToMemory(outIniSize));
return ret;
}
public static void SetAllocatorFunctions(ImGuiMemAllocFunc allocFunc, ImGuiMemFreeFunc freeFunc, void* userData) public static void SetAllocatorFunctions(ImGuiMemAllocFunc allocFunc, ImGuiMemFreeFunc freeFunc, void* userData)
{ {
ImGuiNative.SetAllocatorFunctions(allocFunc, freeFunc, userData); ImGuiNative.SetAllocatorFunctions(allocFunc, freeFunc, userData);
@ -3393,58 +3313,6 @@ public unsafe partial class ImGui
ImGuiTextBufferPtr ret = ImGuiNative.ImGuiTextBuffer(); ImGuiTextBufferPtr ret = ImGuiNative.ImGuiTextBuffer();
return ret; return ret;
} }
public static byte* begin(ImGuiTextBufferPtr self)
{
byte* ret = ImGuiNative.begin(self);
return ret;
}
public static byte* begin(ref ImGuiTextBuffer self)
{
fixed (ImGuiTextBuffer* pself = &self)
{
byte* ret = ImGuiNative.begin((ImGuiTextBuffer*)pself);
return ret;
}
}
public static string beginS(ImGuiTextBufferPtr self)
{
string ret = Utils.DecodeStringUTF8(ImGuiNative.begin(self));
return ret;
}
public static string beginS(ref ImGuiTextBuffer self)
{
fixed (ImGuiTextBuffer* pself = &self)
{
string ret = Utils.DecodeStringUTF8(ImGuiNative.begin((ImGuiTextBuffer*)pself));
return ret;
}
}
public static byte* end(ImGuiTextBufferPtr self)
{
byte* ret = ImGuiNative.end(self);
return ret;
}
public static byte* end(ref ImGuiTextBuffer self)
{
fixed (ImGuiTextBuffer* pself = &self)
{
byte* ret = ImGuiNative.end((ImGuiTextBuffer*)pself);
return ret;
}
}
public static string endS(ImGuiTextBufferPtr self)
{
string ret = Utils.DecodeStringUTF8(ImGuiNative.end(self));
return ret;
}
public static string endS(ref ImGuiTextBuffer self)
{
fixed (ImGuiTextBuffer* pself = &self)
{
string ret = Utils.DecodeStringUTF8(ImGuiNative.end((ImGuiTextBuffer*)pself));
return ret;
}
}
public static int size(ImGuiTextBufferPtr self) public static int size(ImGuiTextBufferPtr self)
{ {
int ret = ImGuiNative.size(self); int ret = ImGuiNative.size(self);
@ -3480,32 +3348,6 @@ public unsafe partial class ImGui
ImGuiNative.reserve((ImGuiTextBuffer*)pself, capacity); ImGuiNative.reserve((ImGuiTextBuffer*)pself, capacity);
} }
} }
public static byte* c_str(ImGuiTextBufferPtr self)
{
byte* ret = ImGuiNative.c_str(self);
return ret;
}
public static byte* c_str(ref ImGuiTextBuffer self)
{
fixed (ImGuiTextBuffer* pself = &self)
{
byte* ret = ImGuiNative.c_str((ImGuiTextBuffer*)pself);
return ret;
}
}
public static string c_strS(ImGuiTextBufferPtr self)
{
string ret = Utils.DecodeStringUTF8(ImGuiNative.c_str(self));
return ret;
}
public static string c_strS(ref ImGuiTextBuffer self)
{
fixed (ImGuiTextBuffer* pself = &self)
{
string ret = Utils.DecodeStringUTF8(ImGuiNative.c_str((ImGuiTextBuffer*)pself));
return ret;
}
}
public static ImGuiStoragePairPtr ImGuiStoragePair(uint key, int valI) public static ImGuiStoragePairPtr ImGuiStoragePair(uint key, int valI)
{ {
ImGuiStoragePairPtr ret = ImGuiNative.ImGuiStoragePair(key, valI); ImGuiStoragePairPtr ret = ImGuiNative.ImGuiStoragePair(key, valI);
@ -8517,32 +8359,6 @@ public unsafe partial class ImGui
return ret != 0; return ret != 0;
} }
} }
public static byte* GetDebugName(ImFontPtr self)
{
byte* ret = ImGuiNative.GetDebugName(self);
return ret;
}
public static byte* GetDebugName(ref ImFont self)
{
fixed (ImFont* pself = &self)
{
byte* ret = ImGuiNative.GetDebugName((ImFont*)pself);
return ret;
}
}
public static string GetDebugNameS(ImFontPtr self)
{
string ret = Utils.DecodeStringUTF8(ImGuiNative.GetDebugName(self));
return ret;
}
public static string GetDebugNameS(ref ImFont self)
{
fixed (ImFont* pself = &self)
{
string ret = Utils.DecodeStringUTF8(ImGuiNative.GetDebugName((ImFont*)pself));
return ret;
}
}
public static void RenderChar(ImFontPtr self, ImDrawListPtr drawList, float size, Vector2 pos, uint col, ushort c) public static void RenderChar(ImFontPtr self, ImDrawListPtr drawList, float size, Vector2 pos, uint col, ushort c)
{ {
ImGuiNative.RenderChar(self, drawList, size, pos, col, c); ImGuiNative.RenderChar(self, drawList, size, pos, col, c);
@ -8896,6 +8712,7 @@ public unsafe partial class ImGui
// DISCARDED: internal static void appendfNative(ImGuiTextBuffer* buffer, byte* fmt) // DISCARDED: internal static void appendfNative(ImGuiTextBuffer* buffer, byte* fmt)
// DISCARDED: internal static void appendfvNative(ImGuiTextBuffer* self, byte* fmt, nuint args) // DISCARDED: internal static void appendfvNative(ImGuiTextBuffer* self, byte* fmt, nuint args)
// DISCARDED: internal static byte ArrowButtonNative(byte* strId, ImGuiDir dir) // DISCARDED: internal static byte ArrowButtonNative(byte* strId, ImGuiDir dir)
// DISCARDED: internal static byte* beginNative(ImGuiTextBuffer* self)
// DISCARDED: internal static byte BeginNative(byte* name, bool* pOpen, ImGuiWindowFlags flags) // DISCARDED: internal static byte BeginNative(byte* name, bool* pOpen, ImGuiWindowFlags flags)
// DISCARDED: internal static void BeginNative(ImGuiListClipper* self, int itemsCount, float itemsHeight) // DISCARDED: internal static void BeginNative(ImGuiListClipper* self, int itemsCount, float itemsHeight)
// DISCARDED: internal static byte BeginChildNative(byte* strId, Vector2 size, byte border, ImGuiWindowFlags flags) // DISCARDED: internal static byte BeginChildNative(byte* strId, Vector2 size, byte border, ImGuiWindowFlags flags)
@ -8908,12 +8725,15 @@ public unsafe partial class ImGui
// DISCARDED: internal static byte BeginPopupContextVoidNative(byte* strId, ImGuiPopupFlags popupFlags) // DISCARDED: internal static byte BeginPopupContextVoidNative(byte* strId, ImGuiPopupFlags popupFlags)
// DISCARDED: internal static byte BeginPopupContextWindowNative(byte* strId, ImGuiPopupFlags popupFlags) // DISCARDED: internal static byte BeginPopupContextWindowNative(byte* strId, ImGuiPopupFlags popupFlags)
// DISCARDED: internal static byte BeginPopupModalNative(byte* name, bool* pOpen, ImGuiWindowFlags flags) // DISCARDED: internal static byte BeginPopupModalNative(byte* name, bool* pOpen, ImGuiWindowFlags flags)
// DISCARDED: beginS
// DISCARDED: internal static byte BeginTabBarNative(byte* strId, ImGuiTabBarFlags flags) // DISCARDED: internal static byte BeginTabBarNative(byte* strId, ImGuiTabBarFlags flags)
// DISCARDED: internal static byte BeginTabItemNative(byte* label, bool* pOpen, ImGuiTabItemFlags flags) // DISCARDED: internal static byte BeginTabItemNative(byte* label, bool* pOpen, ImGuiTabItemFlags flags)
// DISCARDED: internal static byte BeginTableNative(byte* strId, int column, ImGuiTableFlags flags, Vector2 outerSize, float innerWidth) // DISCARDED: internal static byte BeginTableNative(byte* strId, int column, ImGuiTableFlags flags, Vector2 outerSize, float innerWidth)
// DISCARDED: internal static void BulletTextNative(byte* fmt) // DISCARDED: internal static void BulletTextNative(byte* fmt)
// DISCARDED: internal static void BulletTextVNative(byte* fmt, nuint args) // DISCARDED: internal static void BulletTextVNative(byte* fmt, nuint args)
// DISCARDED: internal static byte ButtonNative(byte* label, Vector2 size) // DISCARDED: internal static byte ButtonNative(byte* label, Vector2 size)
// DISCARDED: internal static byte* c_strNative(ImGuiTextBuffer* self)
// DISCARDED: c_strS
// DISCARDED: internal static void CalcTextSizeNative(Vector2* pOut, byte* text, byte* textEnd, byte hideTextAfterDoubleHash, float wrapWidth) // DISCARDED: internal static void CalcTextSizeNative(Vector2* pOut, byte* text, byte* textEnd, byte hideTextAfterDoubleHash, float wrapWidth)
// DISCARDED: internal static void CalcTextSizeANative(Vector2* pOut, ImFont* self, float size, float maxWidth, float wrapWidth, byte* textBegin, byte* textEnd, byte** remaining) // DISCARDED: internal static void CalcTextSizeANative(Vector2* pOut, ImFont* self, float size, float maxWidth, float wrapWidth, byte* textBegin, byte* textEnd, byte** remaining)
// DISCARDED: internal static byte* CalcWordWrapPositionANative(ImFont* self, float scale, byte* text, byte* textEnd, float wrapWidth) // DISCARDED: internal static byte* CalcWordWrapPositionANative(ImFont* self, float scale, byte* text, byte* textEnd, float wrapWidth)
@ -8947,12 +8767,24 @@ public unsafe partial class ImGui
// DISCARDED: internal static byte DragScalarNative(byte* label, ImGuiDataType dataType, void* pData, float vSpeed, void* pMin, void* pMax, byte* format, ImGuiSliderFlags flags) // DISCARDED: internal static byte DragScalarNative(byte* label, ImGuiDataType dataType, void* pData, float vSpeed, void* pMin, void* pMax, byte* format, ImGuiSliderFlags flags)
// DISCARDED: internal static byte DragScalarNNative(byte* label, ImGuiDataType dataType, void* pData, int components, float vSpeed, void* pMin, void* pMax, byte* format, ImGuiSliderFlags flags) // DISCARDED: internal static byte DragScalarNNative(byte* label, ImGuiDataType dataType, void* pData, int components, float vSpeed, void* pMin, void* pMax, byte* format, ImGuiSliderFlags flags)
// DISCARDED: internal static byte DrawNative(ImGuiTextFilter* self, byte* label, float width) // DISCARDED: internal static byte DrawNative(ImGuiTextFilter* self, byte* label, float width)
// DISCARDED: internal static byte* endNative(ImGuiTextBuffer* self)
// DISCARDED: endS
// DISCARDED: internal static bool* GetBoolRefNative(ImGuiStorage* self, uint key, byte defaultVal) // DISCARDED: internal static bool* GetBoolRefNative(ImGuiStorage* self, uint key, byte defaultVal)
// DISCARDED: internal static byte* GetClipboardTextNative()
// DISCARDED: GetClipboardTextS
// DISCARDED: internal static byte* GetDebugNameNative(ImFont* self)
// DISCARDED: GetDebugNameS
// DISCARDED: internal static float* GetFloatRefNative(ImGuiStorage* self, uint key, float defaultVal) // DISCARDED: internal static float* GetFloatRefNative(ImGuiStorage* self, uint key, float defaultVal)
// DISCARDED: internal static uint GetIDNative(byte* strId) // DISCARDED: internal static uint GetIDNative(byte* strId)
// DISCARDED: internal static uint GetIDNative(byte* strIdBegin, byte* strIdEnd) // DISCARDED: internal static uint GetIDNative(byte* strIdBegin, byte* strIdEnd)
// DISCARDED: internal static uint GetIDNative(void* ptrId) // DISCARDED: internal static uint GetIDNative(void* ptrId)
// DISCARDED: internal static int* GetIntRefNative(ImGuiStorage* self, uint key, int defaultVal) // DISCARDED: internal static int* GetIntRefNative(ImGuiStorage* self, uint key, int defaultVal)
// DISCARDED: internal static byte* GetKeyNameNative(ImGuiKey key)
// DISCARDED: GetKeyNameS
// DISCARDED: internal static byte* GetStyleColorNameNative(ImGuiCol idx)
// DISCARDED: GetStyleColorNameS
// DISCARDED: internal static byte* GetVersionNative()
// DISCARDED: GetVersionS
// DISCARDED: internal static void** GetVoidPtrRefNative(ImGuiStorage* self, uint key, void* defaultVal) // DISCARDED: internal static void** GetVoidPtrRefNative(ImGuiStorage* self, uint key, void* defaultVal)
// DISCARDED: internal static ImGuiTextFilter* ImGuiTextFilterNative(byte* defaultFilter) // DISCARDED: internal static ImGuiTextFilter* ImGuiTextFilterNative(byte* defaultFilter)
// DISCARDED: internal static ImGuiTextRange* ImGuiTextRangeNative() // DISCARDED: internal static ImGuiTextRange* ImGuiTextRangeNative()
@ -9000,6 +8832,8 @@ public unsafe partial class ImGui
// DISCARDED: internal static byte RadioButtonNative(byte* label, int* v, int vButton) // DISCARDED: internal static byte RadioButtonNative(byte* label, int* v, int vButton)
// DISCARDED: internal static void RenderTextNative(ImFont* self, ImDrawList* drawList, float size, Vector2 pos, uint col, Vector4 clipRect, byte* textBegin, byte* textEnd, float wrapWidth, byte cpuFineClip) // DISCARDED: internal static void RenderTextNative(ImFont* self, ImDrawList* drawList, float size, Vector2 pos, uint col, Vector4 clipRect, byte* textBegin, byte* textEnd, float wrapWidth, byte cpuFineClip)
// DISCARDED: internal static void SaveIniSettingsToDiskNative(byte* iniFilename) // DISCARDED: internal static void SaveIniSettingsToDiskNative(byte* iniFilename)
// DISCARDED: internal static byte* SaveIniSettingsToMemoryNative(nuint* outIniSize)
// DISCARDED: SaveIniSettingsToMemoryS
// DISCARDED: internal static byte SelectableNative(byte* label, byte selected, ImGuiSelectableFlags flags, Vector2 size) // DISCARDED: internal static byte SelectableNative(byte* label, byte selected, ImGuiSelectableFlags flags, Vector2 size)
// DISCARDED: internal static byte SelectableNative(byte* label, bool* pSelected, ImGuiSelectableFlags flags, Vector2 size) // DISCARDED: internal static byte SelectableNative(byte* label, bool* pSelected, ImGuiSelectableFlags flags, Vector2 size)
// DISCARDED: internal static void SetClipboardTextNative(byte* text) // DISCARDED: internal static void SetClipboardTextNative(byte* text)
@ -9030,6 +8864,8 @@ public unsafe partial class ImGui
// DISCARDED: internal static byte SliderScalarNNative(byte* label, ImGuiDataType dataType, void* pData, int components, void* pMin, void* pMax, byte* format, ImGuiSliderFlags flags) // DISCARDED: internal static byte SliderScalarNNative(byte* label, ImGuiDataType dataType, void* pData, int components, void* pMin, void* pMax, byte* format, ImGuiSliderFlags flags)
// DISCARDED: internal static byte SmallButtonNative(byte* label) // DISCARDED: internal static byte SmallButtonNative(byte* label)
// DISCARDED: internal static byte TabItemButtonNative(byte* label, ImGuiTabItemFlags flags) // DISCARDED: internal static byte TabItemButtonNative(byte* label, ImGuiTabItemFlags flags)
// DISCARDED: internal static byte* TableGetColumnNameNative(int columnN)
// DISCARDED: TableGetColumnNameS
// DISCARDED: internal static void TableHeaderNative(byte* label) // DISCARDED: internal static void TableHeaderNative(byte* label)
// DISCARDED: internal static void TableSetupColumnNative(byte* label, ImGuiTableColumnFlags flags, float initWidthOrWeight, uint userId) // DISCARDED: internal static void TableSetupColumnNative(byte* label, ImGuiTableColumnFlags flags, float initWidthOrWeight, uint userId)
// DISCARDED: internal static void TextNative(byte* fmt) // DISCARDED: internal static void TextNative(byte* fmt)

View file

@ -94,22 +94,6 @@ public unsafe partial struct ImFont
return ret; return ret;
} }
} }
public unsafe byte* GetDebugName()
{
fixed (ImFont* @this = &this)
{
byte* ret = ImGuiNative.GetDebugName(@this);
return ret;
}
}
public unsafe string GetDebugNameS()
{
fixed (ImFont* @this = &this)
{
string ret = Utils.DecodeStringUTF8(ImGuiNative.GetDebugName(@this));
return ret;
}
}
public unsafe float GetDistanceAdjustmentForPair(ushort leftC, ushort rightC) public unsafe float GetDistanceAdjustmentForPair(ushort leftC, ushort rightC)
{ {
fixed (ImFont* @this = &this) fixed (ImFont* @this = &this)
@ -187,5 +171,7 @@ public unsafe partial struct ImFont
} }
// DISCARDED: CalcWordWrapPositionA // DISCARDED: CalcWordWrapPositionA
// DISCARDED: CalcWordWrapPositionAS // DISCARDED: CalcWordWrapPositionAS
// DISCARDED: GetDebugName
// DISCARDED: GetDebugNameS
// DISCARDED: RenderText // DISCARDED: RenderText

View file

@ -61,16 +61,6 @@ public unsafe partial struct ImFontPtr
float ret = ImGuiNative.GetCharAdvance(Handle, c); float ret = ImGuiNative.GetCharAdvance(Handle, c);
return ret; return ret;
} }
public unsafe byte* GetDebugName()
{
byte* ret = ImGuiNative.GetDebugName(Handle);
return ret;
}
public unsafe string GetDebugNameS()
{
string ret = Utils.DecodeStringUTF8(ImGuiNative.GetDebugName(Handle));
return ret;
}
public unsafe float GetDistanceAdjustmentForPair(ushort leftC, ushort rightC) public unsafe float GetDistanceAdjustmentForPair(ushort leftC, ushort rightC)
{ {
float ret = ImGuiNative.GetDistanceAdjustmentForPair(Handle, leftC, rightC); float ret = ImGuiNative.GetDistanceAdjustmentForPair(Handle, leftC, rightC);
@ -121,5 +111,7 @@ public unsafe partial struct ImFontPtr
} }
// DISCARDED: CalcWordWrapPositionA // DISCARDED: CalcWordWrapPositionA
// DISCARDED: CalcWordWrapPositionAS // DISCARDED: CalcWordWrapPositionAS
// DISCARDED: GetDebugName
// DISCARDED: GetDebugNameS
// DISCARDED: RenderText // DISCARDED: RenderText

View file

@ -11,38 +11,6 @@ namespace Dalamud.Bindings.ImGui;
public unsafe partial struct ImGuiTextBuffer public unsafe partial struct ImGuiTextBuffer
{ {
public unsafe byte* begin()
{
fixed (ImGuiTextBuffer* @this = &this)
{
byte* ret = ImGuiNative.begin(@this);
return ret;
}
}
public unsafe string beginS()
{
fixed (ImGuiTextBuffer* @this = &this)
{
string ret = Utils.DecodeStringUTF8(ImGuiNative.begin(@this));
return ret;
}
}
public unsafe byte* c_str()
{
fixed (ImGuiTextBuffer* @this = &this)
{
byte* ret = ImGuiNative.c_str(@this);
return ret;
}
}
public unsafe string c_strS()
{
fixed (ImGuiTextBuffer* @this = &this)
{
string ret = Utils.DecodeStringUTF8(ImGuiNative.c_str(@this));
return ret;
}
}
public unsafe void clear() public unsafe void clear()
{ {
fixed (ImGuiTextBuffer* @this = &this) fixed (ImGuiTextBuffer* @this = &this)
@ -65,22 +33,6 @@ public unsafe partial struct ImGuiTextBuffer
return ret != 0; return ret != 0;
} }
} }
public unsafe byte* end()
{
fixed (ImGuiTextBuffer* @this = &this)
{
byte* ret = ImGuiNative.end(@this);
return ret;
}
}
public unsafe string endS()
{
fixed (ImGuiTextBuffer* @this = &this)
{
string ret = Utils.DecodeStringUTF8(ImGuiNative.end(@this));
return ret;
}
}
public unsafe void reserve(int capacity) public unsafe void reserve(int capacity)
{ {
fixed (ImGuiTextBuffer* @this = &this) fixed (ImGuiTextBuffer* @this = &this)
@ -100,4 +52,10 @@ public unsafe partial struct ImGuiTextBuffer
// DISCARDED: append // DISCARDED: append
// DISCARDED: appendf // DISCARDED: appendf
// DISCARDED: appendfv // DISCARDED: appendfv
// DISCARDED: begin
// DISCARDED: beginS
// DISCARDED: c_str
// DISCARDED: c_strS
// DISCARDED: end
// DISCARDED: endS

View file

@ -11,26 +11,6 @@ namespace Dalamud.Bindings.ImGui;
public unsafe partial struct ImGuiTextBufferPtr public unsafe partial struct ImGuiTextBufferPtr
{ {
public unsafe byte* begin()
{
byte* ret = ImGuiNative.begin(Handle);
return ret;
}
public unsafe string beginS()
{
string ret = Utils.DecodeStringUTF8(ImGuiNative.begin(Handle));
return ret;
}
public unsafe byte* c_str()
{
byte* ret = ImGuiNative.c_str(Handle);
return ret;
}
public unsafe string c_strS()
{
string ret = Utils.DecodeStringUTF8(ImGuiNative.c_str(Handle));
return ret;
}
public unsafe void clear() public unsafe void clear()
{ {
ImGuiNative.clear(Handle); ImGuiNative.clear(Handle);
@ -44,16 +24,6 @@ public unsafe partial struct ImGuiTextBufferPtr
byte ret = ImGuiNative.empty(Handle); byte ret = ImGuiNative.empty(Handle);
return ret != 0; return ret != 0;
} }
public unsafe byte* end()
{
byte* ret = ImGuiNative.end(Handle);
return ret;
}
public unsafe string endS()
{
string ret = Utils.DecodeStringUTF8(ImGuiNative.end(Handle));
return ret;
}
public unsafe void reserve(int capacity) public unsafe void reserve(int capacity)
{ {
ImGuiNative.reserve(Handle, capacity); ImGuiNative.reserve(Handle, capacity);
@ -67,4 +37,10 @@ public unsafe partial struct ImGuiTextBufferPtr
// DISCARDED: append // DISCARDED: append
// DISCARDED: appendf // DISCARDED: appendf
// DISCARDED: appendfv // DISCARDED: appendfv
// DISCARDED: begin
// DISCARDED: beginS
// DISCARDED: c_str
// DISCARDED: c_strS
// DISCARDED: end
// DISCARDED: endS

View file

@ -50,48 +50,6 @@ public unsafe partial class ImGuiP
byte ret = ImGuiPNative.ImCharIsBlankW(c); byte ret = ImGuiPNative.ImCharIsBlankW(c);
return ret != 0; return ret != 0;
} }
public static byte* ImTextCharToUtf8(byte* outBuf, uint c)
{
byte* ret = ImGuiPNative.ImTextCharToUtf8(outBuf, c);
return ret;
}
public static byte* ImTextCharToUtf8(ref byte outBuf, uint c)
{
fixed (byte* poutBuf = &outBuf)
{
byte* ret = ImGuiPNative.ImTextCharToUtf8((byte*)poutBuf, c);
return ret;
}
}
public static byte* ImTextCharToUtf8(ReadOnlySpan<byte> outBuf, uint c)
{
fixed (byte* poutBuf = outBuf)
{
byte* ret = ImGuiPNative.ImTextCharToUtf8((byte*)poutBuf, c);
return ret;
}
}
public static string ImTextCharToUtf8S(byte* outBuf, uint c)
{
string ret = Utils.DecodeStringUTF8(ImGuiPNative.ImTextCharToUtf8(outBuf, c));
return ret;
}
public static string ImTextCharToUtf8S(ref byte outBuf, uint c)
{
fixed (byte* poutBuf = &outBuf)
{
string ret = Utils.DecodeStringUTF8(ImGuiPNative.ImTextCharToUtf8((byte*)poutBuf, c));
return ret;
}
}
public static string ImTextCharToUtf8S(ReadOnlySpan<byte> outBuf, uint c)
{
fixed (byte* poutBuf = outBuf)
{
string ret = Utils.DecodeStringUTF8(ImGuiPNative.ImTextCharToUtf8((byte*)poutBuf, c));
return ret;
}
}
public static int ImTextCountUtf8BytesFromStr(ushort* inText, ushort* inTextEnd) public static int ImTextCountUtf8BytesFromStr(ushort* inText, ushort* inTextEnd)
{ {
int ret = ImGuiPNative.ImTextCountUtf8BytesFromStr(inText, inTextEnd); int ret = ImGuiPNative.ImTextCountUtf8BytesFromStr(inText, inTextEnd);
@ -2159,32 +2117,6 @@ public unsafe partial class ImGuiP
ImGuiWindowSettingsPtr ret = ImGuiPNative.ImGuiWindowSettings(); ImGuiWindowSettingsPtr ret = ImGuiPNative.ImGuiWindowSettings();
return ret; return ret;
} }
public static byte* GetName(ImGuiWindowSettingsPtr self)
{
byte* ret = ImGuiPNative.GetName(self);
return ret;
}
public static byte* GetName(ref ImGuiWindowSettings self)
{
fixed (ImGuiWindowSettings* pself = &self)
{
byte* ret = ImGuiPNative.GetName((ImGuiWindowSettings*)pself);
return ret;
}
}
public static string GetNameS(ImGuiWindowSettingsPtr self)
{
string ret = Utils.DecodeStringUTF8(ImGuiPNative.GetName(self));
return ret;
}
public static string GetNameS(ref ImGuiWindowSettings self)
{
fixed (ImGuiWindowSettings* pself = &self)
{
string ret = Utils.DecodeStringUTF8(ImGuiPNative.GetName((ImGuiWindowSettings*)pself));
return ret;
}
}
public static ImGuiSettingsHandlerPtr ImGuiSettingsHandler() public static ImGuiSettingsHandlerPtr ImGuiSettingsHandler()
{ {
ImGuiSettingsHandlerPtr ret = ImGuiPNative.ImGuiSettingsHandler(); ImGuiSettingsHandlerPtr ret = ImGuiPNative.ImGuiSettingsHandler();
@ -2403,70 +2335,6 @@ public unsafe partial class ImGuiP
} }
} }
} }
public static byte* GetTabName(ImGuiTabBarPtr self, ImGuiTabItemPtr tab)
{
byte* ret = ImGuiPNative.GetTabName(self, tab);
return ret;
}
public static byte* GetTabName(ref ImGuiTabBar self, ImGuiTabItemPtr tab)
{
fixed (ImGuiTabBar* pself = &self)
{
byte* ret = ImGuiPNative.GetTabName((ImGuiTabBar*)pself, tab);
return ret;
}
}
public static byte* GetTabName(ImGuiTabBarPtr self, ref ImGuiTabItem tab)
{
fixed (ImGuiTabItem* ptab = &tab)
{
byte* ret = ImGuiPNative.GetTabName(self, (ImGuiTabItem*)ptab);
return ret;
}
}
public static byte* GetTabName(ref ImGuiTabBar self, ref ImGuiTabItem tab)
{
fixed (ImGuiTabBar* pself = &self)
{
fixed (ImGuiTabItem* ptab = &tab)
{
byte* ret = ImGuiPNative.GetTabName((ImGuiTabBar*)pself, (ImGuiTabItem*)ptab);
return ret;
}
}
}
public static string GetTabNameS(ImGuiTabBarPtr self, ImGuiTabItemPtr tab)
{
string ret = Utils.DecodeStringUTF8(ImGuiPNative.GetTabName(self, tab));
return ret;
}
public static string GetTabNameS(ref ImGuiTabBar self, ImGuiTabItemPtr tab)
{
fixed (ImGuiTabBar* pself = &self)
{
string ret = Utils.DecodeStringUTF8(ImGuiPNative.GetTabName((ImGuiTabBar*)pself, tab));
return ret;
}
}
public static string GetTabNameS(ImGuiTabBarPtr self, ref ImGuiTabItem tab)
{
fixed (ImGuiTabItem* ptab = &tab)
{
string ret = Utils.DecodeStringUTF8(ImGuiPNative.GetTabName(self, (ImGuiTabItem*)ptab));
return ret;
}
}
public static string GetTabNameS(ref ImGuiTabBar self, ref ImGuiTabItem tab)
{
fixed (ImGuiTabBar* pself = &self)
{
fixed (ImGuiTabItem* ptab = &tab)
{
string ret = Utils.DecodeStringUTF8(ImGuiPNative.GetTabName((ImGuiTabBar*)pself, (ImGuiTabItem*)ptab));
return ret;
}
}
}
public static ImGuiTableColumnPtr ImGuiTableColumn() public static ImGuiTableColumnPtr ImGuiTableColumn()
{ {
ImGuiTableColumnPtr ret = ImGuiPNative.ImGuiTableColumn(); ImGuiTableColumnPtr ret = ImGuiPNative.ImGuiTableColumn();
@ -3900,16 +3768,6 @@ public unsafe partial class ImGuiP
ImGuiPNative.NavMoveRequestTryWrapping((ImGuiWindow*)pwindow, moveFlags); ImGuiPNative.NavMoveRequestTryWrapping((ImGuiWindow*)pwindow, moveFlags);
} }
} }
public static byte* GetNavInputName(ImGuiNavInput n)
{
byte* ret = ImGuiPNative.GetNavInputName(n);
return ret;
}
public static string GetNavInputNameS(ImGuiNavInput n)
{
string ret = Utils.DecodeStringUTF8(ImGuiPNative.GetNavInputName(n));
return ret;
}
public static float GetNavInputAmount(ImGuiNavInput n, ImGuiNavReadMode mode) public static float GetNavInputAmount(ImGuiNavInput n, ImGuiNavReadMode mode)
{ {
float ret = ImGuiPNative.GetNavInputAmount(n, mode); float ret = ImGuiPNative.GetNavInputAmount(n, mode);
@ -5247,32 +5105,6 @@ public unsafe partial class ImGuiP
} }
} }
} }
public static byte* TableGetColumnName(ImGuiTablePtr table, int columnN)
{
byte* ret = ImGuiPNative.TableGetColumnName(table, columnN);
return ret;
}
public static byte* TableGetColumnName(ref ImGuiTable table, int columnN)
{
fixed (ImGuiTable* ptable = &table)
{
byte* ret = ImGuiPNative.TableGetColumnName((ImGuiTable*)ptable, columnN);
return ret;
}
}
public static string TableGetColumnNameS(ImGuiTablePtr table, int columnN)
{
string ret = Utils.DecodeStringUTF8(ImGuiPNative.TableGetColumnName(table, columnN));
return ret;
}
public static string TableGetColumnNameS(ref ImGuiTable table, int columnN)
{
fixed (ImGuiTable* ptable = &table)
{
string ret = Utils.DecodeStringUTF8(ImGuiPNative.TableGetColumnName((ImGuiTable*)ptable, columnN));
return ret;
}
}
public static uint TableGetColumnResizeID(ImGuiTablePtr table, int columnN, int instanceNo) public static uint TableGetColumnResizeID(ImGuiTablePtr table, int columnN, int instanceNo)
{ {
uint ret = ImGuiPNative.TableGetColumnResizeID(table, columnN, instanceNo); uint ret = ImGuiPNative.TableGetColumnResizeID(table, columnN, instanceNo);
@ -6697,6 +6529,12 @@ public unsafe partial class ImGuiP
// DISCARDED: internal static uint GetIDNative(ImGuiWindow* self, void* ptr) // DISCARDED: internal static uint GetIDNative(ImGuiWindow* self, void* ptr)
// DISCARDED: internal static uint GetIDNative(ImGuiWindow* self, int n) // DISCARDED: internal static uint GetIDNative(ImGuiWindow* self, int n)
// DISCARDED: internal static uint GetIDWithSeedNative(byte* strIdBegin, byte* strIdEnd, uint seed) // DISCARDED: internal static uint GetIDWithSeedNative(byte* strIdBegin, byte* strIdEnd, uint seed)
// DISCARDED: internal static byte* GetNameNative(ImGuiWindowSettings* self)
// DISCARDED: GetNameS
// DISCARDED: internal static byte* GetNavInputNameNative(ImGuiNavInput n)
// DISCARDED: GetNavInputNameS
// DISCARDED: internal static byte* GetTabNameNative(ImGuiTabBar* self, ImGuiTabItem* tab)
// DISCARDED: GetTabNameS
// DISCARDED: internal static void* ImFileLoadToMemoryNative(byte* filename, byte* mode, nuint* outFileSize, int paddingBytes) // DISCARDED: internal static void* ImFileLoadToMemoryNative(byte* filename, byte* mode, nuint* outFileSize, int paddingBytes)
// DISCARDED: internal static ImFileHandle ImFileOpenNative(byte* filename, byte* mode) // DISCARDED: internal static ImFileHandle ImFileOpenNative(byte* filename, byte* mode)
// DISCARDED: internal static void ImFontAtlasBuildMultiplyRectAlpha8Native(byte* table, byte* pixels, int x, int y, int w, int h, int stride) // DISCARDED: internal static void ImFontAtlasBuildMultiplyRectAlpha8Native(byte* table, byte* pixels, int x, int y, int w, int h, int stride)
@ -6733,6 +6571,8 @@ public unsafe partial class ImGuiP
// DISCARDED: ImStrSkipBlankS // DISCARDED: ImStrSkipBlankS
// DISCARDED: internal static void ImStrTrimBlanksNative(byte* str) // DISCARDED: internal static void ImStrTrimBlanksNative(byte* str)
// DISCARDED: internal static int ImTextCharFromUtf8Native(uint* outChar, byte* inText, byte* inTextEnd) // DISCARDED: internal static int ImTextCharFromUtf8Native(uint* outChar, byte* inText, byte* inTextEnd)
// DISCARDED: internal static byte* ImTextCharToUtf8Native(byte* outBuf, uint c)
// DISCARDED: ImTextCharToUtf8S
// DISCARDED: internal static int ImTextCountCharsFromUtf8Native(byte* inText, byte* inTextEnd) // DISCARDED: internal static int ImTextCountCharsFromUtf8Native(byte* inText, byte* inTextEnd)
// DISCARDED: internal static int ImTextCountUtf8BytesFromCharNative(byte* inText, byte* inTextEnd) // DISCARDED: internal static int ImTextCountUtf8BytesFromCharNative(byte* inText, byte* inTextEnd)
// DISCARDED: internal static void LogRenderedTextNative(Vector2* refPos, byte* text, byte* textEnd) // DISCARDED: internal static void LogRenderedTextNative(Vector2* refPos, byte* text, byte* textEnd)
@ -6749,6 +6589,8 @@ public unsafe partial class ImGuiP
// DISCARDED: internal static void TabItemCalcSizeNative(Vector2* pOut, byte* label, byte hasCloseButton) // DISCARDED: internal static void TabItemCalcSizeNative(Vector2* pOut, byte* label, byte hasCloseButton)
// DISCARDED: internal static byte TabItemExNative(ImGuiTabBar* tabBar, byte* label, bool* pOpen, ImGuiTabItemFlags flags, ImGuiWindow* dockedWindow) // DISCARDED: internal static byte TabItemExNative(ImGuiTabBar* tabBar, byte* label, bool* pOpen, ImGuiTabItemFlags flags, ImGuiWindow* dockedWindow)
// DISCARDED: internal static void TabItemLabelAndCloseButtonNative(ImDrawList* drawList, ImRect bb, ImGuiTabItemFlags flags, Vector2 framePadding, byte* label, uint tabId, uint closeButtonId, byte isContentsVisible, bool* outJustClosed, bool* outTextClipped) // DISCARDED: internal static void TabItemLabelAndCloseButtonNative(ImDrawList* drawList, ImRect bb, ImGuiTabItemFlags flags, Vector2 framePadding, byte* label, uint tabId, uint closeButtonId, byte isContentsVisible, bool* outJustClosed, bool* outTextClipped)
// DISCARDED: internal static byte* TableGetColumnNameNative(ImGuiTable* table, int columnN)
// DISCARDED: TableGetColumnNameS
// DISCARDED: internal static byte TempInputScalarNative(ImRect bb, uint id, byte* label, ImGuiDataType dataType, void* pData, byte* format, void* pClampMin, void* pClampMax) // DISCARDED: internal static byte TempInputScalarNative(ImRect bb, uint id, byte* label, ImGuiDataType dataType, void* pData, byte* format, void* pClampMin, void* pClampMax)
// DISCARDED: internal static void TextExNative(byte* text, byte* textEnd, ImGuiTextFlags flags) // DISCARDED: internal static void TextExNative(byte* text, byte* textEnd, ImGuiTextFlags flags)
// DISCARDED: internal static byte TreeNodeBehaviorNative(uint id, ImGuiTreeNodeFlags flags, byte* label, byte* labelEnd) // DISCARDED: internal static byte TreeNodeBehaviorNative(uint id, ImGuiTreeNodeFlags flags, byte* label, byte* labelEnd)

View file

@ -0,0 +1,73 @@
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Text;
namespace Dalamud.Bindings.ImGui;
[SuppressMessage("ReSharper", "InconsistentNaming")]
public unsafe partial class ImGui
{
public static ReadOnlySpan<byte> GetVersionU8() =>
MemoryMarshal.CreateReadOnlySpanFromNullTerminated(ImGuiNative.GetVersion());
public static ReadOnlySpan<byte> TableGetColumnNameU8(int columnN = -1) =>
MemoryMarshal.CreateReadOnlySpanFromNullTerminated(ImGuiNative.TableGetColumnName(columnN));
public static ReadOnlySpan<byte> GetStyleColorNameU8(this ImGuiCol idx) =>
MemoryMarshal.CreateReadOnlySpanFromNullTerminated(ImGuiNative.GetStyleColorName(idx));
public static ReadOnlySpan<byte> GetKeyNameU8(this ImGuiKey key) =>
MemoryMarshal.CreateReadOnlySpanFromNullTerminated(ImGuiNative.GetKeyName(key));
public static ReadOnlySpan<byte> GetClipboardTextU8() =>
MemoryMarshal.CreateReadOnlySpanFromNullTerminated(ImGuiNative.GetClipboardText());
public static ReadOnlySpan<byte> SaveIniSettingsToMemoryU8()
{
nuint len;
var ptr = ImGuiNative.SaveIniSettingsToMemory(&len);
return new(ptr, (int)len);
}
public static ref byte begin(this ImGuiTextBufferPtr self) => ref *ImGuiNative.begin(self.Handle);
public static ref byte begin(this in ImGuiTextBuffer self)
{
fixed (ImGuiTextBuffer* selfPtr = &self)
return ref *ImGuiNative.begin(selfPtr);
}
public static ref byte end(this ImGuiTextBufferPtr self) => ref *ImGuiNative.end(self.Handle);
public static ref byte end(this in ImGuiTextBuffer self)
{
fixed (ImGuiTextBuffer* selfPtr = &self)
return ref *ImGuiNative.end(selfPtr);
}
public static ReadOnlySpan<byte> c_str(this ImGuiTextBufferPtr self) => self.Handle->c_str();
public static ReadOnlySpan<byte> c_str(this scoped in ImGuiTextBuffer self)
{
fixed (ImGuiTextBuffer* selfPtr = &self)
return MemoryMarshal.CreateReadOnlySpanFromNullTerminated(ImGuiNative.c_str(selfPtr));
}
public static ReadOnlySpan<byte> GetDebugNameU8(this ImFontPtr self) =>
MemoryMarshal.CreateReadOnlySpanFromNullTerminated(ImGuiNative.GetDebugName(self.Handle));
public static ReadOnlySpan<byte> GetDebugNameU8(this scoped in ImFont self)
{
fixed (ImFont* selfPtr = &self)
return MemoryMarshal.CreateReadOnlySpanFromNullTerminated(ImGuiNative.GetDebugName(selfPtr));
}
public static string GetVersion() => Encoding.UTF8.GetString(GetVersionU8());
public static string TableGetColumnName(int columnN = -1) => Encoding.UTF8.GetString(TableGetColumnNameU8(columnN));
public static string GetStyleColorName(this ImGuiCol idx) => Encoding.UTF8.GetString(GetStyleColorNameU8(idx));
public static string GetKeyName(this ImGuiKey key) => Encoding.UTF8.GetString(GetKeyNameU8(key));
public static string GetClipboardText() => Encoding.UTF8.GetString(GetClipboardTextU8());
public static string SaveIniSettingsToMemory() => Encoding.UTF8.GetString(SaveIniSettingsToMemoryU8());
public static string GetDebugName(this ImFontPtr self) => Encoding.UTF8.GetString(GetDebugNameU8(self));
public static string GetDebugName(this scoped in ImFont self) => Encoding.UTF8.GetString(GetDebugNameU8(self));
}

View file

@ -46,7 +46,7 @@ public static unsafe partial class ImGui
text.Dispose(); text.Dispose();
} }
public static void append(ImGuiTextBufferPtr self, ImU8String str) public static void append(this ImGuiTextBufferPtr self, ImU8String str)
{ {
fixed (byte* strPtr = str.Span) ImGuiNative.append(self.Handle, strPtr, strPtr + str.Length); fixed (byte* strPtr = str.Span) ImGuiNative.append(self.Handle, strPtr, strPtr + str.Length);
str.Dispose(); str.Dispose();

View file

@ -19,14 +19,14 @@ public static unsafe partial class ImGuiNative
} }
} }
[LibraryImport($"{LibraryName}.dll", EntryPoint = "ImDrawList_AddCallback")] [LibraryImport(LibraryName, EntryPoint = "ImDrawList_AddCallback")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void AddCallback( public static partial void AddCallback(
ImDrawList* self, ImDrawList* self,
delegate*<ImDrawList*, ImDrawCmd*, void> callback, delegate*<ImDrawList*, ImDrawCmd*, void> callback,
void* callbackData = null); void* callbackData = null);
[LibraryImport($"{LibraryName}.dll", EntryPoint = "igInputTextEx")] [LibraryImport(LibraryName, EntryPoint = "igInputTextEx")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])] [UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial int InputTextEx( public static partial int InputTextEx(
byte* label, byte* label,

View file

@ -0,0 +1,85 @@
using System.Runtime.InteropServices;
using System.Text;
namespace Dalamud.Bindings.ImGui;
public unsafe partial class ImGuiP
{
public static Span<byte> ImTextCharToUtf8(Span<byte> buf, char c) => ImTextCharToUtf8(buf, (uint)c);
public static Span<byte> ImTextCharToUtf8(Span<byte> buf, int c) => ImTextCharToUtf8(buf, (uint)c);
public static Span<byte> ImTextCharToUtf8(Span<byte> buf, uint c)
{
if (!new Rune(c).TryEncodeToUtf8(buf, out var len))
throw new ArgumentException("Buffer is too small.", nameof(buf));
return buf[..len];
}
public static ReadOnlySpan<byte> GetNameU8(this ImGuiWindowSettingsPtr self) =>
MemoryMarshal.CreateReadOnlySpanFromNullTerminated(ImGuiPNative.GetName(self.Handle));
public static ReadOnlySpan<byte> GetTabNameU8(this ImGuiTabBarPtr self, ImGuiTabItemPtr tab) =>
MemoryMarshal.CreateReadOnlySpanFromNullTerminated(ImGuiPNative.GetTabName(self.Handle, tab.Handle));
public static ReadOnlySpan<byte> GetNavInputNameU8(this ImGuiNavInput n) =>
MemoryMarshal.CreateReadOnlySpanFromNullTerminated(ImGuiPNative.GetNavInputName(n));
public static ReadOnlySpan<byte> TableGetColumnNameU8(this ImGuiTablePtr table, int columnN) =>
MemoryMarshal.CreateReadOnlySpanFromNullTerminated(ImGuiPNative.TableGetColumnName(table.Handle, columnN));
public static ReadOnlySpan<byte> GetNameU8(this in ImGuiWindowSettings self)
{
fixed (ImGuiWindowSettings* selfPtr = &self)
return GetNameU8(selfPtr);
}
public static ReadOnlySpan<byte> GetTabNameU8(ImGuiTabBarPtr self, in ImGuiTabItem tab)
{
fixed (ImGuiTabItem* tabPtr = &tab)
return GetTabNameU8(self, tabPtr);
}
public static ReadOnlySpan<byte> GetTabNameU8(this in ImGuiTabBar self, ImGuiTabItemPtr tab)
{
fixed (ImGuiTabBar* selfPtr = &self)
return GetTabNameU8(selfPtr, tab);
}
public static ReadOnlySpan<byte> GetTabNameU8(this in ImGuiTabBar self, in ImGuiTabItem tab)
{
fixed (ImGuiTabBar* selfPtr = &self)
fixed (ImGuiTabItem* tabPtr = &tab)
return GetTabNameU8(selfPtr, tabPtr);
}
public static ReadOnlySpan<byte> TableGetColumnNameU8(this in ImGuiTable table, int columnN)
{
fixed (ImGuiTable* tablePtr = &table)
return TableGetColumnNameU8(tablePtr, columnN);
}
public static string GetName(this ImGuiWindowSettingsPtr self) => Encoding.UTF8.GetString(GetNameU8(self));
public static string GetTabName(this ImGuiTabBarPtr self, ImGuiTabItemPtr tab) =>
Encoding.UTF8.GetString(GetTabNameU8(self, tab));
public static string GetTabName(this ImGuiTabBarPtr self, in ImGuiTabItem tab) =>
Encoding.UTF8.GetString(GetTabNameU8(self, tab));
public static string GetNavInputName(this ImGuiNavInput n) => Encoding.UTF8.GetString(GetNavInputNameU8(n));
public static string TableGetColumnName(this ImGuiTablePtr table, int columnN) =>
Encoding.UTF8.GetString(TableGetColumnNameU8(table, columnN));
public static string GetName(this in ImGuiWindowSettings self) => Encoding.UTF8.GetString(GetNameU8(self));
public static string GetTabName(this in ImGuiTabBar self, ImGuiTabItemPtr tab) =>
Encoding.UTF8.GetString(GetTabNameU8(self, tab));
public static string GetTabName(this in ImGuiTabBar self, in ImGuiTabItem tab) =>
Encoding.UTF8.GetString(GetTabNameU8(self, tab));
public static string TableGetColumnName(this in ImGuiTable table, int columnN) =>
Encoding.UTF8.GetString(TableGetColumnNameU8(table, columnN));
}

View file

@ -1,7 +1,14 @@
using System.Runtime.CompilerServices;
using System.Text;
namespace Dalamud.Bindings.ImGui; namespace Dalamud.Bindings.ImGui;
public unsafe partial struct ImGuiTextBuffer public unsafe partial struct ImGuiTextBuffer
{ {
public readonly Span<byte> Span => new(this.Buf.Data, this.Buf.Size);
public override readonly string ToString() => Encoding.UTF8.GetString(this.Span);
public void append(ImU8String str) public void append(ImU8String str)
{ {
fixed (ImGuiTextBuffer* thisPtr = &this) fixed (ImGuiTextBuffer* thisPtr = &this)
@ -9,7 +16,11 @@ public unsafe partial struct ImGuiTextBuffer
} }
} }
public partial struct ImGuiTextBufferPtr public unsafe partial struct ImGuiTextBufferPtr
{ {
public readonly Span<byte> Span => new(Unsafe.AsRef(in this).Buf.Data, Unsafe.AsRef(in this).Buf.Size);
public override readonly string ToString() => Encoding.UTF8.GetString(this.Span);
public void append(ImU8String str) => ImGui.append(this, str); public void append(ImU8String str) => ImGui.append(this, str);
} }