From 101996d5fced0e6601279e89cb753c474343e8aa Mon Sep 17 00:00:00 2001 From: "DESKTOP-BE76M2F\\drape" Date: Fri, 5 Aug 2022 21:51:39 -0700 Subject: [PATCH] update from System.Runtime.CompilerServices.Unsafe to Unity.Collections.LowLevel.Unsafe.UnsafeUtility --- ImGuiNET/ColorExtensions.cs | 7 +- .../Wrapper.Extra/ImFontConfigPtr.Extra.cs | 4 +- .../Wrapper.Extra/ImGui.Extra.DragDrop.cs | 10 +-- .../ImGui.Extra.InputTextWithHint.cs | 6 +- .../ImGuiInputTextCallbackDataPtr.Extra.cs | 4 +- .../ImGuiSizeCallbackDataPtr.Extra.cs | 4 +- .../Wrapper.Extra/ImGuiTextFilterPtr.Extra.cs | 4 +- ImGuiNET/Wrapper/Generated/ImColor.gen.cs | 4 +- .../Wrapper/Generated/ImDrawChannel.gen.cs | 4 +- ImGuiNET/Wrapper/Generated/ImDrawCmd.gen.cs | 14 +-- ImGuiNET/Wrapper/Generated/ImDrawData.gen.cs | 16 ++-- ImGuiNET/Wrapper/Generated/ImDrawList.gen.cs | 16 ++-- .../Generated/ImDrawListSplitter.gen.cs | 8 +- ImGuiNET/Wrapper/Generated/ImDrawVert.gen.cs | 8 +- ImGuiNET/Wrapper/Generated/ImFont.gen.cs | 26 +++--- ImGuiNET/Wrapper/Generated/ImFontAtlas.gen.cs | 24 ++--- .../Generated/ImFontAtlasCustomRect.gen.cs | 16 ++-- .../Wrapper/Generated/ImFontConfig.gen.cs | 32 +++---- ImGuiNET/Wrapper/Generated/ImFontGlyph.gen.cs | 22 ++--- .../Generated/ImFontGlyphRangesBuilder.gen.cs | 2 +- ImGuiNET/Wrapper/Generated/ImGui.gen.cs | 1 + ImGuiNET/Wrapper/Generated/ImGuiIO.gen.cs | 90 +++++++++---------- .../ImGuiInputTextCallbackData.gen.cs | 22 ++--- .../Wrapper/Generated/ImGuiListClipper.gen.cs | 14 +-- ImGuiNET/Wrapper/Generated/ImGuiNative.gen.cs | 1 + .../Generated/ImGuiOnceUponAFrame.gen.cs | 4 +- .../Wrapper/Generated/ImGuiPayload.gen.cs | 14 +-- .../Generated/ImGuiSizeCallbackData.gen.cs | 8 +- .../Wrapper/Generated/ImGuiStorage.gen.cs | 4 +- ImGuiNET/Wrapper/Generated/ImGuiStyle.gen.cs | 72 +++++++-------- .../Wrapper/Generated/ImGuiTextFilter.gen.cs | 6 +- ImGuiNET/Wrapper/ImGui.Manual.cs | 10 +-- ImGuiNET/Wrapper/ImVector.cs | 16 ++-- ImGuiNET/Wrapper/RangeAccessor.cs | 8 +- 34 files changed, 252 insertions(+), 249 deletions(-) diff --git a/ImGuiNET/ColorExtensions.cs b/ImGuiNET/ColorExtensions.cs index b081f7e..3634640 100644 --- a/ImGuiNET/ColorExtensions.cs +++ b/ImGuiNET/ColorExtensions.cs @@ -1,5 +1,6 @@ using System.Runtime.CompilerServices; using UnityEngine; +using Unity.Collections.LowLevel.Unsafe; namespace ImGuiNET { @@ -8,19 +9,19 @@ public static class ColorExtensions [MethodImpl(MethodImplOptions.AggressiveInlining)] public static unsafe Color32 ToColor32(this uint rgba) { - return Unsafe.AsRef(&rgba); + return UnsafeUtility.AsRef(&rgba); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static unsafe Color ToColor(this uint rgba) { - return Unsafe.AsRef(&rgba); // implicit conversion to Color + return UnsafeUtility.AsRef(&rgba); // implicit conversion to Color } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static unsafe uint ToUint(this Color32 c32) { - return Unsafe.AsRef(&c32); + return UnsafeUtility.AsRef(&c32); } [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/ImGuiNET/Wrapper.Extra/ImFontConfigPtr.Extra.cs b/ImGuiNET/Wrapper.Extra/ImFontConfigPtr.Extra.cs index 1c12613..513a708 100644 --- a/ImGuiNET/Wrapper.Extra/ImFontConfigPtr.Extra.cs +++ b/ImGuiNET/Wrapper.Extra/ImFontConfigPtr.Extra.cs @@ -1,4 +1,4 @@ -using System.Runtime.CompilerServices; +using Unity.Collections.LowLevel.Unsafe; namespace ImGuiNET { @@ -6,7 +6,7 @@ public unsafe partial struct ImFontConfigPtr { public ImFontConfigPtr(ref ImFontConfig fontConfig) { - NativePtr = (ImFontConfig*)Unsafe.AsPointer(ref fontConfig); + NativePtr = (ImFontConfig*)UnsafeUtility.AddressOf(ref fontConfig); } } } diff --git a/ImGuiNET/Wrapper.Extra/ImGui.Extra.DragDrop.cs b/ImGuiNET/Wrapper.Extra/ImGui.Extra.DragDrop.cs index 6e83a20..abfa76f 100644 --- a/ImGuiNET/Wrapper.Extra/ImGui.Extra.DragDrop.cs +++ b/ImGuiNET/Wrapper.Extra/ImGui.Extra.DragDrop.cs @@ -1,6 +1,6 @@ using System; using System.Text; -using System.Runtime.CompilerServices; +using Unity.Collections.LowLevel.Unsafe; namespace ImGuiNET { @@ -8,20 +8,20 @@ namespace ImGuiNET public static partial class ImGui { // TODO: review - // can now pass refs with Unsafe.AsRef + // can now pass refs with UnsafeUtility.AsRef public static unsafe void SetDragDropPayload(string type, T data, ImGuiCond cond = 0) where T : unmanaged { - void* ptr = Unsafe.AsPointer(ref data); - SetDragDropPayload(type, new IntPtr(ptr), (uint)Unsafe.SizeOf(), cond); + void* ptr = UnsafeUtility.AddressOf(ref data); + SetDragDropPayload(type, new IntPtr(ptr), (uint)UnsafeUtility.SizeOf(), cond); } public static unsafe bool AcceptDragDropPayload(string type, out T payload, ImGuiDragDropFlags flags = ImGuiDragDropFlags.None) where T : unmanaged { ImGuiPayload* pload = AcceptDragDropPayload(type, flags); - payload = (pload != null) ? Unsafe.Read(pload->Data) : default; + payload = (pload != null) ? UnsafeUtility.ReadArrayElement(pload->Data, 0) : default; return pload != null; } diff --git a/ImGuiNET/Wrapper.Extra/ImGui.Extra.InputTextWithHint.cs b/ImGuiNET/Wrapper.Extra/ImGui.Extra.InputTextWithHint.cs index c40098b..b668b1f 100644 --- a/ImGuiNET/Wrapper.Extra/ImGui.Extra.InputTextWithHint.cs +++ b/ImGuiNET/Wrapper.Extra/ImGui.Extra.InputTextWithHint.cs @@ -1,6 +1,6 @@ using System; -using System.Runtime.CompilerServices; using System.Text; +using Unity.Collections.LowLevel.Unsafe; namespace ImGuiNET { @@ -91,8 +91,8 @@ public static bool InputTextWithHint( } Util.GetUtf8(input, utf8InputBytes, inputBufSize); uint clearBytesCount = (uint)(inputBufSize - utf8InputByteCount); - Unsafe.InitBlockUnaligned(utf8InputBytes + utf8InputByteCount, 0, clearBytesCount); - Unsafe.CopyBlock(originalUtf8InputBytes, utf8InputBytes, (uint)inputBufSize); + UnsafeUtility.MemSet(utf8InputBytes + utf8InputByteCount, 0, clearBytesCount); + UnsafeUtility.MemCpy(originalUtf8InputBytes, utf8InputBytes, (uint)inputBufSize); byte result = ImGuiNative.igInputTextWithHint( utf8LabelBytes, diff --git a/ImGuiNET/Wrapper.Extra/ImGuiInputTextCallbackDataPtr.Extra.cs b/ImGuiNET/Wrapper.Extra/ImGuiInputTextCallbackDataPtr.Extra.cs index d1311a9..c15269c 100644 --- a/ImGuiNET/Wrapper.Extra/ImGuiInputTextCallbackDataPtr.Extra.cs +++ b/ImGuiNET/Wrapper.Extra/ImGuiInputTextCallbackDataPtr.Extra.cs @@ -1,4 +1,4 @@ -using System.Runtime.CompilerServices; +using Unity.Collections.LowLevel.Unsafe; namespace ImGuiNET { @@ -6,7 +6,7 @@ public unsafe partial struct ImGuiInputTextCallbackDataPtr { public ImGuiInputTextCallbackDataPtr(ref ImGuiInputTextCallbackData data) { - NativePtr = (ImGuiInputTextCallbackData*)Unsafe.AsPointer(ref data); + NativePtr = (ImGuiInputTextCallbackData*)UnsafeUtility.AddressOf(ref data); } public string Text => Util.StringFromPtr(NativePtr->Buf); diff --git a/ImGuiNET/Wrapper.Extra/ImGuiSizeCallbackDataPtr.Extra.cs b/ImGuiNET/Wrapper.Extra/ImGuiSizeCallbackDataPtr.Extra.cs index 6659944..118bf5b 100644 --- a/ImGuiNET/Wrapper.Extra/ImGuiSizeCallbackDataPtr.Extra.cs +++ b/ImGuiNET/Wrapper.Extra/ImGuiSizeCallbackDataPtr.Extra.cs @@ -1,4 +1,4 @@ -using System.Runtime.CompilerServices; +using Unity.Collections.LowLevel.Unsafe; namespace ImGuiNET { @@ -6,7 +6,7 @@ public unsafe partial struct ImGuiSizeCallbackDataPtr { public ImGuiSizeCallbackDataPtr(ref ImGuiSizeCallbackData data) { - NativePtr = (ImGuiSizeCallbackData*)Unsafe.AsPointer(ref data); + NativePtr = (ImGuiSizeCallbackData*)UnsafeUtility.AddressOf(ref data); } } } diff --git a/ImGuiNET/Wrapper.Extra/ImGuiTextFilterPtr.Extra.cs b/ImGuiNET/Wrapper.Extra/ImGuiTextFilterPtr.Extra.cs index 8c384d7..617dc33 100644 --- a/ImGuiNET/Wrapper.Extra/ImGuiTextFilterPtr.Extra.cs +++ b/ImGuiNET/Wrapper.Extra/ImGuiTextFilterPtr.Extra.cs @@ -1,4 +1,4 @@ -using System.Runtime.CompilerServices; +using Unity.Collections.LowLevel.Unsafe; namespace ImGuiNET { @@ -8,7 +8,7 @@ public unsafe partial struct ImGuiTextFilterPtr { public ImGuiTextFilterPtr(ref ImGuiTextFilter filter) { - NativePtr = (ImGuiTextFilter*)Unsafe.AsPointer(ref filter); + NativePtr = (ImGuiTextFilter*)UnsafeUtility.AddressOf(ref filter); } } } diff --git a/ImGuiNET/Wrapper/Generated/ImColor.gen.cs b/ImGuiNET/Wrapper/Generated/ImColor.gen.cs index 36d01c4..ec23f01 100644 --- a/ImGuiNET/Wrapper/Generated/ImColor.gen.cs +++ b/ImGuiNET/Wrapper/Generated/ImColor.gen.cs @@ -1,7 +1,7 @@ using System; -using System.Runtime.CompilerServices; using System.Text; using UnityEngine; +using Unity.Collections.LowLevel.Unsafe; namespace ImGuiNET { @@ -17,7 +17,7 @@ public unsafe partial struct ImColorPtr public static implicit operator ImColorPtr(ImColor* nativePtr) => new ImColorPtr(nativePtr); 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(&NativePtr->Value); + public ref Vector4 Value => ref UnsafeUtility.AsRef(&NativePtr->Value); public void Destroy() { ImGuiNative.ImColor_destroy(NativePtr); diff --git a/ImGuiNET/Wrapper/Generated/ImDrawChannel.gen.cs b/ImGuiNET/Wrapper/Generated/ImDrawChannel.gen.cs index c1ddd70..4b7707f 100644 --- a/ImGuiNET/Wrapper/Generated/ImDrawChannel.gen.cs +++ b/ImGuiNET/Wrapper/Generated/ImDrawChannel.gen.cs @@ -1,7 +1,7 @@ using System; -using System.Runtime.CompilerServices; using System.Text; using UnityEngine; +using Unity.Collections.LowLevel.Unsafe; namespace ImGuiNET { @@ -18,7 +18,7 @@ public unsafe partial struct ImDrawChannelPtr public static implicit operator ImDrawChannelPtr(ImDrawChannel* nativePtr) => new ImDrawChannelPtr(nativePtr); public static implicit operator ImDrawChannel* (ImDrawChannelPtr wrappedPtr) => wrappedPtr.NativePtr; public static implicit operator ImDrawChannelPtr(IntPtr nativePtr) => new ImDrawChannelPtr(nativePtr); - public ImPtrVector _CmdBuffer => new ImPtrVector(NativePtr->_CmdBuffer, Unsafe.SizeOf()); + public ImPtrVector _CmdBuffer => new ImPtrVector(NativePtr->_CmdBuffer, UnsafeUtility.SizeOf()); public ImVector _IdxBuffer => new ImVector(NativePtr->_IdxBuffer); } } diff --git a/ImGuiNET/Wrapper/Generated/ImDrawCmd.gen.cs b/ImGuiNET/Wrapper/Generated/ImDrawCmd.gen.cs index 5662642..5428877 100644 --- a/ImGuiNET/Wrapper/Generated/ImDrawCmd.gen.cs +++ b/ImGuiNET/Wrapper/Generated/ImDrawCmd.gen.cs @@ -1,7 +1,7 @@ using System; -using System.Runtime.CompilerServices; using System.Text; using UnityEngine; +using Unity.Collections.LowLevel.Unsafe; namespace ImGuiNET { @@ -23,12 +23,12 @@ public unsafe partial struct ImDrawCmdPtr public static implicit operator ImDrawCmdPtr(ImDrawCmd* nativePtr) => new ImDrawCmdPtr(nativePtr); public static implicit operator ImDrawCmd* (ImDrawCmdPtr wrappedPtr) => wrappedPtr.NativePtr; public static implicit operator ImDrawCmdPtr(IntPtr nativePtr) => new ImDrawCmdPtr(nativePtr); - public ref uint ElemCount => ref Unsafe.AsRef(&NativePtr->ElemCount); - public ref Vector4 ClipRect => ref Unsafe.AsRef(&NativePtr->ClipRect); - public ref IntPtr TextureId => ref Unsafe.AsRef(&NativePtr->TextureId); - public ref uint VtxOffset => ref Unsafe.AsRef(&NativePtr->VtxOffset); - public ref uint IdxOffset => ref Unsafe.AsRef(&NativePtr->IdxOffset); - public ref IntPtr UserCallback => ref Unsafe.AsRef(&NativePtr->UserCallback); + public ref uint ElemCount => ref UnsafeUtility.AsRef(&NativePtr->ElemCount); + public ref Vector4 ClipRect => ref UnsafeUtility.AsRef(&NativePtr->ClipRect); + public ref IntPtr TextureId => ref UnsafeUtility.AsRef(&NativePtr->TextureId); + public ref uint VtxOffset => ref UnsafeUtility.AsRef(&NativePtr->VtxOffset); + public ref uint IdxOffset => ref UnsafeUtility.AsRef(&NativePtr->IdxOffset); + public ref IntPtr UserCallback => ref UnsafeUtility.AsRef(&NativePtr->UserCallback); public IntPtr UserCallbackData { get => (IntPtr)NativePtr->UserCallbackData; set => NativePtr->UserCallbackData = (void*)value; } public void Destroy() { diff --git a/ImGuiNET/Wrapper/Generated/ImDrawData.gen.cs b/ImGuiNET/Wrapper/Generated/ImDrawData.gen.cs index 242895e..6d960bd 100644 --- a/ImGuiNET/Wrapper/Generated/ImDrawData.gen.cs +++ b/ImGuiNET/Wrapper/Generated/ImDrawData.gen.cs @@ -1,7 +1,7 @@ using System; -using System.Runtime.CompilerServices; using System.Text; using UnityEngine; +using Unity.Collections.LowLevel.Unsafe; namespace ImGuiNET { @@ -24,14 +24,14 @@ public unsafe partial struct ImDrawDataPtr public static implicit operator ImDrawDataPtr(ImDrawData* nativePtr) => new ImDrawDataPtr(nativePtr); public static implicit operator ImDrawData* (ImDrawDataPtr wrappedPtr) => wrappedPtr.NativePtr; public static implicit operator ImDrawDataPtr(IntPtr nativePtr) => new ImDrawDataPtr(nativePtr); - public ref bool Valid => ref Unsafe.AsRef(&NativePtr->Valid); + public ref bool Valid => ref UnsafeUtility.AsRef(&NativePtr->Valid); public IntPtr CmdLists { get => (IntPtr)NativePtr->CmdLists; set => NativePtr->CmdLists = (ImDrawList**)value; } - public ref int CmdListsCount => ref Unsafe.AsRef(&NativePtr->CmdListsCount); - public ref int TotalIdxCount => ref Unsafe.AsRef(&NativePtr->TotalIdxCount); - public ref int TotalVtxCount => ref Unsafe.AsRef(&NativePtr->TotalVtxCount); - public ref Vector2 DisplayPos => ref Unsafe.AsRef(&NativePtr->DisplayPos); - public ref Vector2 DisplaySize => ref Unsafe.AsRef(&NativePtr->DisplaySize); - public ref Vector2 FramebufferScale => ref Unsafe.AsRef(&NativePtr->FramebufferScale); + public ref int CmdListsCount => ref UnsafeUtility.AsRef(&NativePtr->CmdListsCount); + public ref int TotalIdxCount => ref UnsafeUtility.AsRef(&NativePtr->TotalIdxCount); + public ref int TotalVtxCount => ref UnsafeUtility.AsRef(&NativePtr->TotalVtxCount); + public ref Vector2 DisplayPos => ref UnsafeUtility.AsRef(&NativePtr->DisplayPos); + public ref Vector2 DisplaySize => ref UnsafeUtility.AsRef(&NativePtr->DisplaySize); + public ref Vector2 FramebufferScale => ref UnsafeUtility.AsRef(&NativePtr->FramebufferScale); public void Clear() { ImGuiNative.ImDrawData_Clear(NativePtr); diff --git a/ImGuiNET/Wrapper/Generated/ImDrawList.gen.cs b/ImGuiNET/Wrapper/Generated/ImDrawList.gen.cs index 3a2ef0e..02754f8 100644 --- a/ImGuiNET/Wrapper/Generated/ImDrawList.gen.cs +++ b/ImGuiNET/Wrapper/Generated/ImDrawList.gen.cs @@ -1,7 +1,7 @@ using System; -using System.Runtime.CompilerServices; using System.Text; using UnityEngine; +using Unity.Collections.LowLevel.Unsafe; namespace ImGuiNET { @@ -30,20 +30,20 @@ public unsafe partial struct ImDrawListPtr public static implicit operator ImDrawListPtr(ImDrawList* nativePtr) => new ImDrawListPtr(nativePtr); public static implicit operator ImDrawList* (ImDrawListPtr wrappedPtr) => wrappedPtr.NativePtr; public static implicit operator ImDrawListPtr(IntPtr nativePtr) => new ImDrawListPtr(nativePtr); - public ImPtrVector CmdBuffer => new ImPtrVector(NativePtr->CmdBuffer, Unsafe.SizeOf()); + public ImPtrVector CmdBuffer => new ImPtrVector(NativePtr->CmdBuffer, UnsafeUtility.SizeOf()); public ImVector IdxBuffer => new ImVector(NativePtr->IdxBuffer); - public ImPtrVector VtxBuffer => new ImPtrVector(NativePtr->VtxBuffer, Unsafe.SizeOf()); - public ref ImDrawListFlags Flags => ref Unsafe.AsRef(&NativePtr->Flags); - public ref IntPtr _Data => ref Unsafe.AsRef(&NativePtr->_Data); + public ImPtrVector VtxBuffer => new ImPtrVector(NativePtr->VtxBuffer, UnsafeUtility.SizeOf()); + public ref ImDrawListFlags Flags => ref UnsafeUtility.AsRef(&NativePtr->Flags); + public ref IntPtr _Data => ref UnsafeUtility.AsRef(&NativePtr->_Data); public NullTerminatedString _OwnerName => new NullTerminatedString(NativePtr->_OwnerName); - public ref uint _VtxCurrentOffset => ref Unsafe.AsRef(&NativePtr->_VtxCurrentOffset); - public ref uint _VtxCurrentIdx => ref Unsafe.AsRef(&NativePtr->_VtxCurrentIdx); + public ref uint _VtxCurrentOffset => ref UnsafeUtility.AsRef(&NativePtr->_VtxCurrentOffset); + public ref uint _VtxCurrentIdx => ref UnsafeUtility.AsRef(&NativePtr->_VtxCurrentIdx); public ImDrawVertPtr _VtxWritePtr => new ImDrawVertPtr(NativePtr->_VtxWritePtr); public IntPtr _IdxWritePtr { get => (IntPtr)NativePtr->_IdxWritePtr; set => NativePtr->_IdxWritePtr = (ushort*)value; } public ImVector _ClipRectStack => new ImVector(NativePtr->_ClipRectStack); public ImVector _TextureIdStack => new ImVector(NativePtr->_TextureIdStack); public ImVector _Path => new ImVector(NativePtr->_Path); - public ref ImDrawListSplitter _Splitter => ref Unsafe.AsRef(&NativePtr->_Splitter); + public ref ImDrawListSplitter _Splitter => ref UnsafeUtility.AsRef(&NativePtr->_Splitter); public void AddBezierCurve(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, uint col, float thickness) { int num_segments = 0; diff --git a/ImGuiNET/Wrapper/Generated/ImDrawListSplitter.gen.cs b/ImGuiNET/Wrapper/Generated/ImDrawListSplitter.gen.cs index 5ef29da..eda75ad 100644 --- a/ImGuiNET/Wrapper/Generated/ImDrawListSplitter.gen.cs +++ b/ImGuiNET/Wrapper/Generated/ImDrawListSplitter.gen.cs @@ -1,7 +1,7 @@ using System; -using System.Runtime.CompilerServices; using System.Text; using UnityEngine; +using Unity.Collections.LowLevel.Unsafe; namespace ImGuiNET { @@ -19,9 +19,9 @@ public unsafe partial struct ImDrawListSplitterPtr public static implicit operator ImDrawListSplitterPtr(ImDrawListSplitter* nativePtr) => new ImDrawListSplitterPtr(nativePtr); public static implicit operator ImDrawListSplitter* (ImDrawListSplitterPtr wrappedPtr) => wrappedPtr.NativePtr; public static implicit operator ImDrawListSplitterPtr(IntPtr nativePtr) => new ImDrawListSplitterPtr(nativePtr); - public ref int _Current => ref Unsafe.AsRef(&NativePtr->_Current); - public ref int _Count => ref Unsafe.AsRef(&NativePtr->_Count); - public ImPtrVector _Channels => new ImPtrVector(NativePtr->_Channels, Unsafe.SizeOf()); + public ref int _Current => ref UnsafeUtility.AsRef(&NativePtr->_Current); + public ref int _Count => ref UnsafeUtility.AsRef(&NativePtr->_Count); + public ImPtrVector _Channels => new ImPtrVector(NativePtr->_Channels, UnsafeUtility.SizeOf()); public void Clear() { ImGuiNative.ImDrawListSplitter_Clear(NativePtr); diff --git a/ImGuiNET/Wrapper/Generated/ImDrawVert.gen.cs b/ImGuiNET/Wrapper/Generated/ImDrawVert.gen.cs index 1271792..0bb5663 100644 --- a/ImGuiNET/Wrapper/Generated/ImDrawVert.gen.cs +++ b/ImGuiNET/Wrapper/Generated/ImDrawVert.gen.cs @@ -1,7 +1,7 @@ using System; -using System.Runtime.CompilerServices; using System.Text; using UnityEngine; +using Unity.Collections.LowLevel.Unsafe; namespace ImGuiNET { @@ -19,8 +19,8 @@ public unsafe partial struct ImDrawVertPtr public static implicit operator ImDrawVertPtr(ImDrawVert* nativePtr) => new ImDrawVertPtr(nativePtr); public static implicit operator ImDrawVert* (ImDrawVertPtr wrappedPtr) => wrappedPtr.NativePtr; public static implicit operator ImDrawVertPtr(IntPtr nativePtr) => new ImDrawVertPtr(nativePtr); - public ref Vector2 pos => ref Unsafe.AsRef(&NativePtr->pos); - public ref Vector2 uv => ref Unsafe.AsRef(&NativePtr->uv); - public ref uint col => ref Unsafe.AsRef(&NativePtr->col); + public ref Vector2 pos => ref UnsafeUtility.AsRef(&NativePtr->pos); + public ref Vector2 uv => ref UnsafeUtility.AsRef(&NativePtr->uv); + public ref uint col => ref UnsafeUtility.AsRef(&NativePtr->col); } } diff --git a/ImGuiNET/Wrapper/Generated/ImFont.gen.cs b/ImGuiNET/Wrapper/Generated/ImFont.gen.cs index 4f97ccf..4f9b4cb 100644 --- a/ImGuiNET/Wrapper/Generated/ImFont.gen.cs +++ b/ImGuiNET/Wrapper/Generated/ImFont.gen.cs @@ -1,7 +1,7 @@ using System; -using System.Runtime.CompilerServices; using System.Text; using UnityEngine; +using Unity.Collections.LowLevel.Unsafe; namespace ImGuiNET { @@ -34,22 +34,22 @@ public unsafe partial struct ImFontPtr public static implicit operator ImFont* (ImFontPtr wrappedPtr) => wrappedPtr.NativePtr; public static implicit operator ImFontPtr(IntPtr nativePtr) => new ImFontPtr(nativePtr); public ImVector IndexAdvanceX => new ImVector(NativePtr->IndexAdvanceX); - public ref float FallbackAdvanceX => ref Unsafe.AsRef(&NativePtr->FallbackAdvanceX); - public ref float FontSize => ref Unsafe.AsRef(&NativePtr->FontSize); + public ref float FallbackAdvanceX => ref UnsafeUtility.AsRef(&NativePtr->FallbackAdvanceX); + public ref float FontSize => ref UnsafeUtility.AsRef(&NativePtr->FontSize); public ImVector IndexLookup => new ImVector(NativePtr->IndexLookup); - public ImPtrVector Glyphs => new ImPtrVector(NativePtr->Glyphs, Unsafe.SizeOf()); + public ImPtrVector Glyphs => new ImPtrVector(NativePtr->Glyphs, UnsafeUtility.SizeOf()); public ImFontGlyphPtr FallbackGlyph => new ImFontGlyphPtr(NativePtr->FallbackGlyph); - public ref Vector2 DisplayOffset => ref Unsafe.AsRef(&NativePtr->DisplayOffset); + public ref Vector2 DisplayOffset => ref UnsafeUtility.AsRef(&NativePtr->DisplayOffset); public ImFontAtlasPtr ContainerAtlas => new ImFontAtlasPtr(NativePtr->ContainerAtlas); public ImFontConfigPtr ConfigData => new ImFontConfigPtr(NativePtr->ConfigData); - public ref short ConfigDataCount => ref Unsafe.AsRef(&NativePtr->ConfigDataCount); - public ref ushort FallbackChar => ref Unsafe.AsRef(&NativePtr->FallbackChar); - public ref ushort EllipsisChar => ref Unsafe.AsRef(&NativePtr->EllipsisChar); - public ref bool DirtyLookupTables => ref Unsafe.AsRef(&NativePtr->DirtyLookupTables); - public ref float Scale => ref Unsafe.AsRef(&NativePtr->Scale); - public ref float Ascent => ref Unsafe.AsRef(&NativePtr->Ascent); - public ref float Descent => ref Unsafe.AsRef(&NativePtr->Descent); - public ref int MetricsTotalSurface => ref Unsafe.AsRef(&NativePtr->MetricsTotalSurface); + public ref short ConfigDataCount => ref UnsafeUtility.AsRef(&NativePtr->ConfigDataCount); + public ref ushort FallbackChar => ref UnsafeUtility.AsRef(&NativePtr->FallbackChar); + public ref ushort EllipsisChar => ref UnsafeUtility.AsRef(&NativePtr->EllipsisChar); + public ref bool DirtyLookupTables => ref UnsafeUtility.AsRef(&NativePtr->DirtyLookupTables); + public ref float Scale => ref UnsafeUtility.AsRef(&NativePtr->Scale); + public ref float Ascent => ref UnsafeUtility.AsRef(&NativePtr->Ascent); + public ref float Descent => ref UnsafeUtility.AsRef(&NativePtr->Descent); + public ref int MetricsTotalSurface => ref UnsafeUtility.AsRef(&NativePtr->MetricsTotalSurface); public void AddGlyph(ushort c, float x0, float y0, float x1, float y1, float u0, float v0, float u1, float v1, float advance_x) { ImGuiNative.ImFont_AddGlyph(NativePtr, c, x0, y0, x1, y1, u0, v0, u1, v1, advance_x); diff --git a/ImGuiNET/Wrapper/Generated/ImFontAtlas.gen.cs b/ImGuiNET/Wrapper/Generated/ImFontAtlas.gen.cs index 4621d03..146f141 100644 --- a/ImGuiNET/Wrapper/Generated/ImFontAtlas.gen.cs +++ b/ImGuiNET/Wrapper/Generated/ImFontAtlas.gen.cs @@ -1,7 +1,7 @@ using System; -using System.Runtime.CompilerServices; using System.Text; using UnityEngine; +using Unity.Collections.LowLevel.Unsafe; namespace ImGuiNET { @@ -31,20 +31,20 @@ public unsafe partial struct ImFontAtlasPtr public static implicit operator ImFontAtlasPtr(ImFontAtlas* nativePtr) => new ImFontAtlasPtr(nativePtr); public static implicit operator ImFontAtlas* (ImFontAtlasPtr wrappedPtr) => wrappedPtr.NativePtr; public static implicit operator ImFontAtlasPtr(IntPtr nativePtr) => new ImFontAtlasPtr(nativePtr); - public ref bool Locked => ref Unsafe.AsRef(&NativePtr->Locked); - public ref ImFontAtlasFlags Flags => ref Unsafe.AsRef(&NativePtr->Flags); - public ref IntPtr TexID => ref Unsafe.AsRef(&NativePtr->TexID); - public ref int TexDesiredWidth => ref Unsafe.AsRef(&NativePtr->TexDesiredWidth); - public ref int TexGlyphPadding => ref Unsafe.AsRef(&NativePtr->TexGlyphPadding); + public ref bool Locked => ref UnsafeUtility.AsRef(&NativePtr->Locked); + public ref ImFontAtlasFlags Flags => ref UnsafeUtility.AsRef(&NativePtr->Flags); + public ref IntPtr TexID => ref UnsafeUtility.AsRef(&NativePtr->TexID); + public ref int TexDesiredWidth => ref UnsafeUtility.AsRef(&NativePtr->TexDesiredWidth); + public ref int TexGlyphPadding => ref UnsafeUtility.AsRef(&NativePtr->TexGlyphPadding); public IntPtr TexPixelsAlpha8 { get => (IntPtr)NativePtr->TexPixelsAlpha8; set => NativePtr->TexPixelsAlpha8 = (byte*)value; } public IntPtr TexPixelsRGBA32 { get => (IntPtr)NativePtr->TexPixelsRGBA32; set => NativePtr->TexPixelsRGBA32 = (uint*)value; } - public ref int TexWidth => ref Unsafe.AsRef(&NativePtr->TexWidth); - public ref int TexHeight => ref Unsafe.AsRef(&NativePtr->TexHeight); - public ref Vector2 TexUvScale => ref Unsafe.AsRef(&NativePtr->TexUvScale); - public ref Vector2 TexUvWhitePixel => ref Unsafe.AsRef(&NativePtr->TexUvWhitePixel); + public ref int TexWidth => ref UnsafeUtility.AsRef(&NativePtr->TexWidth); + public ref int TexHeight => ref UnsafeUtility.AsRef(&NativePtr->TexHeight); + public ref Vector2 TexUvScale => ref UnsafeUtility.AsRef(&NativePtr->TexUvScale); + public ref Vector2 TexUvWhitePixel => ref UnsafeUtility.AsRef(&NativePtr->TexUvWhitePixel); public ImVector Fonts => new ImVector(NativePtr->Fonts); - public ImPtrVector CustomRects => new ImPtrVector(NativePtr->CustomRects, Unsafe.SizeOf()); - public ImPtrVector ConfigData => new ImPtrVector(NativePtr->ConfigData, Unsafe.SizeOf()); + public ImPtrVector CustomRects => new ImPtrVector(NativePtr->CustomRects, UnsafeUtility.SizeOf()); + public ImPtrVector ConfigData => new ImPtrVector(NativePtr->ConfigData, UnsafeUtility.SizeOf()); public RangeAccessor CustomRectIds => new RangeAccessor(NativePtr->CustomRectIds, 1); public int AddCustomRectFontGlyph(ImFontPtr font, ushort id, int width, int height, float advance_x) { diff --git a/ImGuiNET/Wrapper/Generated/ImFontAtlasCustomRect.gen.cs b/ImGuiNET/Wrapper/Generated/ImFontAtlasCustomRect.gen.cs index 4f2b29f..6310e5b 100644 --- a/ImGuiNET/Wrapper/Generated/ImFontAtlasCustomRect.gen.cs +++ b/ImGuiNET/Wrapper/Generated/ImFontAtlasCustomRect.gen.cs @@ -1,7 +1,7 @@ using System; -using System.Runtime.CompilerServices; using System.Text; using UnityEngine; +using Unity.Collections.LowLevel.Unsafe; namespace ImGuiNET { @@ -24,13 +24,13 @@ public unsafe partial struct ImFontAtlasCustomRectPtr public static implicit operator ImFontAtlasCustomRectPtr(ImFontAtlasCustomRect* nativePtr) => new ImFontAtlasCustomRectPtr(nativePtr); public static implicit operator ImFontAtlasCustomRect* (ImFontAtlasCustomRectPtr wrappedPtr) => wrappedPtr.NativePtr; public static implicit operator ImFontAtlasCustomRectPtr(IntPtr nativePtr) => new ImFontAtlasCustomRectPtr(nativePtr); - public ref uint ID => ref Unsafe.AsRef(&NativePtr->ID); - public ref ushort Width => ref Unsafe.AsRef(&NativePtr->Width); - public ref ushort Height => ref Unsafe.AsRef(&NativePtr->Height); - public ref ushort X => ref Unsafe.AsRef(&NativePtr->X); - public ref ushort Y => ref Unsafe.AsRef(&NativePtr->Y); - public ref float GlyphAdvanceX => ref Unsafe.AsRef(&NativePtr->GlyphAdvanceX); - public ref Vector2 GlyphOffset => ref Unsafe.AsRef(&NativePtr->GlyphOffset); + public ref uint ID => ref UnsafeUtility.AsRef(&NativePtr->ID); + public ref ushort Width => ref UnsafeUtility.AsRef(&NativePtr->Width); + public ref ushort Height => ref UnsafeUtility.AsRef(&NativePtr->Height); + public ref ushort X => ref UnsafeUtility.AsRef(&NativePtr->X); + public ref ushort Y => ref UnsafeUtility.AsRef(&NativePtr->Y); + public ref float GlyphAdvanceX => ref UnsafeUtility.AsRef(&NativePtr->GlyphAdvanceX); + public ref Vector2 GlyphOffset => ref UnsafeUtility.AsRef(&NativePtr->GlyphOffset); public ImFontPtr Font => new ImFontPtr(NativePtr->Font); public void Destroy() { diff --git a/ImGuiNET/Wrapper/Generated/ImFontConfig.gen.cs b/ImGuiNET/Wrapper/Generated/ImFontConfig.gen.cs index e5f2cb8..4e99546 100644 --- a/ImGuiNET/Wrapper/Generated/ImFontConfig.gen.cs +++ b/ImGuiNET/Wrapper/Generated/ImFontConfig.gen.cs @@ -1,7 +1,7 @@ using System; -using System.Runtime.CompilerServices; using System.Text; using UnityEngine; +using Unity.Collections.LowLevel.Unsafe; namespace ImGuiNET { @@ -36,22 +36,22 @@ public unsafe partial struct ImFontConfigPtr public static implicit operator ImFontConfig* (ImFontConfigPtr wrappedPtr) => wrappedPtr.NativePtr; public static implicit operator ImFontConfigPtr(IntPtr nativePtr) => new ImFontConfigPtr(nativePtr); public IntPtr FontData { get => (IntPtr)NativePtr->FontData; set => NativePtr->FontData = (void*)value; } - public ref int FontDataSize => ref Unsafe.AsRef(&NativePtr->FontDataSize); - public ref bool FontDataOwnedByAtlas => ref Unsafe.AsRef(&NativePtr->FontDataOwnedByAtlas); - public ref int FontNo => ref Unsafe.AsRef(&NativePtr->FontNo); - public ref float SizePixels => ref Unsafe.AsRef(&NativePtr->SizePixels); - public ref int OversampleH => ref Unsafe.AsRef(&NativePtr->OversampleH); - public ref int OversampleV => ref Unsafe.AsRef(&NativePtr->OversampleV); - public ref bool PixelSnapH => ref Unsafe.AsRef(&NativePtr->PixelSnapH); - public ref Vector2 GlyphExtraSpacing => ref Unsafe.AsRef(&NativePtr->GlyphExtraSpacing); - public ref Vector2 GlyphOffset => ref Unsafe.AsRef(&NativePtr->GlyphOffset); + public ref int FontDataSize => ref UnsafeUtility.AsRef(&NativePtr->FontDataSize); + public ref bool FontDataOwnedByAtlas => ref UnsafeUtility.AsRef(&NativePtr->FontDataOwnedByAtlas); + public ref int FontNo => ref UnsafeUtility.AsRef(&NativePtr->FontNo); + public ref float SizePixels => ref UnsafeUtility.AsRef(&NativePtr->SizePixels); + public ref int OversampleH => ref UnsafeUtility.AsRef(&NativePtr->OversampleH); + public ref int OversampleV => ref UnsafeUtility.AsRef(&NativePtr->OversampleV); + public ref bool PixelSnapH => ref UnsafeUtility.AsRef(&NativePtr->PixelSnapH); + public ref Vector2 GlyphExtraSpacing => ref UnsafeUtility.AsRef(&NativePtr->GlyphExtraSpacing); + public ref Vector2 GlyphOffset => ref UnsafeUtility.AsRef(&NativePtr->GlyphOffset); public IntPtr GlyphRanges { get => (IntPtr)NativePtr->GlyphRanges; set => NativePtr->GlyphRanges = (ushort*)value; } - public ref float GlyphMinAdvanceX => ref Unsafe.AsRef(&NativePtr->GlyphMinAdvanceX); - public ref float GlyphMaxAdvanceX => ref Unsafe.AsRef(&NativePtr->GlyphMaxAdvanceX); - public ref bool MergeMode => ref Unsafe.AsRef(&NativePtr->MergeMode); - public ref uint RasterizerFlags => ref Unsafe.AsRef(&NativePtr->RasterizerFlags); - public ref float RasterizerMultiply => ref Unsafe.AsRef(&NativePtr->RasterizerMultiply); - public ref ushort EllipsisChar => ref Unsafe.AsRef(&NativePtr->EllipsisChar); + public ref float GlyphMinAdvanceX => ref UnsafeUtility.AsRef(&NativePtr->GlyphMinAdvanceX); + public ref float GlyphMaxAdvanceX => ref UnsafeUtility.AsRef(&NativePtr->GlyphMaxAdvanceX); + public ref bool MergeMode => ref UnsafeUtility.AsRef(&NativePtr->MergeMode); + public ref uint RasterizerFlags => ref UnsafeUtility.AsRef(&NativePtr->RasterizerFlags); + public ref float RasterizerMultiply => ref UnsafeUtility.AsRef(&NativePtr->RasterizerMultiply); + public ref ushort EllipsisChar => ref UnsafeUtility.AsRef(&NativePtr->EllipsisChar); public RangeAccessor Name => new RangeAccessor(NativePtr->Name, 40); public ImFontPtr DstFont => new ImFontPtr(NativePtr->DstFont); public void Destroy() diff --git a/ImGuiNET/Wrapper/Generated/ImFontGlyph.gen.cs b/ImGuiNET/Wrapper/Generated/ImFontGlyph.gen.cs index d1533a4..61989c8 100644 --- a/ImGuiNET/Wrapper/Generated/ImFontGlyph.gen.cs +++ b/ImGuiNET/Wrapper/Generated/ImFontGlyph.gen.cs @@ -1,7 +1,7 @@ using System; -using System.Runtime.CompilerServices; using System.Text; using UnityEngine; +using Unity.Collections.LowLevel.Unsafe; namespace ImGuiNET { @@ -26,15 +26,15 @@ public unsafe partial struct ImFontGlyphPtr public static implicit operator ImFontGlyphPtr(ImFontGlyph* nativePtr) => new ImFontGlyphPtr(nativePtr); public static implicit operator ImFontGlyph* (ImFontGlyphPtr wrappedPtr) => wrappedPtr.NativePtr; public static implicit operator ImFontGlyphPtr(IntPtr nativePtr) => new ImFontGlyphPtr(nativePtr); - public ref ushort Codepoint => ref Unsafe.AsRef(&NativePtr->Codepoint); - public ref float AdvanceX => ref Unsafe.AsRef(&NativePtr->AdvanceX); - public ref float X0 => ref Unsafe.AsRef(&NativePtr->X0); - public ref float Y0 => ref Unsafe.AsRef(&NativePtr->Y0); - public ref float X1 => ref Unsafe.AsRef(&NativePtr->X1); - public ref float Y1 => ref Unsafe.AsRef(&NativePtr->Y1); - public ref float U0 => ref Unsafe.AsRef(&NativePtr->U0); - public ref float V0 => ref Unsafe.AsRef(&NativePtr->V0); - public ref float U1 => ref Unsafe.AsRef(&NativePtr->U1); - public ref float V1 => ref Unsafe.AsRef(&NativePtr->V1); + public ref ushort Codepoint => ref UnsafeUtility.AsRef(&NativePtr->Codepoint); + public ref float AdvanceX => ref UnsafeUtility.AsRef(&NativePtr->AdvanceX); + public ref float X0 => ref UnsafeUtility.AsRef(&NativePtr->X0); + public ref float Y0 => ref UnsafeUtility.AsRef(&NativePtr->Y0); + public ref float X1 => ref UnsafeUtility.AsRef(&NativePtr->X1); + public ref float Y1 => ref UnsafeUtility.AsRef(&NativePtr->Y1); + public ref float U0 => ref UnsafeUtility.AsRef(&NativePtr->U0); + public ref float V0 => ref UnsafeUtility.AsRef(&NativePtr->V0); + public ref float U1 => ref UnsafeUtility.AsRef(&NativePtr->U1); + public ref float V1 => ref UnsafeUtility.AsRef(&NativePtr->V1); } } diff --git a/ImGuiNET/Wrapper/Generated/ImFontGlyphRangesBuilder.gen.cs b/ImGuiNET/Wrapper/Generated/ImFontGlyphRangesBuilder.gen.cs index 5893312..9fff6dd 100644 --- a/ImGuiNET/Wrapper/Generated/ImFontGlyphRangesBuilder.gen.cs +++ b/ImGuiNET/Wrapper/Generated/ImFontGlyphRangesBuilder.gen.cs @@ -1,7 +1,7 @@ using System; -using System.Runtime.CompilerServices; using System.Text; using UnityEngine; +using Unity.Collections.LowLevel.Unsafe; namespace ImGuiNET { diff --git a/ImGuiNET/Wrapper/Generated/ImGui.gen.cs b/ImGuiNET/Wrapper/Generated/ImGui.gen.cs index 0774b7f..894aa26 100644 --- a/ImGuiNET/Wrapper/Generated/ImGui.gen.cs +++ b/ImGuiNET/Wrapper/Generated/ImGui.gen.cs @@ -2,6 +2,7 @@ using System.Runtime.InteropServices; using System.Text; using UnityEngine; +using Unity.Collections.LowLevel.Unsafe; namespace ImGuiNET { diff --git a/ImGuiNET/Wrapper/Generated/ImGuiIO.gen.cs b/ImGuiNET/Wrapper/Generated/ImGuiIO.gen.cs index b265c0b..09c0838 100644 --- a/ImGuiNET/Wrapper/Generated/ImGuiIO.gen.cs +++ b/ImGuiNET/Wrapper/Generated/ImGuiIO.gen.cs @@ -1,7 +1,7 @@ using System; -using System.Runtime.CompilerServices; using System.Text; using UnityEngine; +using Unity.Collections.LowLevel.Unsafe; namespace ImGuiNET { @@ -101,67 +101,67 @@ public unsafe partial struct ImGuiIOPtr public static implicit operator ImGuiIOPtr(ImGuiIO* nativePtr) => new ImGuiIOPtr(nativePtr); public static implicit operator ImGuiIO* (ImGuiIOPtr wrappedPtr) => wrappedPtr.NativePtr; public static implicit operator ImGuiIOPtr(IntPtr nativePtr) => new ImGuiIOPtr(nativePtr); - public ref ImGuiConfigFlags ConfigFlags => ref Unsafe.AsRef(&NativePtr->ConfigFlags); - public ref ImGuiBackendFlags BackendFlags => ref Unsafe.AsRef(&NativePtr->BackendFlags); - public ref Vector2 DisplaySize => ref Unsafe.AsRef(&NativePtr->DisplaySize); - public ref float DeltaTime => ref Unsafe.AsRef(&NativePtr->DeltaTime); - public ref float IniSavingRate => ref Unsafe.AsRef(&NativePtr->IniSavingRate); + public ref ImGuiConfigFlags ConfigFlags => ref UnsafeUtility.AsRef(&NativePtr->ConfigFlags); + public ref ImGuiBackendFlags BackendFlags => ref UnsafeUtility.AsRef(&NativePtr->BackendFlags); + public ref Vector2 DisplaySize => ref UnsafeUtility.AsRef(&NativePtr->DisplaySize); + public ref float DeltaTime => ref UnsafeUtility.AsRef(&NativePtr->DeltaTime); + public ref float IniSavingRate => ref UnsafeUtility.AsRef(&NativePtr->IniSavingRate); public NullTerminatedString IniFilename => new NullTerminatedString(NativePtr->IniFilename); public NullTerminatedString LogFilename => new NullTerminatedString(NativePtr->LogFilename); - public ref float MouseDoubleClickTime => ref Unsafe.AsRef(&NativePtr->MouseDoubleClickTime); - public ref float MouseDoubleClickMaxDist => ref Unsafe.AsRef(&NativePtr->MouseDoubleClickMaxDist); - public ref float MouseDragThreshold => ref Unsafe.AsRef(&NativePtr->MouseDragThreshold); + public ref float MouseDoubleClickTime => ref UnsafeUtility.AsRef(&NativePtr->MouseDoubleClickTime); + public ref float MouseDoubleClickMaxDist => ref UnsafeUtility.AsRef(&NativePtr->MouseDoubleClickMaxDist); + public ref float MouseDragThreshold => ref UnsafeUtility.AsRef(&NativePtr->MouseDragThreshold); public RangeAccessor KeyMap => new RangeAccessor(NativePtr->KeyMap, 22); - public ref float KeyRepeatDelay => ref Unsafe.AsRef(&NativePtr->KeyRepeatDelay); - public ref float KeyRepeatRate => ref Unsafe.AsRef(&NativePtr->KeyRepeatRate); + public ref float KeyRepeatDelay => ref UnsafeUtility.AsRef(&NativePtr->KeyRepeatDelay); + public ref float KeyRepeatRate => ref UnsafeUtility.AsRef(&NativePtr->KeyRepeatRate); public IntPtr UserData { get => (IntPtr)NativePtr->UserData; set => NativePtr->UserData = (void*)value; } public ImFontAtlasPtr Fonts => new ImFontAtlasPtr(NativePtr->Fonts); - public ref float FontGlobalScale => ref Unsafe.AsRef(&NativePtr->FontGlobalScale); - public ref bool FontAllowUserScaling => ref Unsafe.AsRef(&NativePtr->FontAllowUserScaling); + public ref float FontGlobalScale => ref UnsafeUtility.AsRef(&NativePtr->FontGlobalScale); + public ref bool FontAllowUserScaling => ref UnsafeUtility.AsRef(&NativePtr->FontAllowUserScaling); public ImFontPtr FontDefault => new ImFontPtr(NativePtr->FontDefault); - public ref Vector2 DisplayFramebufferScale => ref Unsafe.AsRef(&NativePtr->DisplayFramebufferScale); - public ref bool MouseDrawCursor => ref Unsafe.AsRef(&NativePtr->MouseDrawCursor); - public ref bool ConfigMacOSXBehaviors => ref Unsafe.AsRef(&NativePtr->ConfigMacOSXBehaviors); - public ref bool ConfigInputTextCursorBlink => ref Unsafe.AsRef(&NativePtr->ConfigInputTextCursorBlink); - public ref bool ConfigWindowsResizeFromEdges => ref Unsafe.AsRef(&NativePtr->ConfigWindowsResizeFromEdges); - public ref bool ConfigWindowsMoveFromTitleBarOnly => ref Unsafe.AsRef(&NativePtr->ConfigWindowsMoveFromTitleBarOnly); - public ref float ConfigWindowsMemoryCompactTimer => ref Unsafe.AsRef(&NativePtr->ConfigWindowsMemoryCompactTimer); + public ref Vector2 DisplayFramebufferScale => ref UnsafeUtility.AsRef(&NativePtr->DisplayFramebufferScale); + public ref bool MouseDrawCursor => ref UnsafeUtility.AsRef(&NativePtr->MouseDrawCursor); + public ref bool ConfigMacOSXBehaviors => ref UnsafeUtility.AsRef(&NativePtr->ConfigMacOSXBehaviors); + public ref bool ConfigInputTextCursorBlink => ref UnsafeUtility.AsRef(&NativePtr->ConfigInputTextCursorBlink); + public ref bool ConfigWindowsResizeFromEdges => ref UnsafeUtility.AsRef(&NativePtr->ConfigWindowsResizeFromEdges); + public ref bool ConfigWindowsMoveFromTitleBarOnly => ref UnsafeUtility.AsRef(&NativePtr->ConfigWindowsMoveFromTitleBarOnly); + public ref float ConfigWindowsMemoryCompactTimer => ref UnsafeUtility.AsRef(&NativePtr->ConfigWindowsMemoryCompactTimer); public NullTerminatedString BackendPlatformName => new NullTerminatedString(NativePtr->BackendPlatformName); public NullTerminatedString BackendRendererName => new NullTerminatedString(NativePtr->BackendRendererName); public IntPtr BackendPlatformUserData { get => (IntPtr)NativePtr->BackendPlatformUserData; set => NativePtr->BackendPlatformUserData = (void*)value; } public IntPtr BackendRendererUserData { get => (IntPtr)NativePtr->BackendRendererUserData; set => NativePtr->BackendRendererUserData = (void*)value; } public IntPtr BackendLanguageUserData { get => (IntPtr)NativePtr->BackendLanguageUserData; set => NativePtr->BackendLanguageUserData = (void*)value; } - public ref IntPtr GetClipboardTextFn => ref Unsafe.AsRef(&NativePtr->GetClipboardTextFn); - public ref IntPtr SetClipboardTextFn => ref Unsafe.AsRef(&NativePtr->SetClipboardTextFn); + public ref IntPtr GetClipboardTextFn => ref UnsafeUtility.AsRef(&NativePtr->GetClipboardTextFn); + public ref IntPtr SetClipboardTextFn => ref UnsafeUtility.AsRef(&NativePtr->SetClipboardTextFn); public IntPtr ClipboardUserData { get => (IntPtr)NativePtr->ClipboardUserData; set => NativePtr->ClipboardUserData = (void*)value; } - public ref IntPtr ImeSetInputScreenPosFn => ref Unsafe.AsRef(&NativePtr->ImeSetInputScreenPosFn); + public ref IntPtr ImeSetInputScreenPosFn => ref UnsafeUtility.AsRef(&NativePtr->ImeSetInputScreenPosFn); public IntPtr ImeWindowHandle { get => (IntPtr)NativePtr->ImeWindowHandle; set => NativePtr->ImeWindowHandle = (void*)value; } public IntPtr RenderDrawListsFnUnused { get => (IntPtr)NativePtr->RenderDrawListsFnUnused; set => NativePtr->RenderDrawListsFnUnused = (void*)value; } - public ref Vector2 MousePos => ref Unsafe.AsRef(&NativePtr->MousePos); + public ref Vector2 MousePos => ref UnsafeUtility.AsRef(&NativePtr->MousePos); public RangeAccessor MouseDown => new RangeAccessor(NativePtr->MouseDown, 5); - public ref float MouseWheel => ref Unsafe.AsRef(&NativePtr->MouseWheel); - public ref float MouseWheelH => ref Unsafe.AsRef(&NativePtr->MouseWheelH); - public ref bool KeyCtrl => ref Unsafe.AsRef(&NativePtr->KeyCtrl); - public ref bool KeyShift => ref Unsafe.AsRef(&NativePtr->KeyShift); - public ref bool KeyAlt => ref Unsafe.AsRef(&NativePtr->KeyAlt); - public ref bool KeySuper => ref Unsafe.AsRef(&NativePtr->KeySuper); + public ref float MouseWheel => ref UnsafeUtility.AsRef(&NativePtr->MouseWheel); + public ref float MouseWheelH => ref UnsafeUtility.AsRef(&NativePtr->MouseWheelH); + public ref bool KeyCtrl => ref UnsafeUtility.AsRef(&NativePtr->KeyCtrl); + public ref bool KeyShift => ref UnsafeUtility.AsRef(&NativePtr->KeyShift); + public ref bool KeyAlt => ref UnsafeUtility.AsRef(&NativePtr->KeyAlt); + public ref bool KeySuper => ref UnsafeUtility.AsRef(&NativePtr->KeySuper); public RangeAccessor KeysDown => new RangeAccessor(NativePtr->KeysDown, 512); public RangeAccessor NavInputs => new RangeAccessor(NativePtr->NavInputs, 21); - public ref bool WantCaptureMouse => ref Unsafe.AsRef(&NativePtr->WantCaptureMouse); - public ref bool WantCaptureKeyboard => ref Unsafe.AsRef(&NativePtr->WantCaptureKeyboard); - public ref bool WantTextInput => ref Unsafe.AsRef(&NativePtr->WantTextInput); - public ref bool WantSetMousePos => ref Unsafe.AsRef(&NativePtr->WantSetMousePos); - public ref bool WantSaveIniSettings => ref Unsafe.AsRef(&NativePtr->WantSaveIniSettings); - public ref bool NavActive => ref Unsafe.AsRef(&NativePtr->NavActive); - public ref bool NavVisible => ref Unsafe.AsRef(&NativePtr->NavVisible); - public ref float Framerate => ref Unsafe.AsRef(&NativePtr->Framerate); - public ref int MetricsRenderVertices => ref Unsafe.AsRef(&NativePtr->MetricsRenderVertices); - public ref int MetricsRenderIndices => ref Unsafe.AsRef(&NativePtr->MetricsRenderIndices); - public ref int MetricsRenderWindows => ref Unsafe.AsRef(&NativePtr->MetricsRenderWindows); - public ref int MetricsActiveWindows => ref Unsafe.AsRef(&NativePtr->MetricsActiveWindows); - public ref int MetricsActiveAllocations => ref Unsafe.AsRef(&NativePtr->MetricsActiveAllocations); - public ref Vector2 MouseDelta => ref Unsafe.AsRef(&NativePtr->MouseDelta); - public ref Vector2 MousePosPrev => ref Unsafe.AsRef(&NativePtr->MousePosPrev); + public ref bool WantCaptureMouse => ref UnsafeUtility.AsRef(&NativePtr->WantCaptureMouse); + public ref bool WantCaptureKeyboard => ref UnsafeUtility.AsRef(&NativePtr->WantCaptureKeyboard); + public ref bool WantTextInput => ref UnsafeUtility.AsRef(&NativePtr->WantTextInput); + public ref bool WantSetMousePos => ref UnsafeUtility.AsRef(&NativePtr->WantSetMousePos); + public ref bool WantSaveIniSettings => ref UnsafeUtility.AsRef(&NativePtr->WantSaveIniSettings); + public ref bool NavActive => ref UnsafeUtility.AsRef(&NativePtr->NavActive); + public ref bool NavVisible => ref UnsafeUtility.AsRef(&NativePtr->NavVisible); + public ref float Framerate => ref UnsafeUtility.AsRef(&NativePtr->Framerate); + public ref int MetricsRenderVertices => ref UnsafeUtility.AsRef(&NativePtr->MetricsRenderVertices); + public ref int MetricsRenderIndices => ref UnsafeUtility.AsRef(&NativePtr->MetricsRenderIndices); + public ref int MetricsRenderWindows => ref UnsafeUtility.AsRef(&NativePtr->MetricsRenderWindows); + public ref int MetricsActiveWindows => ref UnsafeUtility.AsRef(&NativePtr->MetricsActiveWindows); + public ref int MetricsActiveAllocations => ref UnsafeUtility.AsRef(&NativePtr->MetricsActiveAllocations); + public ref Vector2 MouseDelta => ref UnsafeUtility.AsRef(&NativePtr->MouseDelta); + public ref Vector2 MousePosPrev => ref UnsafeUtility.AsRef(&NativePtr->MousePosPrev); public RangeAccessor MouseClickedPos => new RangeAccessor(&NativePtr->MouseClickedPos_0, 5); public RangeAccessor MouseClickedTime => new RangeAccessor(NativePtr->MouseClickedTime, 5); public RangeAccessor MouseClicked => new RangeAccessor(NativePtr->MouseClicked, 5); diff --git a/ImGuiNET/Wrapper/Generated/ImGuiInputTextCallbackData.gen.cs b/ImGuiNET/Wrapper/Generated/ImGuiInputTextCallbackData.gen.cs index 23b7eee..741ddf9 100644 --- a/ImGuiNET/Wrapper/Generated/ImGuiInputTextCallbackData.gen.cs +++ b/ImGuiNET/Wrapper/Generated/ImGuiInputTextCallbackData.gen.cs @@ -1,7 +1,7 @@ using System; -using System.Runtime.CompilerServices; using System.Text; using UnityEngine; +using Unity.Collections.LowLevel.Unsafe; namespace ImGuiNET { @@ -28,18 +28,18 @@ public unsafe partial struct ImGuiInputTextCallbackDataPtr public static implicit operator ImGuiInputTextCallbackDataPtr(ImGuiInputTextCallbackData* nativePtr) => new ImGuiInputTextCallbackDataPtr(nativePtr); public static implicit operator ImGuiInputTextCallbackData* (ImGuiInputTextCallbackDataPtr wrappedPtr) => wrappedPtr.NativePtr; public static implicit operator ImGuiInputTextCallbackDataPtr(IntPtr nativePtr) => new ImGuiInputTextCallbackDataPtr(nativePtr); - public ref ImGuiInputTextFlags EventFlag => ref Unsafe.AsRef(&NativePtr->EventFlag); - public ref ImGuiInputTextFlags Flags => ref Unsafe.AsRef(&NativePtr->Flags); + public ref ImGuiInputTextFlags EventFlag => ref UnsafeUtility.AsRef(&NativePtr->EventFlag); + public ref ImGuiInputTextFlags Flags => ref UnsafeUtility.AsRef(&NativePtr->Flags); public IntPtr UserData { get => (IntPtr)NativePtr->UserData; set => NativePtr->UserData = (void*)value; } - public ref ushort EventChar => ref Unsafe.AsRef(&NativePtr->EventChar); - public ref ImGuiKey EventKey => ref Unsafe.AsRef(&NativePtr->EventKey); + public ref ushort EventChar => ref UnsafeUtility.AsRef(&NativePtr->EventChar); + public ref ImGuiKey EventKey => ref UnsafeUtility.AsRef(&NativePtr->EventKey); public IntPtr Buf { get => (IntPtr)NativePtr->Buf; set => NativePtr->Buf = (byte*)value; } - public ref int BufTextLen => ref Unsafe.AsRef(&NativePtr->BufTextLen); - public ref int BufSize => ref Unsafe.AsRef(&NativePtr->BufSize); - public ref bool BufDirty => ref Unsafe.AsRef(&NativePtr->BufDirty); - public ref int CursorPos => ref Unsafe.AsRef(&NativePtr->CursorPos); - public ref int SelectionStart => ref Unsafe.AsRef(&NativePtr->SelectionStart); - public ref int SelectionEnd => ref Unsafe.AsRef(&NativePtr->SelectionEnd); + public ref int BufTextLen => ref UnsafeUtility.AsRef(&NativePtr->BufTextLen); + public ref int BufSize => ref UnsafeUtility.AsRef(&NativePtr->BufSize); + public ref bool BufDirty => ref UnsafeUtility.AsRef(&NativePtr->BufDirty); + public ref int CursorPos => ref UnsafeUtility.AsRef(&NativePtr->CursorPos); + public ref int SelectionStart => ref UnsafeUtility.AsRef(&NativePtr->SelectionStart); + public ref int SelectionEnd => ref UnsafeUtility.AsRef(&NativePtr->SelectionEnd); public void DeleteChars(int pos, int bytes_count) { ImGuiNative.ImGuiInputTextCallbackData_DeleteChars(NativePtr, pos, bytes_count); diff --git a/ImGuiNET/Wrapper/Generated/ImGuiListClipper.gen.cs b/ImGuiNET/Wrapper/Generated/ImGuiListClipper.gen.cs index 943fcf0..18dd732 100644 --- a/ImGuiNET/Wrapper/Generated/ImGuiListClipper.gen.cs +++ b/ImGuiNET/Wrapper/Generated/ImGuiListClipper.gen.cs @@ -1,7 +1,7 @@ using System; -using System.Runtime.CompilerServices; using System.Text; using UnityEngine; +using Unity.Collections.LowLevel.Unsafe; namespace ImGuiNET { @@ -22,12 +22,12 @@ public unsafe partial struct ImGuiListClipperPtr public static implicit operator ImGuiListClipperPtr(ImGuiListClipper* nativePtr) => new ImGuiListClipperPtr(nativePtr); public static implicit operator ImGuiListClipper* (ImGuiListClipperPtr wrappedPtr) => wrappedPtr.NativePtr; public static implicit operator ImGuiListClipperPtr(IntPtr nativePtr) => new ImGuiListClipperPtr(nativePtr); - public ref int DisplayStart => ref Unsafe.AsRef(&NativePtr->DisplayStart); - public ref int DisplayEnd => ref Unsafe.AsRef(&NativePtr->DisplayEnd); - public ref int ItemsCount => ref Unsafe.AsRef(&NativePtr->ItemsCount); - public ref int StepNo => ref Unsafe.AsRef(&NativePtr->StepNo); - public ref float ItemsHeight => ref Unsafe.AsRef(&NativePtr->ItemsHeight); - public ref float StartPosY => ref Unsafe.AsRef(&NativePtr->StartPosY); + public ref int DisplayStart => ref UnsafeUtility.AsRef(&NativePtr->DisplayStart); + public ref int DisplayEnd => ref UnsafeUtility.AsRef(&NativePtr->DisplayEnd); + public ref int ItemsCount => ref UnsafeUtility.AsRef(&NativePtr->ItemsCount); + public ref int StepNo => ref UnsafeUtility.AsRef(&NativePtr->StepNo); + public ref float ItemsHeight => ref UnsafeUtility.AsRef(&NativePtr->ItemsHeight); + public ref float StartPosY => ref UnsafeUtility.AsRef(&NativePtr->StartPosY); public void Begin(int items_count) { float items_height = -1.0f; diff --git a/ImGuiNET/Wrapper/Generated/ImGuiNative.gen.cs b/ImGuiNET/Wrapper/Generated/ImGuiNative.gen.cs index d4c5588..3e8e303 100644 --- a/ImGuiNET/Wrapper/Generated/ImGuiNative.gen.cs +++ b/ImGuiNET/Wrapper/Generated/ImGuiNative.gen.cs @@ -1,6 +1,7 @@ using System; using System.Runtime.InteropServices; using UnityEngine; +using Unity.Collections.LowLevel.Unsafe; namespace ImGuiNET { diff --git a/ImGuiNET/Wrapper/Generated/ImGuiOnceUponAFrame.gen.cs b/ImGuiNET/Wrapper/Generated/ImGuiOnceUponAFrame.gen.cs index 00c2b22..30fa74b 100644 --- a/ImGuiNET/Wrapper/Generated/ImGuiOnceUponAFrame.gen.cs +++ b/ImGuiNET/Wrapper/Generated/ImGuiOnceUponAFrame.gen.cs @@ -1,7 +1,7 @@ using System; -using System.Runtime.CompilerServices; using System.Text; using UnityEngine; +using Unity.Collections.LowLevel.Unsafe; namespace ImGuiNET { @@ -17,7 +17,7 @@ public unsafe partial struct ImGuiOnceUponAFramePtr public static implicit operator ImGuiOnceUponAFramePtr(ImGuiOnceUponAFrame* nativePtr) => new ImGuiOnceUponAFramePtr(nativePtr); public static implicit operator ImGuiOnceUponAFrame* (ImGuiOnceUponAFramePtr wrappedPtr) => wrappedPtr.NativePtr; public static implicit operator ImGuiOnceUponAFramePtr(IntPtr nativePtr) => new ImGuiOnceUponAFramePtr(nativePtr); - public ref int RefFrame => ref Unsafe.AsRef(&NativePtr->RefFrame); + public ref int RefFrame => ref UnsafeUtility.AsRef(&NativePtr->RefFrame); public void Destroy() { ImGuiNative.ImGuiOnceUponAFrame_destroy(NativePtr); diff --git a/ImGuiNET/Wrapper/Generated/ImGuiPayload.gen.cs b/ImGuiNET/Wrapper/Generated/ImGuiPayload.gen.cs index cae9a30..318186d 100644 --- a/ImGuiNET/Wrapper/Generated/ImGuiPayload.gen.cs +++ b/ImGuiNET/Wrapper/Generated/ImGuiPayload.gen.cs @@ -1,7 +1,7 @@ using System; -using System.Runtime.CompilerServices; using System.Text; using UnityEngine; +using Unity.Collections.LowLevel.Unsafe; namespace ImGuiNET { @@ -25,13 +25,13 @@ public unsafe partial struct ImGuiPayloadPtr public static implicit operator ImGuiPayload* (ImGuiPayloadPtr wrappedPtr) => wrappedPtr.NativePtr; public static implicit operator ImGuiPayloadPtr(IntPtr nativePtr) => new ImGuiPayloadPtr(nativePtr); public IntPtr Data { get => (IntPtr)NativePtr->Data; set => NativePtr->Data = (void*)value; } - public ref int DataSize => ref Unsafe.AsRef(&NativePtr->DataSize); - public ref uint SourceId => ref Unsafe.AsRef(&NativePtr->SourceId); - public ref uint SourceParentId => ref Unsafe.AsRef(&NativePtr->SourceParentId); - public ref int DataFrameCount => ref Unsafe.AsRef(&NativePtr->DataFrameCount); + public ref int DataSize => ref UnsafeUtility.AsRef(&NativePtr->DataSize); + public ref uint SourceId => ref UnsafeUtility.AsRef(&NativePtr->SourceId); + public ref uint SourceParentId => ref UnsafeUtility.AsRef(&NativePtr->SourceParentId); + public ref int DataFrameCount => ref UnsafeUtility.AsRef(&NativePtr->DataFrameCount); public RangeAccessor DataType => new RangeAccessor(NativePtr->DataType, 33); - public ref bool Preview => ref Unsafe.AsRef(&NativePtr->Preview); - public ref bool Delivery => ref Unsafe.AsRef(&NativePtr->Delivery); + public ref bool Preview => ref UnsafeUtility.AsRef(&NativePtr->Preview); + public ref bool Delivery => ref UnsafeUtility.AsRef(&NativePtr->Delivery); public void Clear() { ImGuiNative.ImGuiPayload_Clear(NativePtr); diff --git a/ImGuiNET/Wrapper/Generated/ImGuiSizeCallbackData.gen.cs b/ImGuiNET/Wrapper/Generated/ImGuiSizeCallbackData.gen.cs index ed723ab..4621de6 100644 --- a/ImGuiNET/Wrapper/Generated/ImGuiSizeCallbackData.gen.cs +++ b/ImGuiNET/Wrapper/Generated/ImGuiSizeCallbackData.gen.cs @@ -1,7 +1,7 @@ using System; -using System.Runtime.CompilerServices; using System.Text; using UnityEngine; +using Unity.Collections.LowLevel.Unsafe; namespace ImGuiNET { @@ -21,8 +21,8 @@ public unsafe partial struct ImGuiSizeCallbackDataPtr public static implicit operator ImGuiSizeCallbackData* (ImGuiSizeCallbackDataPtr wrappedPtr) => wrappedPtr.NativePtr; public static implicit operator ImGuiSizeCallbackDataPtr(IntPtr nativePtr) => new ImGuiSizeCallbackDataPtr(nativePtr); public IntPtr UserData { get => (IntPtr)NativePtr->UserData; set => NativePtr->UserData = (void*)value; } - public ref Vector2 Pos => ref Unsafe.AsRef(&NativePtr->Pos); - public ref Vector2 CurrentSize => ref Unsafe.AsRef(&NativePtr->CurrentSize); - public ref Vector2 DesiredSize => ref Unsafe.AsRef(&NativePtr->DesiredSize); + public ref Vector2 Pos => ref UnsafeUtility.AsRef(&NativePtr->Pos); + public ref Vector2 CurrentSize => ref UnsafeUtility.AsRef(&NativePtr->CurrentSize); + public ref Vector2 DesiredSize => ref UnsafeUtility.AsRef(&NativePtr->DesiredSize); } } diff --git a/ImGuiNET/Wrapper/Generated/ImGuiStorage.gen.cs b/ImGuiNET/Wrapper/Generated/ImGuiStorage.gen.cs index 6b55cbf..6b68648 100644 --- a/ImGuiNET/Wrapper/Generated/ImGuiStorage.gen.cs +++ b/ImGuiNET/Wrapper/Generated/ImGuiStorage.gen.cs @@ -1,7 +1,7 @@ using System; -using System.Runtime.CompilerServices; using System.Text; using UnityEngine; +using Unity.Collections.LowLevel.Unsafe; namespace ImGuiNET { @@ -17,7 +17,7 @@ public unsafe partial struct ImGuiStoragePtr public static implicit operator ImGuiStoragePtr(ImGuiStorage* nativePtr) => new ImGuiStoragePtr(nativePtr); public static implicit operator ImGuiStorage* (ImGuiStoragePtr wrappedPtr) => wrappedPtr.NativePtr; public static implicit operator ImGuiStoragePtr(IntPtr nativePtr) => new ImGuiStoragePtr(nativePtr); - public ImPtrVector Data => new ImPtrVector(NativePtr->Data, Unsafe.SizeOf()); + public ImPtrVector Data => new ImPtrVector(NativePtr->Data, UnsafeUtility.SizeOf()); public void BuildSortByKey() { ImGuiNative.ImGuiStorage_BuildSortByKey(NativePtr); diff --git a/ImGuiNET/Wrapper/Generated/ImGuiStyle.gen.cs b/ImGuiNET/Wrapper/Generated/ImGuiStyle.gen.cs index add1165..af60fa1 100644 --- a/ImGuiNET/Wrapper/Generated/ImGuiStyle.gen.cs +++ b/ImGuiNET/Wrapper/Generated/ImGuiStyle.gen.cs @@ -1,7 +1,7 @@ using System; -using System.Runtime.CompilerServices; using System.Text; using UnityEngine; +using Unity.Collections.LowLevel.Unsafe; namespace ImGuiNET { @@ -99,41 +99,41 @@ public unsafe partial struct ImGuiStylePtr public static implicit operator ImGuiStylePtr(ImGuiStyle* nativePtr) => new ImGuiStylePtr(nativePtr); public static implicit operator ImGuiStyle* (ImGuiStylePtr wrappedPtr) => wrappedPtr.NativePtr; public static implicit operator ImGuiStylePtr(IntPtr nativePtr) => new ImGuiStylePtr(nativePtr); - public ref float Alpha => ref Unsafe.AsRef(&NativePtr->Alpha); - public ref Vector2 WindowPadding => ref Unsafe.AsRef(&NativePtr->WindowPadding); - public ref float WindowRounding => ref Unsafe.AsRef(&NativePtr->WindowRounding); - public ref float WindowBorderSize => ref Unsafe.AsRef(&NativePtr->WindowBorderSize); - public ref Vector2 WindowMinSize => ref Unsafe.AsRef(&NativePtr->WindowMinSize); - public ref Vector2 WindowTitleAlign => ref Unsafe.AsRef(&NativePtr->WindowTitleAlign); - public ref ImGuiDir WindowMenuButtonPosition => ref Unsafe.AsRef(&NativePtr->WindowMenuButtonPosition); - public ref float ChildRounding => ref Unsafe.AsRef(&NativePtr->ChildRounding); - public ref float ChildBorderSize => ref Unsafe.AsRef(&NativePtr->ChildBorderSize); - public ref float PopupRounding => ref Unsafe.AsRef(&NativePtr->PopupRounding); - public ref float PopupBorderSize => ref Unsafe.AsRef(&NativePtr->PopupBorderSize); - public ref Vector2 FramePadding => ref Unsafe.AsRef(&NativePtr->FramePadding); - public ref float FrameRounding => ref Unsafe.AsRef(&NativePtr->FrameRounding); - public ref float FrameBorderSize => ref Unsafe.AsRef(&NativePtr->FrameBorderSize); - public ref Vector2 ItemSpacing => ref Unsafe.AsRef(&NativePtr->ItemSpacing); - public ref Vector2 ItemInnerSpacing => ref Unsafe.AsRef(&NativePtr->ItemInnerSpacing); - public ref Vector2 TouchExtraPadding => ref Unsafe.AsRef(&NativePtr->TouchExtraPadding); - public ref float IndentSpacing => ref Unsafe.AsRef(&NativePtr->IndentSpacing); - public ref float ColumnsMinSpacing => ref Unsafe.AsRef(&NativePtr->ColumnsMinSpacing); - public ref float ScrollbarSize => ref Unsafe.AsRef(&NativePtr->ScrollbarSize); - public ref float ScrollbarRounding => ref Unsafe.AsRef(&NativePtr->ScrollbarRounding); - public ref float GrabMinSize => ref Unsafe.AsRef(&NativePtr->GrabMinSize); - public ref float GrabRounding => ref Unsafe.AsRef(&NativePtr->GrabRounding); - public ref float TabRounding => ref Unsafe.AsRef(&NativePtr->TabRounding); - public ref float TabBorderSize => ref Unsafe.AsRef(&NativePtr->TabBorderSize); - public ref ImGuiDir ColorButtonPosition => ref Unsafe.AsRef(&NativePtr->ColorButtonPosition); - public ref Vector2 ButtonTextAlign => ref Unsafe.AsRef(&NativePtr->ButtonTextAlign); - public ref Vector2 SelectableTextAlign => ref Unsafe.AsRef(&NativePtr->SelectableTextAlign); - public ref Vector2 DisplayWindowPadding => ref Unsafe.AsRef(&NativePtr->DisplayWindowPadding); - public ref Vector2 DisplaySafeAreaPadding => ref Unsafe.AsRef(&NativePtr->DisplaySafeAreaPadding); - public ref float MouseCursorScale => ref Unsafe.AsRef(&NativePtr->MouseCursorScale); - public ref bool AntiAliasedLines => ref Unsafe.AsRef(&NativePtr->AntiAliasedLines); - public ref bool AntiAliasedFill => ref Unsafe.AsRef(&NativePtr->AntiAliasedFill); - public ref float CurveTessellationTol => ref Unsafe.AsRef(&NativePtr->CurveTessellationTol); - public ref float CircleSegmentMaxError => ref Unsafe.AsRef(&NativePtr->CircleSegmentMaxError); + public ref float Alpha => ref UnsafeUtility.AsRef(&NativePtr->Alpha); + public ref Vector2 WindowPadding => ref UnsafeUtility.AsRef(&NativePtr->WindowPadding); + public ref float WindowRounding => ref UnsafeUtility.AsRef(&NativePtr->WindowRounding); + public ref float WindowBorderSize => ref UnsafeUtility.AsRef(&NativePtr->WindowBorderSize); + public ref Vector2 WindowMinSize => ref UnsafeUtility.AsRef(&NativePtr->WindowMinSize); + public ref Vector2 WindowTitleAlign => ref UnsafeUtility.AsRef(&NativePtr->WindowTitleAlign); + public ref ImGuiDir WindowMenuButtonPosition => ref UnsafeUtility.AsRef(&NativePtr->WindowMenuButtonPosition); + public ref float ChildRounding => ref UnsafeUtility.AsRef(&NativePtr->ChildRounding); + public ref float ChildBorderSize => ref UnsafeUtility.AsRef(&NativePtr->ChildBorderSize); + public ref float PopupRounding => ref UnsafeUtility.AsRef(&NativePtr->PopupRounding); + public ref float PopupBorderSize => ref UnsafeUtility.AsRef(&NativePtr->PopupBorderSize); + public ref Vector2 FramePadding => ref UnsafeUtility.AsRef(&NativePtr->FramePadding); + public ref float FrameRounding => ref UnsafeUtility.AsRef(&NativePtr->FrameRounding); + public ref float FrameBorderSize => ref UnsafeUtility.AsRef(&NativePtr->FrameBorderSize); + public ref Vector2 ItemSpacing => ref UnsafeUtility.AsRef(&NativePtr->ItemSpacing); + public ref Vector2 ItemInnerSpacing => ref UnsafeUtility.AsRef(&NativePtr->ItemInnerSpacing); + public ref Vector2 TouchExtraPadding => ref UnsafeUtility.AsRef(&NativePtr->TouchExtraPadding); + public ref float IndentSpacing => ref UnsafeUtility.AsRef(&NativePtr->IndentSpacing); + public ref float ColumnsMinSpacing => ref UnsafeUtility.AsRef(&NativePtr->ColumnsMinSpacing); + public ref float ScrollbarSize => ref UnsafeUtility.AsRef(&NativePtr->ScrollbarSize); + public ref float ScrollbarRounding => ref UnsafeUtility.AsRef(&NativePtr->ScrollbarRounding); + public ref float GrabMinSize => ref UnsafeUtility.AsRef(&NativePtr->GrabMinSize); + public ref float GrabRounding => ref UnsafeUtility.AsRef(&NativePtr->GrabRounding); + public ref float TabRounding => ref UnsafeUtility.AsRef(&NativePtr->TabRounding); + public ref float TabBorderSize => ref UnsafeUtility.AsRef(&NativePtr->TabBorderSize); + public ref ImGuiDir ColorButtonPosition => ref UnsafeUtility.AsRef(&NativePtr->ColorButtonPosition); + public ref Vector2 ButtonTextAlign => ref UnsafeUtility.AsRef(&NativePtr->ButtonTextAlign); + public ref Vector2 SelectableTextAlign => ref UnsafeUtility.AsRef(&NativePtr->SelectableTextAlign); + public ref Vector2 DisplayWindowPadding => ref UnsafeUtility.AsRef(&NativePtr->DisplayWindowPadding); + public ref Vector2 DisplaySafeAreaPadding => ref UnsafeUtility.AsRef(&NativePtr->DisplaySafeAreaPadding); + public ref float MouseCursorScale => ref UnsafeUtility.AsRef(&NativePtr->MouseCursorScale); + public ref bool AntiAliasedLines => ref UnsafeUtility.AsRef(&NativePtr->AntiAliasedLines); + public ref bool AntiAliasedFill => ref UnsafeUtility.AsRef(&NativePtr->AntiAliasedFill); + public ref float CurveTessellationTol => ref UnsafeUtility.AsRef(&NativePtr->CurveTessellationTol); + public ref float CircleSegmentMaxError => ref UnsafeUtility.AsRef(&NativePtr->CircleSegmentMaxError); public RangeAccessor Colors => new RangeAccessor(&NativePtr->Colors_0, 48); public void Destroy() { diff --git a/ImGuiNET/Wrapper/Generated/ImGuiTextFilter.gen.cs b/ImGuiNET/Wrapper/Generated/ImGuiTextFilter.gen.cs index 1a298a8..24c9f33 100644 --- a/ImGuiNET/Wrapper/Generated/ImGuiTextFilter.gen.cs +++ b/ImGuiNET/Wrapper/Generated/ImGuiTextFilter.gen.cs @@ -1,7 +1,7 @@ using System; -using System.Runtime.CompilerServices; using System.Text; using UnityEngine; +using Unity.Collections.LowLevel.Unsafe; namespace ImGuiNET { @@ -20,8 +20,8 @@ public unsafe partial struct ImGuiTextFilterPtr public static implicit operator ImGuiTextFilter* (ImGuiTextFilterPtr wrappedPtr) => wrappedPtr.NativePtr; public static implicit operator ImGuiTextFilterPtr(IntPtr nativePtr) => new ImGuiTextFilterPtr(nativePtr); public RangeAccessor InputBuf => new RangeAccessor(NativePtr->InputBuf, 256); - public ImPtrVector Filters => new ImPtrVector(NativePtr->Filters, Unsafe.SizeOf()); - public ref int CountGrep => ref Unsafe.AsRef(&NativePtr->CountGrep); + public ImPtrVector Filters => new ImPtrVector(NativePtr->Filters, UnsafeUtility.SizeOf()); + public ref int CountGrep => ref UnsafeUtility.AsRef(&NativePtr->CountGrep); public void Build() { ImGuiNative.ImGuiTextFilter_Build(NativePtr); diff --git a/ImGuiNET/Wrapper/ImGui.Manual.cs b/ImGuiNET/Wrapper/ImGui.Manual.cs index 9295a7d..0cd9802 100644 --- a/ImGuiNET/Wrapper/ImGui.Manual.cs +++ b/ImGuiNET/Wrapper/ImGui.Manual.cs @@ -1,8 +1,8 @@ using System; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Text; using UnityEngine; +using Unity.Collections.LowLevel.Unsafe; namespace ImGuiNET { @@ -128,8 +128,8 @@ public static bool InputText( } Util.GetUtf8(input, utf8InputBytes, inputBufSize); uint clearBytesCount = (uint)(inputBufSize - utf8InputByteCount); - Unsafe.InitBlockUnaligned(utf8InputBytes + utf8InputByteCount, 0, clearBytesCount); - Unsafe.CopyBlock(originalUtf8InputBytes, utf8InputBytes, (uint)inputBufSize); + UnsafeUtility.MemSet(utf8InputBytes + utf8InputByteCount, 0, clearBytesCount); + UnsafeUtility.MemCpy(originalUtf8InputBytes, utf8InputBytes, (uint)inputBufSize); byte result = ImGuiNative.igInputText( utf8LabelBytes, @@ -218,8 +218,8 @@ public static bool InputTextMultiline( } Util.GetUtf8(input, utf8InputBytes, inputBufSize); uint clearBytesCount = (uint)(inputBufSize - utf8InputByteCount); - Unsafe.InitBlockUnaligned(utf8InputBytes + utf8InputByteCount, 0, clearBytesCount); - Unsafe.CopyBlock(originalUtf8InputBytes, utf8InputBytes, (uint)inputBufSize); + UnsafeUtility.MemSet(utf8InputBytes + utf8InputByteCount, 0, clearBytesCount); + UnsafeUtility.MemCpy(originalUtf8InputBytes, utf8InputBytes, (uint)inputBufSize); byte result = ImGuiNative.igInputTextMultiline( utf8LabelBytes, diff --git a/ImGuiNET/Wrapper/ImVector.cs b/ImGuiNET/Wrapper/ImVector.cs index 76411b8..af04ceb 100644 --- a/ImGuiNET/Wrapper/ImVector.cs +++ b/ImGuiNET/Wrapper/ImVector.cs @@ -1,5 +1,5 @@ using System; -using System.Runtime.CompilerServices; +using Unity.Collections.LowLevel.Unsafe; namespace ImGuiNET { @@ -9,18 +9,18 @@ public unsafe struct ImVector public readonly int Capacity; public readonly IntPtr Data; - public ref T Ref(int index) + public ref T Ref(int index) where T : struct { - return ref Unsafe.AsRef((byte*)Data + index * Unsafe.SizeOf()); + return ref UnsafeUtility.AsRef((byte*)Data + index * UnsafeUtility.SizeOf()); } - public IntPtr Address(int index) + public IntPtr Address(int index) where T : struct { - return (IntPtr)((byte*)Data + index * Unsafe.SizeOf()); + return (IntPtr)((byte*)Data + index * UnsafeUtility.SizeOf()); } } - public unsafe struct ImVector + public unsafe struct ImVector where T : struct { public readonly int Size; public readonly int Capacity; @@ -40,7 +40,7 @@ public ImVector(int size, int capacity, IntPtr data) Data = data; } - public ref T this[int index] => ref Unsafe.AsRef((byte*)Data + index * Unsafe.SizeOf()); + public ref T this[int index] => ref UnsafeUtility.AsRef((byte*)Data + index * UnsafeUtility.SizeOf()); } public unsafe struct ImPtrVector @@ -67,7 +67,7 @@ public T this[int index] get { byte* address = (byte*)Data + index * _stride; - T ret = Unsafe.Read(&address); + T ret = UnsafeUtility.ReadArrayElement(&address, 0); return ret; } } diff --git a/ImGuiNET/Wrapper/RangeAccessor.cs b/ImGuiNET/Wrapper/RangeAccessor.cs index cf766c7..31ecc3b 100644 --- a/ImGuiNET/Wrapper/RangeAccessor.cs +++ b/ImGuiNET/Wrapper/RangeAccessor.cs @@ -1,12 +1,12 @@ using System; -using System.Runtime.CompilerServices; using System.Text; +using Unity.Collections.LowLevel.Unsafe; namespace ImGuiNET { public unsafe struct RangeAccessor where T : struct { - private static readonly int s_sizeOfT = Unsafe.SizeOf(); + private static readonly int s_sizeOfT = UnsafeUtility.SizeOf(); public readonly void* Data; public readonly int Count; @@ -27,7 +27,7 @@ public ref T this[int index] throw new IndexOutOfRangeException(); } - return ref Unsafe.AsRef((byte*)Data + s_sizeOfT * index); + return ref UnsafeUtility.AsRef((byte*)Data + s_sizeOfT * index); } } } @@ -53,7 +53,7 @@ public T this[int index] throw new IndexOutOfRangeException(); } - return Unsafe.Read((byte*)Data + sizeof(void*) * index); + return UnsafeUtility.ReadArrayElement((byte*)Data + sizeof(void*) * index, 0); } } }