Hiding close button on windows
See original GitHub issueImGui supports hiding the close button on BeginWindow by passing in a null pointer to the p_opened
value. I made the following change to support this in the .NET bindings but it would break the existing API if anyone is using it and not sure if thats something you would want a PR on.
It looks like some of the native structs don’t have real wrappings to them (especially the window struct). There is some functionality I need and was thinking about implementing them.
Also some of the lower level imgui functions are missing from the cimgui library like the XYZBehavior
methods creating a lot of hacks to get around this with setting positions and using invisible buttons.
ImGui.cs
public unsafe static bool BeginWindow(string windowTitle, ref bool? opened, WindowFlags flags)
{
byte value = (opened.HasValue && opened.Value) ? (byte)1 : (byte)0;
byte* p_opened = opened.HasValue ? &value : null;
var result = ImGuiNative.igBegin(windowTitle, p_opened, flags);
if (opened.HasValue)
opened = value == 1;
return result;
}
ImGuiNative.cs
public static extern bool igBegin(string name, byte* p_opened, WindowFlags flags);
Edit: Corrected the code to use p_opened
instead of the result of the call.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7
@mellinoe You are a legend my friend.
Works great. Thank you so much 😃
This should be fixed with https://github.com/mellinoe/ImGui.NET/commit/1f35b5ae9b36ddc33a93ff2197b9fd7fe6095ffd, and I’ve also put up a new version on nuget.org:
https://www.nuget.org/packages/ImGui.NET/0.4.4