From e5b1e7c5223c1db8042b58588ecea74f82268213 Mon Sep 17 00:00:00 2001 From: David Pethes Date: Mon, 5 Jun 2017 15:09:42 +0200 Subject: [PATCH 1/2] group BeginWindow calls --- src/ImGui.NET/ImGui.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/ImGui.NET/ImGui.cs b/src/ImGui.NET/ImGui.cs index 5e2a116..8fb93ce 100644 --- a/src/ImGui.NET/ImGui.cs +++ b/src/ImGui.NET/ImGui.cs @@ -511,6 +511,16 @@ namespace ImGuiNET return ImGuiNative.igBegin2(windowTitle, ref opened, new Vector2(), backgroundAlpha, flags); } + public static bool BeginWindow(string windowTitle, ref bool opened, Vector2 startingSize, WindowFlags flags) + { + return ImGuiNative.igBegin2(windowTitle, ref opened, startingSize, 1f, flags); + } + + public static bool BeginWindow(string windowTitle, ref bool opened, Vector2 startingSize, float backgroundAlpha, WindowFlags flags) + { + return ImGuiNative.igBegin2(windowTitle, ref opened, startingSize, backgroundAlpha, flags); + } + public static bool BeginMenu(string label) { return ImGuiNative.igBeginMenu(label, true); @@ -531,11 +541,6 @@ namespace ImGuiNET ImGuiNative.igCloseCurrentPopup(); } - public static bool BeginWindow(string windowTitle, ref bool opened, Vector2 startingSize, WindowFlags flags) - { - return ImGuiNative.igBegin2(windowTitle, ref opened, startingSize, 1f, flags); - } - public static void EndMenuBar() { ImGuiNative.igEndMenuBar(); @@ -546,11 +551,6 @@ namespace ImGuiNET ImGuiNative.igEndMenu(); } - public static bool BeginWindow(string windowTitle, ref bool opened, Vector2 startingSize, float backgroundAlpha, WindowFlags flags) - { - return ImGuiNative.igBegin2(windowTitle, ref opened, startingSize, backgroundAlpha, flags); - } - public static void Separator() { ImGuiNative.igSeparator(); From ec40a94fb687794f70ba3b5287380d76a90da758 Mon Sep 17 00:00:00 2001 From: David Pethes Date: Thu, 15 Jun 2017 20:49:03 +0200 Subject: [PATCH 2/2] move igBeginPopupModal implementations from ImGuiNative to ImGui --- src/ImGui.NET/ImGui.cs | 18 +++++++++++------- src/ImGui.NET/ImGuiNative.cs | 14 -------------- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/src/ImGui.NET/ImGui.cs b/src/ImGui.NET/ImGui.cs index 8fb93ce..db4c81b 100644 --- a/src/ImGui.NET/ImGui.cs +++ b/src/ImGui.NET/ImGui.cs @@ -884,22 +884,26 @@ namespace ImGuiNET public static bool BeginPopupModal(string name) { - return ImGuiNative.igBeginPopupModal(name, WindowFlags.Default); + return BeginPopupModal(name, WindowFlags.Default); } - public static bool BeginPopupModal(string name, WindowFlags extraFlags) + public static bool BeginPopupModal(string name, ref bool opened) { - return ImGuiNative.igBeginPopupModal(name, extraFlags); + return BeginPopupModal(name, ref opened, WindowFlags.Default); } - public static bool BeginPopupModal(string name, ref bool opened) + public static unsafe bool BeginPopupModal(string name, WindowFlags extra_flags) { - return ImGuiNative.igBeginPopupModal(name, ref opened, WindowFlags.Default); + return ImGuiNative.igBeginPopupModal(name, null, extra_flags); } - public static bool BeginPopupModal(string name, ref bool opened, WindowFlags extraFlags) + public static unsafe bool BeginPopupModal(string name, ref bool p_opened, WindowFlags extra_flags) { - return ImGuiNative.igBeginPopupModal(name, ref opened, extraFlags); + byte value = p_opened ? (byte)1 : (byte)0; + bool result = ImGuiNative.igBeginPopupModal(name, &value, extra_flags); + + p_opened = value == 1 ? true : false; + return result; } public static bool Selectable(string label, bool isSelected, SelectableFlags flags) diff --git a/src/ImGui.NET/ImGuiNative.cs b/src/ImGui.NET/ImGuiNative.cs index bd7fc53..e244543 100644 --- a/src/ImGui.NET/ImGuiNative.cs +++ b/src/ImGui.NET/ImGuiNative.cs @@ -584,20 +584,6 @@ namespace ImGuiNET [return: MarshalAs(UnmanagedType.I1)] 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)] [return: MarshalAs(UnmanagedType.I1)] public static extern bool igBeginPopupContextItem(string str_id, int mouse_button);