Skip to content

Commit 4588142

Browse files
committed
Generated PInvokes for "_destroy" functions .
1 parent 1743198 commit 4588142

20 files changed

+125
-2
lines changed

src/CodeGenerator/Program.cs

+11-2
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,10 @@ static void Main(string[] args)
168168
string ov_cimguiname = val["ov_cimguiname"]?.ToString();
169169
string cimguiname = val["cimguiname"].ToString();
170170
string friendlyName = val["funcname"]?.ToString();
171+
if (cimguiname.EndsWith("_destroy"))
172+
{
173+
friendlyName = "Destroy";
174+
}
171175
if (friendlyName == null) { return null; }
172176

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

209213
string structName = val["stname"].ToString();
210214
bool isConstructor = val.Value<bool>("constructor");
215+
bool isDestructor = val.Value<bool>("destructor");
211216
if (isConstructor)
212217
{
213218
returnType = structName + "*";
@@ -221,7 +226,8 @@ static void Main(string[] args)
221226
returnType,
222227
structName,
223228
comment,
224-
isConstructor);
229+
isConstructor,
230+
isDestructor);
225231
}).Where(od => od != null).ToArray();
226232

227233
return new FunctionDefinition(name, overloads);
@@ -1134,6 +1140,7 @@ class OverloadDefinition
11341140
public bool IsMemberFunction { get; }
11351141
public string Comment { get; }
11361142
public bool IsConstructor { get; }
1143+
public bool IsDestructor { get; }
11371144

11381145
public OverloadDefinition(
11391146
string exportedName,
@@ -1143,7 +1150,8 @@ public OverloadDefinition(
11431150
string returnType,
11441151
string structName,
11451152
string comment,
1146-
bool isConstructor)
1153+
bool isConstructor,
1154+
bool isDestructor)
11471155
{
11481156
ExportedName = exportedName;
11491157
FriendlyName = friendlyName;
@@ -1154,6 +1162,7 @@ public OverloadDefinition(
11541162
IsMemberFunction = structName != "ImGui";
11551163
Comment = comment;
11561164
IsConstructor = isConstructor;
1165+
IsDestructor = isDestructor;
11571166
}
11581167
}
11591168

src/ImGui.NET/Generated/CustomRect.gen.cs

+4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ public unsafe partial struct CustomRectPtr
3232
public ref float GlyphAdvanceX => ref Unsafe.AsRef<float>(&NativePtr->GlyphAdvanceX);
3333
public ref Vector2 GlyphOffset => ref Unsafe.AsRef<Vector2>(&NativePtr->GlyphOffset);
3434
public ImFontPtr Font => new ImFontPtr(NativePtr->Font);
35+
public void Destroy()
36+
{
37+
ImGuiNative.CustomRect_destroy(NativePtr);
38+
}
3539
public bool IsPacked()
3640
{
3741
byte ret = ImGuiNative.CustomRect_IsPacked(NativePtr);

src/ImGui.NET/Generated/ImColor.gen.cs

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ public unsafe partial struct ImColorPtr
1818
public static implicit operator ImColor* (ImColorPtr wrappedPtr) => wrappedPtr.NativePtr;
1919
public static implicit operator ImColorPtr(IntPtr nativePtr) => new ImColorPtr(nativePtr);
2020
public ref Vector4 Value => ref Unsafe.AsRef<Vector4>(&NativePtr->Value);
21+
public void Destroy()
22+
{
23+
ImGuiNative.ImColor_destroy(NativePtr);
24+
}
2125
public ImColor HSV(float h, float s, float v)
2226
{
2327
float a = 1.0f;

src/ImGui.NET/Generated/ImDrawCmd.gen.cs

+4
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,9 @@ public unsafe partial struct ImDrawCmdPtr
2626
public ref IntPtr TextureId => ref Unsafe.AsRef<IntPtr>(&NativePtr->TextureId);
2727
public ref IntPtr UserCallback => ref Unsafe.AsRef<IntPtr>(&NativePtr->UserCallback);
2828
public IntPtr UserCallbackData { get => (IntPtr)NativePtr->UserCallbackData; set => NativePtr->UserCallbackData = (void*)value; }
29+
public void Destroy()
30+
{
31+
ImGuiNative.ImDrawCmd_destroy(NativePtr);
32+
}
2933
}
3034
}

src/ImGui.NET/Generated/ImDrawData.gen.cs

