Skip to content

Commit

Permalink
Generated PInvokes for "_destroy" functions .
Browse files Browse the repository at this point in the history
  • Loading branch information
mellinoe committed Feb 25, 2019
1 parent 1743198 commit 4588142
Show file tree
Hide file tree
Showing 20 changed files with 125 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/CodeGenerator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ static void Main(string[] args)
string ov_cimguiname = val["ov_cimguiname"]?.ToString();
string cimguiname = val["cimguiname"].ToString();
string friendlyName = val["funcname"]?.ToString();
if (cimguiname.EndsWith("_destroy"))
{
friendlyName = "Destroy";
}
if (friendlyName == null) { return null; }

string exportedName = ov_cimguiname;
Expand Down Expand Up @@ -208,6 +212,7 @@ static void Main(string[] args)

string structName = val["stname"].ToString();
bool isConstructor = val.Value<bool>("constructor");
bool isDestructor = val.Value<bool>("destructor");
if (isConstructor)
{
returnType = structName + "*";
Expand All @@ -221,7 +226,8 @@ static void Main(string[] args)
returnType,
structName,
comment,
isConstructor);
isConstructor,
isDestructor);
}).Where(od => od != null).ToArray();

return new FunctionDefinition(name, overloads);
Expand Down Expand Up @@ -1134,6 +1140,7 @@ class OverloadDefinition
public bool IsMemberFunction { get; }
public string Comment { get; }
public bool IsConstructor { get; }
public bool IsDestructor { get; }

