mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-31 21:03:43 +01:00
Use LibraryImport for custom ImGuiNative functinos
This commit is contained in:
parent
1a15600a8f
commit
334a02e69a
4 changed files with 72 additions and 41 deletions
|
|
@ -1,3 +1,40 @@
|
|||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Dalamud.Bindings.ImGui;
|
||||
|
||||
public static partial class ImGuiNative;
|
||||
public static unsafe partial class ImGuiNative
|
||||
{
|
||||
private const string LibraryName = "cimgui";
|
||||
|
||||
static ImGuiNative()
|
||||
{
|
||||
if (LibraryName != ImGui.GetLibraryName())
|
||||
{
|
||||
throw new(
|
||||
$"{nameof(LibraryName)}(={LibraryName})" +
|
||||
$" does not match " +
|
||||
$"{nameof(ImGui)}.{nameof(ImGui.GetLibraryName)}(={ImGui.GetLibraryName()})");
|
||||
}
|
||||
}
|
||||
|
||||
[LibraryImport($"{LibraryName}.dll", EntryPoint = "ImDrawList_AddCallback")]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial void AddCallback(
|
||||
ImDrawList* self,
|
||||
delegate*<ImDrawList*, ImDrawCmd*, void> callback,
|
||||
void* callbackData = null);
|
||||
|
||||
[LibraryImport($"{LibraryName}.dll", EntryPoint = "igInputTextEx")]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial int InputTextEx(
|
||||
byte* label,
|
||||
byte* hint,
|
||||
byte* buf,
|
||||
int bufSize,
|
||||
Vector2 sizeArg,
|
||||
ImGuiInputTextFlags flags = ImGuiInputTextFlags.None,
|
||||
delegate* unmanaged[Cdecl]<ImGuiInputTextCallbackData*, int> callback = null,
|
||||
void* userData = null);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue