From af11e21acca634da13c4d2ef0f7cd2bf41439d4a Mon Sep 17 00:00:00 2001 From: Eric Mellino Date: Thu, 5 Nov 2015 17:18:34 -0800 Subject: [PATCH] Changes from my assembly-browser project --- src/ImGui.NET/Align.cs | 2 +- src/ImGui.NET/ColorEditMode.cs | 2 +- src/ImGui.NET/ColorTarget.cs | 2 +- src/ImGui.NET/DrawCmd.cs | 2 +- src/ImGui.NET/DrawData.cs | 2 +- src/ImGui.NET/DrawList.cs | 2 +- src/ImGui.NET/DrawVert.cs | 2 +- src/ImGui.NET/Font.cs | 2 +- src/ImGui.NET/FontAtlas.cs | 2 +- src/ImGui.NET/FontConfig.cs | 2 +- src/ImGui.NET/GuiKey.cs | 2 +- src/ImGui.NET/IO.cs | 2 +- src/ImGui.NET/ImGui.NET.csproj | 3 +++ src/ImGui.NET/ImGui.cs | 2 +- src/ImGui.NET/ImGuiNative.cs | 38 ++++++++++++++++++++++++--- src/ImGui.NET/ImVector.cs | 2 +- src/ImGui.NET/InputTextFlags.cs | 2 +- src/ImGui.NET/MouseCursorKind.cs | 2 +- src/ImGui.NET/SelectableFlags.cs | 2 +- src/ImGui.NET/SetCondition.cs | 2 +- src/ImGui.NET/Storage.cs | 2 +- src/ImGui.NET/Style.cs | 2 +- src/ImGui.NET/StyleVar.cs | 2 +- src/ImGui.NET/TextEditCallback.cs | 2 +- src/ImGui.NET/TextEditCallbackData.cs | 2 +- src/ImGui.NET/WindowFlags.cs | 2 +- 26 files changed, 62 insertions(+), 27 deletions(-) diff --git a/src/ImGui.NET/Align.cs b/src/ImGui.NET/Align.cs index 6f380a0..2cb1756 100644 --- a/src/ImGui.NET/Align.cs +++ b/src/ImGui.NET/Align.cs @@ -1,4 +1,4 @@ -namespace ImGui +namespace ImGuiNET { public enum Align { diff --git a/src/ImGui.NET/ColorEditMode.cs b/src/ImGui.NET/ColorEditMode.cs index 4681e61..d6c0d11 100644 --- a/src/ImGui.NET/ColorEditMode.cs +++ b/src/ImGui.NET/ColorEditMode.cs @@ -1,4 +1,4 @@ -namespace ImGui +namespace ImGuiNET { /// /// Enumeration for ColorEditMode() diff --git a/src/ImGui.NET/ColorTarget.cs b/src/ImGui.NET/ColorTarget.cs index cbcdfaf..2d885fa 100644 --- a/src/ImGui.NET/ColorTarget.cs +++ b/src/ImGui.NET/ColorTarget.cs @@ -1,4 +1,4 @@ -namespace ImGui +namespace ImGuiNET { /// /// Enumeration for PushStyleColor() / PopStyleColor() diff --git a/src/ImGui.NET/DrawCmd.cs b/src/ImGui.NET/DrawCmd.cs index 2de631c..13f5db5 100644 --- a/src/ImGui.NET/DrawCmd.cs +++ b/src/ImGui.NET/DrawCmd.cs @@ -2,7 +2,7 @@ using System.Numerics; using System.Runtime.InteropServices; -namespace ImGui +namespace ImGuiNET { /// /// Typically, 1 command = 1 gpu draw call (unless command is a callback) diff --git a/src/ImGui.NET/DrawData.cs b/src/ImGui.NET/DrawData.cs index ab9b1e4..2ce11aa 100644 --- a/src/ImGui.NET/DrawData.cs +++ b/src/ImGui.NET/DrawData.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace ImGui +namespace ImGuiNET { // All draw data to render an ImGui frame [StructLayout(LayoutKind.Sequential)] diff --git a/src/ImGui.NET/DrawList.cs b/src/ImGui.NET/DrawList.cs index 078c7e9..a32add0 100644 --- a/src/ImGui.NET/DrawList.cs +++ b/src/ImGui.NET/DrawList.cs @@ -1,7 +1,7 @@ using System; using System.Runtime.InteropServices; -namespace ImGui +namespace ImGuiNET { /// /// Draw command list diff --git a/src/ImGui.NET/DrawVert.cs b/src/ImGui.NET/DrawVert.cs index 0ceff0e..ba2d0c4 100644 --- a/src/ImGui.NET/DrawVert.cs +++ b/src/ImGui.NET/DrawVert.cs @@ -1,7 +1,7 @@ using System.Numerics; using System.Runtime.InteropServices; -namespace ImGui +namespace ImGuiNET { [StructLayout(LayoutKind.Sequential)] public unsafe struct DrawVert diff --git a/src/ImGui.NET/Font.cs b/src/ImGui.NET/Font.cs index 43f2e98..4e55220 100644 --- a/src/ImGui.NET/Font.cs +++ b/src/ImGui.NET/Font.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; using System.Numerics; -namespace ImGui +namespace ImGuiNET { /// /// Font runtime data and rendering. diff --git a/src/ImGui.NET/FontAtlas.cs b/src/ImGui.NET/FontAtlas.cs index 04a14fe..1ef3521 100644 --- a/src/ImGui.NET/FontAtlas.cs +++ b/src/ImGui.NET/FontAtlas.cs @@ -2,7 +2,7 @@ using System; using System.Numerics; -namespace ImGui +namespace ImGuiNET { // Load and rasterize multiple TTF fonts into a same texture. // Sharing a texture for multiple fonts allows us to reduce the number of draw calls during rendering. diff --git a/src/ImGui.NET/FontConfig.cs b/src/ImGui.NET/FontConfig.cs index 1a05fc5..9a76d1c 100644 --- a/src/ImGui.NET/FontConfig.cs +++ b/src/ImGui.NET/FontConfig.cs @@ -2,7 +2,7 @@ using System.Numerics; using System.Runtime.InteropServices; -namespace ImGui +namespace ImGuiNET { [StructLayout(LayoutKind.Sequential)] public unsafe struct FontConfig diff --git a/src/ImGui.NET/GuiKey.cs b/src/ImGui.NET/GuiKey.cs index 485a460..ce2ac43 100644 --- a/src/ImGui.NET/GuiKey.cs +++ b/src/ImGui.NET/GuiKey.cs @@ -1,4 +1,4 @@ -namespace ImGui +namespace ImGuiNET { /// /// User fill ImGuiIO.KeyMap[] array with indices into the ImGuiIO.KeysDown[512] array diff --git a/src/ImGui.NET/IO.cs b/src/ImGui.NET/IO.cs index 12aecef..70660cb 100644 --- a/src/ImGui.NET/IO.cs +++ b/src/ImGui.NET/IO.cs @@ -2,7 +2,7 @@ using System.Numerics; using System.Runtime.InteropServices; -namespace ImGui +namespace ImGuiNET { [StructLayout(LayoutKind.Sequential)] public unsafe struct IO diff --git a/src/ImGui.NET/ImGui.NET.csproj b/src/ImGui.NET/ImGui.NET.csproj index d10458a..0ca1b77 100644 --- a/src/ImGui.NET/ImGui.NET.csproj +++ b/src/ImGui.NET/ImGui.NET.csproj @@ -80,6 +80,9 @@ AnyCPU MinimumRecommendedRules.ruleset + + true + diff --git a/src/ImGui.NET/ImGui.cs b/src/ImGui.NET/ImGui.cs index 9568f7a..87b192d 100644 --- a/src/ImGui.NET/ImGui.cs +++ b/src/ImGui.NET/ImGui.cs @@ -1,6 +1,6 @@ using System.Numerics; -namespace ImGui +namespace ImGuiNET { public static class ImGui { diff --git a/src/ImGui.NET/ImGuiNative.cs b/src/ImGui.NET/ImGuiNative.cs index 3b180fa..0ee1a33 100644 --- a/src/ImGui.NET/ImGuiNative.cs +++ b/src/ImGui.NET/ImGuiNative.cs @@ -2,7 +2,7 @@ using System.Numerics; using System; -namespace ImGui +namespace ImGuiNET { /// /// Contains all of the exported functions from the native (c)imGui module. @@ -30,6 +30,17 @@ namespace ImGui public static extern void igShowUserGuide(); [DllImport(cimguiLib)] public static extern void igShowStyleEditor(ref Style @ref); + + public static void igBegin(string v, ref object _mainWindowOpened, WindowFlags windowFlags) + { + throw new NotImplementedException(); + } + + public static void igBeginChildFrame(uint _leftFrameId, Vector2 vector2) + { + throw new NotImplementedException(); + } + [DllImport(cimguiLib)] public static extern void igShowTestWindow(ref bool opened); [DllImport(cimguiLib)] @@ -52,6 +63,12 @@ namespace ImGui public static extern void igGetContentRegionMax(out Vector2 @out); [DllImport(cimguiLib)] public static extern void igGetContentRegionAvail(out Vector2 @out); + + public static void igSliderFloat(string v1, ref object _sliderVal, float v2, float v3, string v4, int v5) + { + throw new NotImplementedException(); + } + [DllImport(cimguiLib)] public static extern float igGetContentRegionAvailWidth(); [DllImport(cimguiLib)] @@ -494,8 +511,23 @@ namespace ImGui public static extern void igOpenPopup(string str_id); [DllImport(cimguiLib)] public static extern bool igBeginPopup(string str_id); - [DllImport(cimguiLib)] - public static extern bool igBeginPopupModal(string name, ref bool p_opened, WindowFlags extra_flags); + [DllImport(cimguiLib, CharSet=CharSet.Ansi)] + public static extern bool igBeginPopupModal(string name, byte* p_opened, WindowFlags extra_flags); + + public static bool igBeginPopupModal(string name, WindowFlags extra_flags) + { + return igBeginPopupModal(name, null, extra_flags); + } + + public static bool igBeginPopupModal(string name, ref bool p_opened, WindowFlags extra_flags) + { + byte value = p_opened ? (byte)1 : (byte)0; + bool result = igBeginPopupModal(name, &value, extra_flags); + + p_opened = value == 1 ? true : false; + return result; + } + [DllImport(cimguiLib)] public static extern bool igBeginPopupContextItem(string str_id, int mouse_button); [DllImport(cimguiLib)] diff --git a/src/ImGui.NET/ImVector.cs b/src/ImGui.NET/ImVector.cs index 37f22e9..d2a3faa 100644 --- a/src/ImGui.NET/ImVector.cs +++ b/src/ImGui.NET/ImVector.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace ImGui +namespace ImGuiNET { [StructLayout(LayoutKind.Sequential)] public unsafe struct ImVector diff --git a/src/ImGui.NET/InputTextFlags.cs b/src/ImGui.NET/InputTextFlags.cs index 0be9d7d..7fc5293 100644 --- a/src/ImGui.NET/InputTextFlags.cs +++ b/src/ImGui.NET/InputTextFlags.cs @@ -1,4 +1,4 @@ -namespace ImGui +namespace ImGuiNET { /// /// Flags for ImGui.InputText() diff --git a/src/ImGui.NET/MouseCursorKind.cs b/src/ImGui.NET/MouseCursorKind.cs index 5791676..c9cf067 100644 --- a/src/ImGui.NET/MouseCursorKind.cs +++ b/src/ImGui.NET/MouseCursorKind.cs @@ -1,4 +1,4 @@ -namespace ImGui +namespace ImGuiNET { /// /// Enumeration for GetMouseCursor() diff --git a/src/ImGui.NET/SelectableFlags.cs b/src/ImGui.NET/SelectableFlags.cs index 12d923c..8b41dca 100644 --- a/src/ImGui.NET/SelectableFlags.cs +++ b/src/ImGui.NET/SelectableFlags.cs @@ -1,4 +1,4 @@ -namespace ImGui +namespace ImGuiNET { /// /// Flags for ImGui::Selectable() diff --git a/src/ImGui.NET/SetCondition.cs b/src/ImGui.NET/SetCondition.cs index c5c2cd1..b048ed6 100644 --- a/src/ImGui.NET/SetCondition.cs +++ b/src/ImGui.NET/SetCondition.cs @@ -1,4 +1,4 @@ -namespace ImGui +namespace ImGuiNET { /// /// Condition flags for ImGui::SetWindow***(), SetNextWindow***(), SetNextTreeNode***() functions. diff --git a/src/ImGui.NET/Storage.cs b/src/ImGui.NET/Storage.cs index fd3737c..c6cefe6 100644 --- a/src/ImGui.NET/Storage.cs +++ b/src/ImGui.NET/Storage.cs @@ -1,7 +1,7 @@ using System; using System.Runtime.InteropServices; -namespace ImGui +namespace ImGuiNET { [StructLayout(LayoutKind.Sequential)] public unsafe struct Storage diff --git a/src/ImGui.NET/Style.cs b/src/ImGui.NET/Style.cs index c032e16..9ffabcd 100644 --- a/src/ImGui.NET/Style.cs +++ b/src/ImGui.NET/Style.cs @@ -1,7 +1,7 @@ using System.Runtime.InteropServices; using System.Numerics; -namespace ImGui +namespace ImGuiNET { [StructLayout(LayoutKind.Sequential)] public unsafe struct Style diff --git a/src/ImGui.NET/StyleVar.cs b/src/ImGui.NET/StyleVar.cs index b81f733..d6334d5 100644 --- a/src/ImGui.NET/StyleVar.cs +++ b/src/ImGui.NET/StyleVar.cs @@ -1,4 +1,4 @@ -namespace ImGui +namespace ImGuiNET { /// /// Enumeration for PushStyleVar() / PopStyleVar() diff --git a/src/ImGui.NET/TextEditCallback.cs b/src/ImGui.NET/TextEditCallback.cs index 733d507..4d35c88 100644 --- a/src/ImGui.NET/TextEditCallback.cs +++ b/src/ImGui.NET/TextEditCallback.cs @@ -1,4 +1,4 @@ -namespace ImGui +namespace ImGuiNET { public unsafe delegate int TextEditCallback(TextEditCallbackData* data); } diff --git a/src/ImGui.NET/TextEditCallbackData.cs b/src/ImGui.NET/TextEditCallbackData.cs index 0debda0..24789e4 100644 --- a/src/ImGui.NET/TextEditCallbackData.cs +++ b/src/ImGui.NET/TextEditCallbackData.cs @@ -1,7 +1,7 @@ using System; using System.Runtime.InteropServices; -namespace ImGui +namespace ImGuiNET { [StructLayout(LayoutKind.Sequential)] public unsafe struct TextEditCallbackData diff --git a/src/ImGui.NET/WindowFlags.cs b/src/ImGui.NET/WindowFlags.cs index 89b5e47..7bec1f7 100644 --- a/src/ImGui.NET/WindowFlags.cs +++ b/src/ImGui.NET/WindowFlags.cs @@ -1,4 +1,4 @@ -namespace ImGui +namespace ImGuiNET { /// /// Flags for ImGui::Begin()