public OverloadDefinition(
string exportedName,
Expand All @@ -1143,7 +1150,8 @@ public OverloadDefinition(
string returnType,
string structName,
string comment,
bool isConstructor)
bool isConstructor,
bool isDestructor)
{
ExportedName = exportedName;
FriendlyName = friendlyName;
Expand All @@ -1154,6 +1162,7 @@ public OverloadDefinition(
IsMemberFunction = structName != "ImGui";
Comment = comment;
IsConstructor = isConstructor;
IsDestructor = isDestructor;
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/ImGui.NET/Generated/CustomRect.gen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ public unsafe partial struct CustomRectPtr
public ref float GlyphAdvanceX => ref Unsafe.AsRef<float>(&NativePtr->GlyphAdvanceX);
public ref Vector2 GlyphOffset => ref Unsafe.AsRef<Vector2>(&NativePtr->GlyphOffset);
public ImFontPtr Font => new ImFontPtr(NativePtr->Font);
public void Destroy()
{
ImGuiNative.CustomRect_destroy(NativePtr);
}
public bool IsPacked()
{
byte ret = ImGuiNative.CustomRect_IsPacked(NativePtr);
Expand Down
4 changes: 4 additions & 0 deletions src/ImGui.NET/Generated/ImColor.gen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ public unsafe partial struct ImColorPtr
public static implicit operator ImColor* (ImColorPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImColorPtr(IntPtr nativePtr) => new ImColorPtr(nativePtr);
public ref Vector4 Value => ref Unsafe.AsRef<Vector4>(&NativePtr->Value);
public void Destroy()
{
ImGuiNative.ImColor_destroy(NativePtr);
}
public ImColor HSV(float h, float s, float v)
{
float a = 1.0f;
Expand Down
4 changes: 4 additions & 0 deletions src/ImGui.NET/Generated/ImDrawCmd.gen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,9 @@ public unsafe partial struct ImDrawCmdPtr
public ref IntPtr TextureId => ref Unsafe.AsRef<IntPtr>(&NativePtr->TextureId);
public ref IntPtr UserCallback => ref Unsafe.AsRef<IntPtr>(&NativePtr->UserCallback);
public IntPtr UserCallbackData { get => (IntPtr)NativePtr->UserCallbackData; set => NativePtr->UserCallbackData = (void*)value; }
public void Destroy()
{
ImGuiNative.ImDrawCmd_destroy(NativePtr);
}
}
}
4 changes: 4 additions & 0 deletions src/ImGui.NET/Generated/ImDrawData.gen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ public void DeIndexAllBuffers()
{
ImGuiNative.ImDrawData_DeIndexAllBuffers(NativePtr);
}
public void Destroy()
{
ImGuiNative.ImDrawData_destroy(NativePtr);
}
public void ScaleClipRects(Vector2 sc)
{
ImGuiNative.ImDrawData_ScaleClipRects(NativePtr, sc);
Expand Down
4 changes: 4 additions & 0 deletions src/ImGui.NET/Generated/ImDrawList.gen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,10 @@ public ImDrawListPtr CloneOutput()
ImDrawList* ret = ImGuiNative.ImDrawList_CloneOutput(NativePtr);
return new ImDrawListPtr(ret);
}
public void Destroy()
{
ImGuiNative.ImDrawList_destroy(NativePtr);
}
public Vector2 GetClipRectMax()
{
Vector2 ret = ImGuiNative.ImDrawList_GetClipRectMax(NativePtr);
Expand Down
4 changes: 4 additions & 0 deletions src/ImGui.NET/Generated/ImFont.gen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ public void ClearOutputData()
{
ImGuiNative.ImFont_ClearOutputData(NativePtr);
}
public void Destroy()
{
ImGuiNative.ImFont_destroy(NativePtr);
}
public ImFontGlyphPtr FindGlyph(ushort c)
{
ImFontGlyph* ret = ImGuiNative.ImFont_FindGlyph(NativePtr, c);
Expand Down
4 changes: 4 additions & 0 deletions src/ImGui.NET/Generated/ImFontAtlas.gen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,10 @@ public void ClearTexData()
{
ImGuiNative.ImFontAtlas_ClearTexData(NativePtr);
}
public void Destroy()
{
ImGuiNative.ImFontAtlas_destroy(NativePtr);
}
public CustomRect* GetCustomRectByIndex(int index)
{
CustomRect* ret = ImGuiNative.ImFontAtlas_GetCustomRectByIndex(NativePtr, index);
Expand Down
4 changes: 4 additions & 0 deletions src/ImGui.NET/Generated/ImFontConfig.gen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,9 @@ public unsafe partial struct ImFontConfigPtr
public ref float RasterizerMultiply => ref Unsafe.AsRef<float>(&NativePtr->RasterizerMultiply);
public RangeAccessor<byte> Name => new RangeAccessor<byte>(NativePtr->Name, 40);
public ImFontPtr DstFont => new ImFontPtr(NativePtr->DstFont);
public void Destroy()
{
ImGuiNative.ImFontConfig_destroy(NativePtr);
}
}
}
4 changes: 4 additions & 0 deletions src/ImGui.NET/Generated/ImFontGlyphRangesBuilder.gen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ public void BuildRanges(out ImVector out_ranges)
ImGuiNative.ImFontGlyphRangesBuilder_BuildRanges(NativePtr, native_out_ranges);
}
}
public void Destroy()
{
ImGuiNative.ImFontGlyphRangesBuilder_destroy(NativePtr);
}
public bool GetBit(int n)
{
byte ret = ImGuiNative.ImFontGlyphRangesBuilder_GetBit(NativePtr, n);
Expand Down
4 changes: 4 additions & 0 deletions src/ImGui.NET/Generated/ImGuiIO.gen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,9 @@ public void ClearInputCharacters()
{
ImGuiNative.ImGuiIO_ClearInputCharacters(NativePtr);
}
public void Destroy()
{
ImGuiNative.ImGuiIO_destroy(NativePtr);
}
}
}
4 changes: 4 additions & 0 deletions src/ImGui.NET/Generated/ImGuiInputTextCallbackData.gen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ public void DeleteChars(int pos, int bytes_count)
{
ImGuiNative.ImGuiInputTextCallbackData_DeleteChars(NativePtr, pos, bytes_count);
}
public void Destroy()
{
ImGuiNative.ImGuiInputTextCallbackData_destroy(NativePtr);
}
public bool HasSelection()
{
byte ret = ImGuiNative.ImGuiInputTextCallbackData_HasSelection(NativePtr);
Expand Down
4 changes: 4 additions & 0 deletions src/ImGui.NET/Generated/ImGuiListClipper.gen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public void Begin(int items_count, float items_height)
{
ImGuiNative.ImGuiListClipper_Begin(NativePtr, items_count, items_height);
}
public void Destroy()
{
ImGuiNative.ImGuiListClipper_destroy(NativePtr);
}
public void End()
{
ImGuiNative.ImGuiListClipper_End(NativePtr);
Expand Down
Loading

0 comments on commit 4588142

Please sign in to comment.