+4
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ public void DeIndexAllBuffers()
3838
{
3939
ImGuiNative.ImDrawData_DeIndexAllBuffers(NativePtr);
4040
}
41+
public void Destroy()
42+
{
43+
ImGuiNative.ImDrawData_destroy(NativePtr);
44+
}
4145
public void ScaleClipRects(Vector2 sc)
4246
{
4347
ImGuiNative.ImDrawData_ScaleClipRects(NativePtr, sc);

src/ImGui.NET/Generated/ImDrawList.gen.cs

+4
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,10 @@ public ImDrawListPtr CloneOutput()
274274
ImDrawList* ret = ImGuiNative.ImDrawList_CloneOutput(NativePtr);
275275
return new ImDrawListPtr(ret);
276276
}
277+
public void Destroy()
278+
{
279+
ImGuiNative.ImDrawList_destroy(NativePtr);
280+
}
277281
public Vector2 GetClipRectMax()
278282
{
279283
Vector2 ret = ImGuiNative.ImDrawList_GetClipRectMax(NativePtr);

src/ImGui.NET/Generated/ImFont.gen.cs

+4
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ public void ClearOutputData()
7070
{
7171
ImGuiNative.ImFont_ClearOutputData(NativePtr);
7272
}
73+
public void Destroy()
74+
{
75+
ImGuiNative.ImFont_destroy(NativePtr);
76+
}
7377
public ImFontGlyphPtr FindGlyph(ushort c)
7478
{
7579
ImFontGlyph* ret = ImGuiNative.ImFont_FindGlyph(NativePtr, c);

src/ImGui.NET/Generated/ImFontAtlas.gen.cs

+4
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,10 @@ public void ClearTexData()
338338
{
339339
ImGuiNative.ImFontAtlas_ClearTexData(NativePtr);
340340
}
341+
public void Destroy()
342+
{
343+
ImGuiNative.ImFontAtlas_destroy(NativePtr);
344+
}
341345
public CustomRect* GetCustomRectByIndex(int index)
342346
{
343347
CustomRect* ret = ImGuiNative.ImFontAtlas_GetCustomRectByIndex(NativePtr, index);

src/ImGui.NET/Generated/ImFontConfig.gen.cs

+4
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,9 @@ public unsafe partial struct ImFontConfigPtr
5252
public ref float RasterizerMultiply => ref Unsafe.AsRef<float>(&NativePtr->RasterizerMultiply);
5353
public RangeAccessor<byte> Name => new RangeAccessor<byte>(NativePtr->Name, 40);
5454
public ImFontPtr DstFont => new ImFontPtr(NativePtr->DstFont);
55+
public void Destroy()
56+
{
57+
ImGuiNative.ImFontConfig_destroy(NativePtr);
58+
}
5559
}
5660
}

src/ImGui.NET/Generated/ImFontGlyphRangesBuilder.gen.cs

+4
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ public void BuildRanges(out ImVector out_ranges)
6161
ImGuiNative.ImFontGlyphRangesBuilder_BuildRanges(NativePtr, native_out_ranges);
6262
}
6363
}
64+
public void Destroy()
65+
{
66+
ImGuiNative.ImFontGlyphRangesBuilder_destroy(NativePtr);
67+
}
6468
public bool GetBit(int n)
6569
{
6670
byte ret = ImGuiNative.ImFontGlyphRangesBuilder_GetBit(NativePtr, n);

src/ImGui.NET/Generated/ImGuiIO.gen.cs

+4
Original file line numberDiff line numberDiff line change
@@ -212,5 +212,9 @@ public void ClearInputCharacters()
212212
{
213213
ImGuiNative.ImGuiIO_ClearInputCharacters(NativePtr);
214214
}
215+
public void Destroy()
216+
{
217+
ImGuiNative.ImGuiIO_destroy(NativePtr);
218+
}
215219
}
216220
}

src/ImGui.NET/Generated/ImGuiInputTextCallbackData.gen.cs

+4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ public void DeleteChars(int pos, int bytes_count)
4444
{
4545
ImGuiNative.ImGuiInputTextCallbackData_DeleteChars(NativePtr, pos, bytes_count);
4646
}
47+
public void Destroy()
48+
{
49+
ImGuiNative.ImGuiInputTextCallbackData_destroy(NativePtr);
50+
}
4751
public bool HasSelection()
4852
{
4953
byte ret = ImGuiNative.ImGuiInputTextCallbackData_HasSelection(NativePtr);

src/ImGui.NET/Generated/ImGuiListClipper.gen.cs

+4
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ public void Begin(int items_count, float items_height)
3737
{
3838
ImGuiNative.ImGuiListClipper_Begin(NativePtr, items_count, items_height);
3939
}
40+
public void Destroy()
41+
{
42+
ImGuiNative.ImGuiListClipper_destroy(NativePtr);
43+
}
4044
public void End()
4145
{
4246
ImGuiNative.ImGuiListClipper_End(NativePtr);

0 commit comments

Comments
 (0)