We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In ImGui, you can pass a null pointer to p_open so that the tab item is always shown and the selection is managed by imgui itself. However, here
if (ImGui.BeginTabItem("a", ref Unsafe.NullRef<bool>(), ImGuiTabItemFlags.None)) ImGui.Text("Hi"); ImGui.EndTabItem(); }
Will simply make it not render, as opposed to passing a ref b where b is a boolean variable.
ref b
b
This comes down to the handling of the reference, since in the method it dereferences it no matter what. The following modified code worked for me:
public static unsafe bool BeginTabItem(string label, ref bool p_open, ImGuiTabItemFlags flags) { byte* native_label; int label_byteCount = 0; if (label != null) { label_byteCount = Encoding.UTF8.GetByteCount(label); if (label_byteCount > Util.StackAllocationSizeLimit) { native_label = Util.Allocate(label_byteCount + 1); } else { byte* native_label_stackBytes = stackalloc byte[label_byteCount + 1]; native_label = native_label_stackBytes; } int native_label_offset = Util.GetUtf8(label, native_label, label_byteCount); native_label[native_label_offset] = 0; } else { native_label = null; } byte ret; if (Unsafe.IsNullRef(ref p_open)) { ret = ImGuiNative.igBeginTabItem(native_label, (byte*)0, flags); } else { byte native_p_open_val = p_open ? (byte)1 : (byte)0; byte* native_p_open = &native_p_open_val; ret = ImGuiNative.igBeginTabItem(native_label, native_p_open, flags); p_open = native_p_open_val != 0; } if (label_byteCount > Util.StackAllocationSizeLimit) { Util.Free(native_label); } return ret != 0; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
In ImGui, you can pass a null pointer to p_open so that the tab item is always shown and the selection is managed by imgui itself. However, here
Will simply make it not render, as opposed to passing a
ref b
whereb
is a boolean variable.This comes down to the handling of the reference, since in the method it dereferences it no matter what. The following modified code worked for me:
The text was updated successfully, but these errors were encountered: