mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 13:14:17 +01:00
Manual overloads for ImGui functions accepting text (#2319)
* wip2 * Implement AutoUtf8Buffer * reformat * Work on manual bindings * restructure * Name scripts properly * Update utility functions to use ImU8String * add overloads * Add more overloads * Use ImGuiWindow from gen, support AddCallback * Use LibraryImport for custom ImGuiNative functinos * Make manual overloads for string-returning functinos * Make all overloads with self as its first parameter extension methods * Fix overload resolution by removing unnecessary * in => scoped in * Fix compilation errors
This commit is contained in:
parent
0c63541864
commit
c69329f592
293 changed files with 61312 additions and 754 deletions
60
imgui/Dalamud.Bindings.ImGui/Custom/ImGuiStorage.Custom.cs
Normal file
60
imgui/Dalamud.Bindings.ImGui/Custom/ImGuiStorage.Custom.cs
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
namespace Dalamud.Bindings.ImGui;
|
||||
|
||||
public unsafe partial struct ImGuiStorage
|
||||
{
|
||||
public readonly ref bool GetBoolRef(uint key, bool defaultValue = false)
|
||||
{
|
||||
fixed (ImGuiStorage* thisPtr = &this)
|
||||
return ref ImGui.GetBoolRef(thisPtr, key, defaultValue);
|
||||
}
|
||||
|
||||
public readonly ref float GetFloatRef(uint key, float defaultValue = 0.0f)
|
||||
{
|
||||
fixed (ImGuiStorage* thisPtr = &this)
|
||||
return ref ImGui.GetFloatRef(thisPtr, key, defaultValue);
|
||||
}
|
||||
|
||||
public readonly ref int GetIntRef(uint key, int defaultValue = 0)
|
||||
{
|
||||
fixed (ImGuiStorage* thisPtr = &this)
|
||||
return ref ImGui.GetIntRef(thisPtr, key, defaultValue);
|
||||
}
|
||||
|
||||
public readonly ref void* GetVoidPtrRef(uint key, void* defaultValue = null)
|
||||
{
|
||||
fixed (ImGuiStorage* thisPtr = &this)
|
||||
return ref ImGui.GetVoidPtrRef(thisPtr, key, defaultValue);
|
||||
}
|
||||
|
||||
public readonly ref T* GetPtrRef<T>(uint key, T* defaultValue = null) where T : unmanaged
|
||||
{
|
||||
fixed (ImGuiStorage* thisPtr = &this)
|
||||
return ref ImGui.GetPtrRef(thisPtr, key, defaultValue);
|
||||
}
|
||||
|
||||
public readonly ref T GetRef<T>(uint key, T defaultValue = default) where T : unmanaged
|
||||
{
|
||||
fixed (ImGuiStorage* thisPtr = &this)
|
||||
return ref ImGui.GetRef(thisPtr, key, defaultValue);
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe partial struct ImGuiStoragePtr
|
||||
{
|
||||
public readonly ref bool GetBoolRef(uint key, bool defaultValue = false) =>
|
||||
ref ImGui.GetBoolRef(this, key, defaultValue);
|
||||
|
||||
public readonly ref float GetFloatRef(uint key, float defaultValue = 0.0f) =>
|
||||
ref ImGui.GetFloatRef(this, key, defaultValue);
|
||||
|
||||
public readonly ref int GetIntRef(uint key, int defaultValue = 0) => ref ImGui.GetIntRef(this, key, defaultValue);
|
||||
|
||||
public readonly ref void* GetVoidPtrRef(uint key, void* defaultValue = null) =>
|
||||
ref ImGui.GetVoidPtrRef(this, key, defaultValue);
|
||||
|
||||
public readonly ref T* GetPtrRef<T>(uint key, T* defaultValue = null) where T : unmanaged =>
|
||||
ref ImGui.GetPtrRef(this, key, defaultValue);
|
||||
|
||||
public readonly ref T GetRef<T>(uint key, T defaultValue = default) where T : unmanaged =>
|
||||
ref ImGui.GetRef(this, key, defaultValue);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue