From 666b2392e41468034147048a29a4ec5256dbd933 Mon Sep 17 00:00:00 2001 From: Eric Mellino Date: Fri, 26 Oct 2018 23:18:07 -0700 Subject: [PATCH] Improve the marshalling of ImWchar* parameters (glyph ranges, mainly) --- src/CodeGenerator/Program.cs | 11 +- .../Generated/GlyphRangesBuilder.gen.cs | 8 +- src/ImGui.NET/Generated/ImDrawList.gen.cs | 2 +- src/ImGui.NET/Generated/ImFontAtlas.gen.cs | 80 ++++---- src/ImGui.NET/Generated/ImGui.gen.cs | 172 +++++++++--------- src/ImGui.NET/Generated/ImGuiStorage.gen.cs | 4 +- 6 files changed, 136 insertions(+), 141 deletions(-) diff --git a/src/CodeGenerator/Program.cs b/src/CodeGenerator/Program.cs index 7e2c088..5cc2dbc 100644 --- a/src/CodeGenerator/Program.cs +++ b/src/CodeGenerator/Program.cs @@ -694,11 +694,12 @@ namespace CodeGenerator preCallLines.Add($"byte* {nativeArgName} = &{nativeArgName}_val;"); postCallLines.Add($"{correctedIdentifier} = {nativeArgName}_val != 0;"); } - else if (tr.Type == "void*") + else if (tr.Type == "void*" || tr.Type == "ImWchar*") { + string nativePtrTypeName = tr.Type == "void*" ? "void*" : "ushort*"; string nativeArgName = "native_" + tr.Name; marshalledParameters[i] = new MarshalledParameter("IntPtr", false, nativeArgName, false); - preCallLines.Add($"void* {nativeArgName} = {correctedIdentifier}.ToPointer();"); + preCallLines.Add($"{nativePtrTypeName} {nativeArgName} = ({nativePtrTypeName}){correctedIdentifier}.ToPointer();"); } else if (GetWrappedType(tr.Type, out string wrappedParamType) && !s_wellKnownTypes.ContainsKey(tr.Type) @@ -795,6 +796,10 @@ namespace CodeGenerator { writer.WriteLine("return Util.StringFromPtr(ret);"); } + else if (overload.ReturnType == "ImWchar*") + { + writer.WriteLine("return (IntPtr)ret;"); + } else if (overload.ReturnType == "void*") { writer.WriteLine("return (IntPtr)ret;"); @@ -829,7 +834,7 @@ namespace CodeGenerator { return "string"; } - else if (nativeRet == "void*") + else if (nativeRet == "ImWchar*" || nativeRet == "void*") { return "IntPtr"; } diff --git a/src/ImGui.NET/Generated/GlyphRangesBuilder.gen.cs b/src/ImGui.NET/Generated/GlyphRangesBuilder.gen.cs index 74b768e..42b261f 100644 --- a/src/ImGui.NET/Generated/GlyphRangesBuilder.gen.cs +++ b/src/ImGui.NET/Generated/GlyphRangesBuilder.gen.cs @@ -34,12 +34,10 @@ namespace ImGuiNET byte* native_text_end = null; ImGuiNative.GlyphRangesBuilder_AddText(NativePtr, native_text, native_text_end); } - public void AddRanges(ref ushort ranges) + public void AddRanges(IntPtr ranges) { - fixed (ushort* native_ranges = &ranges) - { - ImGuiNative.GlyphRangesBuilder_AddRanges(NativePtr, native_ranges); - } + ushort* native_ranges = (ushort*)ranges.ToPointer(); + ImGuiNative.GlyphRangesBuilder_AddRanges(NativePtr, native_ranges); } public void BuildRanges(out ImVector out_ranges) { diff --git a/src/ImGui.NET/Generated/ImDrawList.gen.cs b/src/ImGui.NET/Generated/ImDrawList.gen.cs index 9e4a110..9f94a1d 100644 --- a/src/ImGui.NET/Generated/ImDrawList.gen.cs +++ b/src/ImGui.NET/Generated/ImDrawList.gen.cs @@ -179,7 +179,7 @@ namespace ImGuiNET } public void AddCallback(IntPtr callback, IntPtr callback_data) { - void* native_callback_data = callback_data.ToPointer(); + void* native_callback_data = (void*)callback_data.ToPointer(); ImGuiNative.ImDrawList_AddCallback(NativePtr, callback, native_callback_data); } public void PathRect(Vector2 rect_min, Vector2 rect_max) diff --git a/src/ImGui.NET/Generated/ImFontAtlas.gen.cs b/src/ImGui.NET/Generated/ImFontAtlas.gen.cs index 730650d..9ac8225 100644 --- a/src/ImGui.NET/Generated/ImFontAtlas.gen.cs +++ b/src/ImGui.NET/Generated/ImFontAtlas.gen.cs @@ -74,7 +74,7 @@ namespace ImGuiNET ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryCompressedBase85TTF(NativePtr, native_compressed_font_data_base85, size_pixels, native_font_cfg, glyph_ranges); return new ImFontPtr(ret); } - public ImFontPtr AddFontFromMemoryCompressedBase85TTF(string compressed_font_data_base85, float size_pixels, ImFontConfigPtr font_cfg, ref ushort glyph_ranges) + public ImFontPtr AddFontFromMemoryCompressedBase85TTF(string compressed_font_data_base85, float size_pixels, ImFontConfigPtr font_cfg, IntPtr glyph_ranges) { int compressed_font_data_base85_byteCount = Encoding.UTF8.GetByteCount(compressed_font_data_base85); byte* native_compressed_font_data_base85 = stackalloc byte[compressed_font_data_base85_byteCount + 1]; @@ -84,11 +84,9 @@ namespace ImGuiNET native_compressed_font_data_base85[native_compressed_font_data_base85_offset] = 0; } ImFontConfig* native_font_cfg = font_cfg.NativePtr; - fixed (ushort* native_glyph_ranges = &glyph_ranges) - { - ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryCompressedBase85TTF(NativePtr, native_compressed_font_data_base85, size_pixels, native_font_cfg, native_glyph_ranges); - return new ImFontPtr(ret); - } + ushort* native_glyph_ranges = (ushort*)glyph_ranges.ToPointer(); + ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryCompressedBase85TTF(NativePtr, native_compressed_font_data_base85, size_pixels, native_font_cfg, native_glyph_ranges); + return new ImFontPtr(ret); } public bool Build() { @@ -129,30 +127,30 @@ namespace ImGuiNET byte ret = ImGuiNative.ImFontAtlas_IsBuilt(NativePtr); return ret != 0; } - public ushort* GetGlyphRangesThai() + public IntPtr GetGlyphRangesThai() { ushort* ret = ImGuiNative.ImFontAtlas_GetGlyphRangesThai(NativePtr); - return ret; + return (IntPtr)ret; } - public ushort* GetGlyphRangesCyrillic() + public IntPtr GetGlyphRangesCyrillic() { ushort* ret = ImGuiNative.ImFontAtlas_GetGlyphRangesCyrillic(NativePtr); - return ret; + return (IntPtr)ret; } - public ushort* GetGlyphRangesChineseSimplifiedCommon() + public IntPtr GetGlyphRangesChineseSimplifiedCommon() { ushort* ret = ImGuiNative.ImFontAtlas_GetGlyphRangesChineseSimplifiedCommon(NativePtr); - return ret; + return (IntPtr)ret; } - public ushort* GetGlyphRangesChineseFull() + public IntPtr GetGlyphRangesChineseFull() { ushort* ret = ImGuiNative.ImFontAtlas_GetGlyphRangesChineseFull(NativePtr); - return ret; + return (IntPtr)ret; } - public ushort* GetGlyphRangesDefault() + public IntPtr GetGlyphRangesDefault() { ushort* ret = ImGuiNative.ImFontAtlas_GetGlyphRangesDefault(NativePtr); - return ret; + return (IntPtr)ret; } public void SetTexID(IntPtr id) { @@ -172,7 +170,7 @@ namespace ImGuiNET } public ImFontPtr AddFontFromMemoryCompressedTTF(IntPtr compressed_font_data, int compressed_font_size, float size_pixels) { - void* native_compressed_font_data = compressed_font_data.ToPointer(); + void* native_compressed_font_data = (void*)compressed_font_data.ToPointer(); ImFontConfig* font_cfg = null; ushort* glyph_ranges = null; ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryCompressedTTF(NativePtr, native_compressed_font_data, compressed_font_size, size_pixels, font_cfg, glyph_ranges); @@ -180,25 +178,23 @@ namespace ImGuiNET } public ImFontPtr AddFontFromMemoryCompressedTTF(IntPtr compressed_font_data, int compressed_font_size, float size_pixels, ImFontConfigPtr font_cfg) { - void* native_compressed_font_data = compressed_font_data.ToPointer(); + void* native_compressed_font_data = (void*)compressed_font_data.ToPointer(); ImFontConfig* native_font_cfg = font_cfg.NativePtr; ushort* glyph_ranges = null; ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryCompressedTTF(NativePtr, native_compressed_font_data, compressed_font_size, size_pixels, native_font_cfg, glyph_ranges); return new ImFontPtr(ret); } - public ImFontPtr AddFontFromMemoryCompressedTTF(IntPtr compressed_font_data, int compressed_font_size, float size_pixels, ImFontConfigPtr font_cfg, ref ushort glyph_ranges) + public ImFontPtr AddFontFromMemoryCompressedTTF(IntPtr compressed_font_data, int compressed_font_size, float size_pixels, ImFontConfigPtr font_cfg, IntPtr glyph_ranges) { - void* native_compressed_font_data = compressed_font_data.ToPointer(); + void* native_compressed_font_data = (void*)compressed_font_data.ToPointer(); ImFontConfig* native_font_cfg = font_cfg.NativePtr; - fixed (ushort* native_glyph_ranges = &glyph_ranges) - { - ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryCompressedTTF(NativePtr, native_compressed_font_data, compressed_font_size, size_pixels, native_font_cfg, native_glyph_ranges); - return new ImFontPtr(ret); - } + ushort* native_glyph_ranges = (ushort*)glyph_ranges.ToPointer(); + ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryCompressedTTF(NativePtr, native_compressed_font_data, compressed_font_size, size_pixels, native_font_cfg, native_glyph_ranges); + return new ImFontPtr(ret); } public ImFontPtr AddFontFromMemoryTTF(IntPtr font_data, int font_size, float size_pixels) { - void* native_font_data = font_data.ToPointer(); + void* native_font_data = (void*)font_data.ToPointer(); ImFontConfig* font_cfg = null; ushort* glyph_ranges = null; ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryTTF(NativePtr, native_font_data, font_size, size_pixels, font_cfg, glyph_ranges); @@ -206,21 +202,19 @@ namespace ImGuiNET } public ImFontPtr AddFontFromMemoryTTF(IntPtr font_data, int font_size, float size_pixels, ImFontConfigPtr font_cfg) { - void* native_font_data = font_data.ToPointer(); + void* native_font_data = (void*)font_data.ToPointer(); ImFontConfig* native_font_cfg = font_cfg.NativePtr; ushort* glyph_ranges = null; ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryTTF(NativePtr, native_font_data, font_size, size_pixels, native_font_cfg, glyph_ranges); return new ImFontPtr(ret); } - public ImFontPtr AddFontFromMemoryTTF(IntPtr font_data, int font_size, float size_pixels, ImFontConfigPtr font_cfg, ref ushort glyph_ranges) + public ImFontPtr AddFontFromMemoryTTF(IntPtr font_data, int font_size, float size_pixels, ImFontConfigPtr font_cfg, IntPtr glyph_ranges) { - void* native_font_data = font_data.ToPointer(); + void* native_font_data = (void*)font_data.ToPointer(); ImFontConfig* native_font_cfg = font_cfg.NativePtr; - fixed (ushort* native_glyph_ranges = &glyph_ranges) - { - ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryTTF(NativePtr, native_font_data, font_size, size_pixels, native_font_cfg, native_glyph_ranges); - return new ImFontPtr(ret); - } + ushort* native_glyph_ranges = (ushort*)glyph_ranges.ToPointer(); + ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryTTF(NativePtr, native_font_data, font_size, size_pixels, native_font_cfg, native_glyph_ranges); + return new ImFontPtr(ret); } public ImFontPtr AddFontFromFileTTF(string filename, float size_pixels) { @@ -250,7 +244,7 @@ namespace ImGuiNET ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromFileTTF(NativePtr, native_filename, size_pixels, native_font_cfg, glyph_ranges); return new ImFontPtr(ret); } - public ImFontPtr AddFontFromFileTTF(string filename, float size_pixels, ImFontConfigPtr font_cfg, ref ushort glyph_ranges) + public ImFontPtr AddFontFromFileTTF(string filename, float size_pixels, ImFontConfigPtr font_cfg, IntPtr glyph_ranges) { int filename_byteCount = Encoding.UTF8.GetByteCount(filename); byte* native_filename = stackalloc byte[filename_byteCount + 1]; @@ -260,11 +254,9 @@ namespace ImGuiNET native_filename[native_filename_offset] = 0; } ImFontConfig* native_font_cfg = font_cfg.NativePtr; - fixed (ushort* native_glyph_ranges = &glyph_ranges) - { - ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromFileTTF(NativePtr, native_filename, size_pixels, native_font_cfg, native_glyph_ranges); - return new ImFontPtr(ret); - } + ushort* native_glyph_ranges = (ushort*)glyph_ranges.ToPointer(); + ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromFileTTF(NativePtr, native_filename, size_pixels, native_font_cfg, native_glyph_ranges); + return new ImFontPtr(ret); } public ImFontPtr AddFontDefault() { @@ -278,10 +270,10 @@ namespace ImGuiNET ImFont* ret = ImGuiNative.ImFontAtlas_AddFontDefault(NativePtr, native_font_cfg); return new ImFontPtr(ret); } - public ushort* GetGlyphRangesJapanese() + public IntPtr GetGlyphRangesJapanese() { ushort* ret = ImGuiNative.ImFontAtlas_GetGlyphRangesJapanese(NativePtr); - return ret; + return (IntPtr)ret; } public void GetTexDataAsAlpha8(out byte* out_pixels, out int out_width, out int out_height) { @@ -334,10 +326,10 @@ namespace ImGuiNET } } } - public ushort* GetGlyphRangesKorean() + public IntPtr GetGlyphRangesKorean() { ushort* ret = ImGuiNative.ImFontAtlas_GetGlyphRangesKorean(NativePtr); - return ret; + return (IntPtr)ret; } public void GetTexDataAsRGBA32(out byte* out_pixels, out int out_width, out int out_height) { diff --git a/src/ImGui.NET/Generated/ImGui.gen.cs b/src/ImGui.NET/Generated/ImGui.gen.cs index 4bab972..0c93af9 100644 --- a/src/ImGui.NET/Generated/ImGui.gen.cs +++ b/src/ImGui.NET/Generated/ImGui.gen.cs @@ -2338,7 +2338,7 @@ namespace ImGuiNET int native_label_offset = Encoding.UTF8.GetBytes(label_ptr, label.Length, native_label, label_byteCount); native_label[native_label_offset] = 0; } - void* native_v = v.ToPointer(); + void* native_v = (void*)v.ToPointer(); void* v_min = null; void* v_max = null; byte* native_format = null; @@ -2355,8 +2355,8 @@ namespace ImGuiNET int native_label_offset = Encoding.UTF8.GetBytes(label_ptr, label.Length, native_label, label_byteCount); native_label[native_label_offset] = 0; } - void* native_v = v.ToPointer(); - void* native_v_min = v_min.ToPointer(); + void* native_v = (void*)v.ToPointer(); + void* native_v_min = (void*)v_min.ToPointer(); void* v_max = null; byte* native_format = null; float power = 1.0f; @@ -2372,9 +2372,9 @@ namespace ImGuiNET int native_label_offset = Encoding.UTF8.GetBytes(label_ptr, label.Length, native_label, label_byteCount); native_label[native_label_offset] = 0; } - void* native_v = v.ToPointer(); - void* native_v_min = v_min.ToPointer(); - void* native_v_max = v_max.ToPointer(); + void* native_v = (void*)v.ToPointer(); + void* native_v_min = (void*)v_min.ToPointer(); + void* native_v_max = (void*)v_max.ToPointer(); byte* native_format = null; float power = 1.0f; byte ret = ImGuiNative.igDragScalarN(native_label, data_type, native_v, components, v_speed, native_v_min, native_v_max, native_format, power); @@ -2389,9 +2389,9 @@ namespace ImGuiNET int native_label_offset = Encoding.UTF8.GetBytes(label_ptr, label.Length, native_label, label_byteCount); native_label[native_label_offset] = 0; } - void* native_v = v.ToPointer(); - void* native_v_min = v_min.ToPointer(); - void* native_v_max = v_max.ToPointer(); + void* native_v = (void*)v.ToPointer(); + void* native_v_min = (void*)v_min.ToPointer(); + void* native_v_max = (void*)v_max.ToPointer(); int format_byteCount = Encoding.UTF8.GetByteCount(format); byte* native_format = stackalloc byte[format_byteCount + 1]; fixed (char* format_ptr = format) @@ -2412,9 +2412,9 @@ namespace ImGuiNET int native_label_offset = Encoding.UTF8.GetBytes(label_ptr, label.Length, native_label, label_byteCount); native_label[native_label_offset] = 0; } - void* native_v = v.ToPointer(); - void* native_v_min = v_min.ToPointer(); - void* native_v_max = v_max.ToPointer(); + void* native_v = (void*)v.ToPointer(); + void* native_v_min = (void*)v_min.ToPointer(); + void* native_v_max = (void*)v_max.ToPointer(); int format_byteCount = Encoding.UTF8.GetByteCount(format); byte* native_format = stackalloc byte[format_byteCount + 1]; fixed (char* format_ptr = format) @@ -2436,7 +2436,7 @@ namespace ImGuiNET } public static void MemFree(IntPtr ptr) { - void* native_ptr = ptr.ToPointer(); + void* native_ptr = (void*)ptr.ToPointer(); ImGuiNative.igMemFree(native_ptr); } public static Vector2 GetFontTexUvWhitePixel() @@ -2535,7 +2535,7 @@ namespace ImGuiNET } public static uint GetID(IntPtr ptr_id) { - void* native_ptr_id = ptr_id.ToPointer(); + void* native_ptr_id = (void*)ptr_id.ToPointer(); uint ret = ImGuiNative.igGetIDPtr(native_ptr_id); return ret; } @@ -2648,7 +2648,7 @@ namespace ImGuiNET } public static void TreePush(IntPtr ptr_id) { - void* native_ptr_id = ptr_id.ToPointer(); + void* native_ptr_id = (void*)ptr_id.ToPointer(); ImGuiNative.igTreePushPtr(native_ptr_id); } public static void TextDisabled(string fmt) @@ -3062,7 +3062,7 @@ namespace ImGuiNET int native_type_offset = Encoding.UTF8.GetBytes(type_ptr, type.Length, native_type, type_byteCount); native_type[native_type_offset] = 0; } - void* native_data = data.ToPointer(); + void* native_data = (void*)data.ToPointer(); ImGuiCond cond = 0; byte ret = ImGuiNative.igSetDragDropPayload(native_type, native_data, size, cond); return ret != 0; @@ -3076,7 +3076,7 @@ namespace ImGuiNET int native_type_offset = Encoding.UTF8.GetBytes(type_ptr, type.Length, native_type, type_byteCount); native_type[native_type_offset] = 0; } - void* native_data = data.ToPointer(); + void* native_data = (void*)data.ToPointer(); byte ret = ImGuiNative.igSetDragDropPayload(native_type, native_data, size, cond); return ret != 0; } @@ -3567,7 +3567,7 @@ namespace ImGuiNET int native_buf_offset = Encoding.UTF8.GetBytes(buf_ptr, buf.Length, native_buf, buf_byteCount); native_buf[native_buf_offset] = 0; } - void* native_user_data = user_data.ToPointer(); + void* native_user_data = (void*)user_data.ToPointer(); byte ret = ImGuiNative.igInputTextMultiline(native_label, native_buf, buf_size, size, flags, callback, native_user_data); return ret != 0; } @@ -3860,7 +3860,7 @@ namespace ImGuiNET } public static void PushID(IntPtr ptr_id) { - void* native_ptr_id = ptr_id.ToPointer(); + void* native_ptr_id = (void*)ptr_id.ToPointer(); ImGuiNative.igPushIDPtr(native_ptr_id); } public static void PushID(int int_id) @@ -4112,9 +4112,9 @@ namespace ImGuiNET int native_label_offset = Encoding.UTF8.GetBytes(label_ptr, label.Length, native_label, label_byteCount); native_label[native_label_offset] = 0; } - void* native_v = v.ToPointer(); - void* native_v_min = v_min.ToPointer(); - void* native_v_max = v_max.ToPointer(); + void* native_v = (void*)v.ToPointer(); + void* native_v_min = (void*)v_min.ToPointer(); + void* native_v_max = (void*)v_max.ToPointer(); byte* native_format = null; float power = 1.0f; byte ret = ImGuiNative.igVSliderScalar(native_label, size, data_type, native_v, native_v_min, native_v_max, native_format, power); @@ -4129,9 +4129,9 @@ namespace ImGuiNET int native_label_offset = Encoding.UTF8.GetBytes(label_ptr, label.Length, native_label, label_byteCount); native_label[native_label_offset] = 0; } - void* native_v = v.ToPointer(); - void* native_v_min = v_min.ToPointer(); - void* native_v_max = v_max.ToPointer(); + void* native_v = (void*)v.ToPointer(); + void* native_v_min = (void*)v_min.ToPointer(); + void* native_v_max = (void*)v_max.ToPointer(); int format_byteCount = Encoding.UTF8.GetByteCount(format); byte* native_format = stackalloc byte[format_byteCount + 1]; fixed (char* format_ptr = format) @@ -4152,9 +4152,9 @@ namespace ImGuiNET int native_label_offset = Encoding.UTF8.GetBytes(label_ptr, label.Length, native_label, label_byteCount); native_label[native_label_offset] = 0; } - void* native_v = v.ToPointer(); - void* native_v_min = v_min.ToPointer(); - void* native_v_max = v_max.ToPointer(); + void* native_v = (void*)v.ToPointer(); + void* native_v_min = (void*)v_min.ToPointer(); + void* native_v_max = (void*)v_max.ToPointer(); int format_byteCount = Encoding.UTF8.GetByteCount(format); byte* native_format = stackalloc byte[format_byteCount + 1]; fixed (char* format_ptr = format) @@ -4422,9 +4422,9 @@ namespace ImGuiNET int native_label_offset = Encoding.UTF8.GetBytes(label_ptr, label.Length, native_label, label_byteCount); native_label[native_label_offset] = 0; } - void* native_v = v.ToPointer(); - void* native_v_min = v_min.ToPointer(); - void* native_v_max = v_max.ToPointer(); + void* native_v = (void*)v.ToPointer(); + void* native_v_min = (void*)v_min.ToPointer(); + void* native_v_max = (void*)v_max.ToPointer(); byte* native_format = null; float power = 1.0f; byte ret = ImGuiNative.igSliderScalar(native_label, data_type, native_v, native_v_min, native_v_max, native_format, power); @@ -4439,9 +4439,9 @@ namespace ImGuiNET int native_label_offset = Encoding.UTF8.GetBytes(label_ptr, label.Length, native_label, label_byteCount); native_label[native_label_offset] = 0; } - void* native_v = v.ToPointer(); - void* native_v_min = v_min.ToPointer(); - void* native_v_max = v_max.ToPointer(); + void* native_v = (void*)v.ToPointer(); + void* native_v_min = (void*)v_min.ToPointer(); + void* native_v_max = (void*)v_max.ToPointer(); int format_byteCount = Encoding.UTF8.GetByteCount(format); byte* native_format = stackalloc byte[format_byteCount + 1]; fixed (char* format_ptr = format) @@ -4462,9 +4462,9 @@ namespace ImGuiNET int native_label_offset = Encoding.UTF8.GetBytes(label_ptr, label.Length, native_label, label_byteCount); native_label[native_label_offset] = 0; } - void* native_v = v.ToPointer(); - void* native_v_min = v_min.ToPointer(); - void* native_v_max = v_max.ToPointer(); + void* native_v = (void*)v.ToPointer(); + void* native_v_min = (void*)v_min.ToPointer(); + void* native_v_max = (void*)v_max.ToPointer(); int format_byteCount = Encoding.UTF8.GetByteCount(format); byte* native_format = stackalloc byte[format_byteCount + 1]; fixed (char* format_ptr = format) @@ -4634,7 +4634,7 @@ namespace ImGuiNET int native_buf_offset = Encoding.UTF8.GetBytes(buf_ptr, buf.Length, native_buf, buf_byteCount); native_buf[native_buf_offset] = 0; } - void* native_user_data = user_data.ToPointer(); + void* native_user_data = (void*)user_data.ToPointer(); byte ret = ImGuiNative.igInputText(native_label, native_buf, buf_size, flags, callback, native_user_data); return ret != 0; } @@ -5588,7 +5588,7 @@ namespace ImGuiNET int native_label_offset = Encoding.UTF8.GetBytes(label_ptr, label.Length, native_label, label_byteCount); native_label[native_label_offset] = 0; } - void* native_v = v.ToPointer(); + void* native_v = (void*)v.ToPointer(); void* step = null; void* step_fast = null; byte* native_format = null; @@ -5605,8 +5605,8 @@ namespace ImGuiNET int native_label_offset = Encoding.UTF8.GetBytes(label_ptr, label.Length, native_label, label_byteCount); native_label[native_label_offset] = 0; } - void* native_v = v.ToPointer(); - void* native_step = step.ToPointer(); + void* native_v = (void*)v.ToPointer(); + void* native_step = (void*)step.ToPointer(); void* step_fast = null; byte* native_format = null; ImGuiInputTextFlags extra_flags = 0; @@ -5622,9 +5622,9 @@ namespace ImGuiNET int native_label_offset = Encoding.UTF8.GetBytes(label_ptr, label.Length, native_label, label_byteCount); native_label[native_label_offset] = 0; } - void* native_v = v.ToPointer(); - void* native_step = step.ToPointer(); - void* native_step_fast = step_fast.ToPointer(); + void* native_v = (void*)v.ToPointer(); + void* native_step = (void*)step.ToPointer(); + void* native_step_fast = (void*)step_fast.ToPointer(); byte* native_format = null; ImGuiInputTextFlags extra_flags = 0; byte ret = ImGuiNative.igInputScalar(native_label, data_type, native_v, native_step, native_step_fast, native_format, extra_flags); @@ -5639,9 +5639,9 @@ namespace ImGuiNET int native_label_offset = Encoding.UTF8.GetBytes(label_ptr, label.Length, native_label, label_byteCount); native_label[native_label_offset] = 0; } - void* native_v = v.ToPointer(); - void* native_step = step.ToPointer(); - void* native_step_fast = step_fast.ToPointer(); + void* native_v = (void*)v.ToPointer(); + void* native_step = (void*)step.ToPointer(); + void* native_step_fast = (void*)step_fast.ToPointer(); int format_byteCount = Encoding.UTF8.GetByteCount(format); byte* native_format = stackalloc byte[format_byteCount + 1]; fixed (char* format_ptr = format) @@ -5662,9 +5662,9 @@ namespace ImGuiNET int native_label_offset = Encoding.UTF8.GetBytes(label_ptr, label.Length, native_label, label_byteCount); native_label[native_label_offset] = 0; } - void* native_v = v.ToPointer(); - void* native_step = step.ToPointer(); - void* native_step_fast = step_fast.ToPointer(); + void* native_v = (void*)v.ToPointer(); + void* native_step = (void*)step.ToPointer(); + void* native_step_fast = (void*)step_fast.ToPointer(); int format_byteCount = Encoding.UTF8.GetByteCount(format); byte* native_format = stackalloc byte[format_byteCount + 1]; fixed (char* format_ptr = format) @@ -5951,7 +5951,7 @@ namespace ImGuiNET } public static bool TreeNodeEx(IntPtr ptr_id, ImGuiTreeNodeFlags flags, string fmt) { - void* native_ptr_id = ptr_id.ToPointer(); + void* native_ptr_id = (void*)ptr_id.ToPointer(); int fmt_byteCount = Encoding.UTF8.GetByteCount(fmt); byte* native_fmt = stackalloc byte[fmt_byteCount + 1]; fixed (char* fmt_ptr = fmt) @@ -6033,9 +6033,9 @@ namespace ImGuiNET int native_label_offset = Encoding.UTF8.GetBytes(label_ptr, label.Length, native_label, label_byteCount); native_label[native_label_offset] = 0; } - void* native_v = v.ToPointer(); - void* native_v_min = v_min.ToPointer(); - void* native_v_max = v_max.ToPointer(); + void* native_v = (void*)v.ToPointer(); + void* native_v_min = (void*)v_min.ToPointer(); + void* native_v_max = (void*)v_max.ToPointer(); byte* native_format = null; float power = 1.0f; byte ret = ImGuiNative.igSliderScalarN(native_label, data_type, native_v, components, native_v_min, native_v_max, native_format, power); @@ -6050,9 +6050,9 @@ namespace ImGuiNET int native_label_offset = Encoding.UTF8.GetBytes(label_ptr, label.Length, native_label, label_byteCount); native_label[native_label_offset] = 0; } - void* native_v = v.ToPointer(); - void* native_v_min = v_min.ToPointer(); - void* native_v_max = v_max.ToPointer(); + void* native_v = (void*)v.ToPointer(); + void* native_v_min = (void*)v_min.ToPointer(); + void* native_v_max = (void*)v_max.ToPointer(); int format_byteCount = Encoding.UTF8.GetByteCount(format); byte* native_format = stackalloc byte[format_byteCount + 1]; fixed (char* format_ptr = format) @@ -6073,9 +6073,9 @@ namespace ImGuiNET int native_label_offset = Encoding.UTF8.GetBytes(label_ptr, label.Length, native_label, label_byteCount); native_label[native_label_offset] = 0; } - void* native_v = v.ToPointer(); - void* native_v_min = v_min.ToPointer(); - void* native_v_max = v_max.ToPointer(); + void* native_v = (void*)v.ToPointer(); + void* native_v_min = (void*)v_min.ToPointer(); + void* native_v_max = (void*)v_max.ToPointer(); int format_byteCount = Encoding.UTF8.GetByteCount(format); byte* native_format = stackalloc byte[format_byteCount + 1]; fixed (char* format_ptr = format) @@ -6129,7 +6129,7 @@ namespace ImGuiNET } public static void SetNextWindowSizeConstraints(Vector2 size_min, Vector2 size_max, ImGuiSizeCallback custom_callback, IntPtr custom_callback_data) { - void* native_custom_callback_data = custom_callback_data.ToPointer(); + void* native_custom_callback_data = (void*)custom_callback_data.ToPointer(); ImGuiNative.igSetNextWindowSizeConstraints(size_min, size_max, custom_callback, native_custom_callback_data); } public static void Dummy(Vector2 size) @@ -6351,7 +6351,7 @@ namespace ImGuiNET int native_label_offset = Encoding.UTF8.GetBytes(label_ptr, label.Length, native_label, label_byteCount); native_label[native_label_offset] = 0; } - void* native_v = v.ToPointer(); + void* native_v = (void*)v.ToPointer(); void* v_min = null; void* v_max = null; byte* native_format = null; @@ -6368,8 +6368,8 @@ namespace ImGuiNET int native_label_offset = Encoding.UTF8.GetBytes(label_ptr, label.Length, native_label, label_byteCount); native_label[native_label_offset] = 0; } - void* native_v = v.ToPointer(); - void* native_v_min = v_min.ToPointer(); + void* native_v = (void*)v.ToPointer(); + void* native_v_min = (void*)v_min.ToPointer(); void* v_max = null; byte* native_format = null; float power = 1.0f; @@ -6385,9 +6385,9 @@ namespace ImGuiNET int native_label_offset = Encoding.UTF8.GetBytes(label_ptr, label.Length, native_label, label_byteCount); native_label[native_label_offset] = 0; } - void* native_v = v.ToPointer(); - void* native_v_min = v_min.ToPointer(); - void* native_v_max = v_max.ToPointer(); + void* native_v = (void*)v.ToPointer(); + void* native_v_min = (void*)v_min.ToPointer(); + void* native_v_max = (void*)v_max.ToPointer(); byte* native_format = null; float power = 1.0f; byte ret = ImGuiNative.igDragScalar(native_label, data_type, native_v, v_speed, native_v_min, native_v_max, native_format, power); @@ -6402,9 +6402,9 @@ namespace ImGuiNET int native_label_offset = Encoding.UTF8.GetBytes(label_ptr, label.Length, native_label, label_byteCount); native_label[native_label_offset] = 0; } - void* native_v = v.ToPointer(); - void* native_v_min = v_min.ToPointer(); - void* native_v_max = v_max.ToPointer(); + void* native_v = (void*)v.ToPointer(); + void* native_v_min = (void*)v_min.ToPointer(); + void* native_v_max = (void*)v_max.ToPointer(); int format_byteCount = Encoding.UTF8.GetByteCount(format); byte* native_format = stackalloc byte[format_byteCount + 1]; fixed (char* format_ptr = format) @@ -6425,9 +6425,9 @@ namespace ImGuiNET int native_label_offset = Encoding.UTF8.GetBytes(label_ptr, label.Length, native_label, label_byteCount); native_label[native_label_offset] = 0; } - void* native_v = v.ToPointer(); - void* native_v_min = v_min.ToPointer(); - void* native_v_max = v_max.ToPointer(); + void* native_v = (void*)v.ToPointer(); + void* native_v_min = (void*)v_min.ToPointer(); + void* native_v_max = (void*)v_max.ToPointer(); int format_byteCount = Encoding.UTF8.GetByteCount(format); byte* native_format = stackalloc byte[format_byteCount + 1]; fixed (char* format_ptr = format) @@ -6540,7 +6540,7 @@ namespace ImGuiNET int native_label_offset = Encoding.UTF8.GetBytes(label_ptr, label.Length, native_label, label_byteCount); native_label[native_label_offset] = 0; } - void* native_v = v.ToPointer(); + void* native_v = (void*)v.ToPointer(); void* step = null; void* step_fast = null; byte* native_format = null; @@ -6557,8 +6557,8 @@ namespace ImGuiNET int native_label_offset = Encoding.UTF8.GetBytes(label_ptr, label.Length, native_label, label_byteCount); native_label[native_label_offset] = 0; } - void* native_v = v.ToPointer(); - void* native_step = step.ToPointer(); + void* native_v = (void*)v.ToPointer(); + void* native_step = (void*)step.ToPointer(); void* step_fast = null; byte* native_format = null; ImGuiInputTextFlags extra_flags = 0; @@ -6574,9 +6574,9 @@ namespace ImGuiNET int native_label_offset = Encoding.UTF8.GetBytes(label_ptr, label.Length, native_label, label_byteCount); native_label[native_label_offset] = 0; } - void* native_v = v.ToPointer(); - void* native_step = step.ToPointer(); - void* native_step_fast = step_fast.ToPointer(); + void* native_v = (void*)v.ToPointer(); + void* native_step = (void*)step.ToPointer(); + void* native_step_fast = (void*)step_fast.ToPointer(); byte* native_format = null; ImGuiInputTextFlags extra_flags = 0; byte ret = ImGuiNative.igInputScalarN(native_label, data_type, native_v, components, native_step, native_step_fast, native_format, extra_flags); @@ -6591,9 +6591,9 @@ namespace ImGuiNET int native_label_offset = Encoding.UTF8.GetBytes(label_ptr, label.Length, native_label, label_byteCount); native_label[native_label_offset] = 0; } - void* native_v = v.ToPointer(); - void* native_step = step.ToPointer(); - void* native_step_fast = step_fast.ToPointer(); + void* native_v = (void*)v.ToPointer(); + void* native_step = (void*)step.ToPointer(); + void* native_step_fast = (void*)step_fast.ToPointer(); int format_byteCount = Encoding.UTF8.GetByteCount(format); byte* native_format = stackalloc byte[format_byteCount + 1]; fixed (char* format_ptr = format) @@ -6614,9 +6614,9 @@ namespace ImGuiNET int native_label_offset = Encoding.UTF8.GetBytes(label_ptr, label.Length, native_label, label_byteCount); native_label[native_label_offset] = 0; } - void* native_v = v.ToPointer(); - void* native_step = step.ToPointer(); - void* native_step_fast = step_fast.ToPointer(); + void* native_v = (void*)v.ToPointer(); + void* native_step = (void*)step.ToPointer(); + void* native_step_fast = (void*)step_fast.ToPointer(); int format_byteCount = Encoding.UTF8.GetByteCount(format); byte* native_format = stackalloc byte[format_byteCount + 1]; fixed (char* format_ptr = format) @@ -6660,7 +6660,7 @@ namespace ImGuiNET } public static bool TreeNode(IntPtr ptr_id, string fmt) { - void* native_ptr_id = ptr_id.ToPointer(); + void* native_ptr_id = (void*)ptr_id.ToPointer(); int fmt_byteCount = Encoding.UTF8.GetByteCount(fmt); byte* native_fmt = stackalloc byte[fmt_byteCount + 1]; fixed (char* fmt_ptr = fmt) diff --git a/src/ImGui.NET/Generated/ImGuiStorage.gen.cs b/src/ImGui.NET/Generated/ImGuiStorage.gen.cs index de2c67d..f59badf 100644 --- a/src/ImGui.NET/Generated/ImGuiStorage.gen.cs +++ b/src/ImGui.NET/Generated/ImGuiStorage.gen.cs @@ -50,7 +50,7 @@ namespace ImGuiNET } public void** GetVoidPtrRef(uint key, IntPtr default_val) { - void* native_default_val = default_val.ToPointer(); + void* native_default_val = (void*)default_val.ToPointer(); void** ret = ImGuiNative.ImGuiStorage_GetVoidPtrRef(NativePtr, key, native_default_val); return ret; } @@ -79,7 +79,7 @@ namespace ImGuiNET } public void SetVoidPtr(uint key, IntPtr val) { - void* native_val = val.ToPointer(); + void* native_val = (void*)val.ToPointer(); ImGuiNative.ImGuiStorage_SetVoidPtr(NativePtr, key, native_val); } public void BuildSortByKey()