You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello! I'm developing my custom menu bar. It should look like a rectangle at top of the window, without paddings at the top, left, and right sides. My style has window padding for child windows, but ImGui uses this option for the simple windows too. So, my menu bar draws indented My application architecture draws UI element by element, after Begin call, so I can't give access to an element to call PushStyleVar(ImGuiStyleVar_WindowPadding) before Begin(). Also, the menu bar may be dynamically removed and added back, so, I can't just statically push the window padding variable before Begin() call. Also, change the style.WindowPadding I can't too because I need padding for child windows, and maybe in the future, I will need window padding for simple windows without a custom menu bar.
So, Is it possible to remove the current window padding after Begin() (or maybe just draw one frame bypassing padding)?
What I have tried already:
Set DC.CursorPos to window->Pos
Set DC.CursorStartPos to window->Pos
Set DC.CursorPosPrevLine to window->Pos
Set DC.Indent to 0
Set window->ContentRegionRect to (0, 0)
Set window->InnerRect to (0, 0)
Set window->ClipRect to (0, 0)
Set window->InnerClipRect to (0, 0)
Set window->WorkRect to (0, 0)
Set window->WindowPadding to (0, 0)
Nothing worked. If it's not possible, I'll find a way to call PushStyleVar before Begin(), but it'll hurt the architecture.
I hope for your help! Thanks in advance!
Why even drawing through ImDrawList depends on padding? How to bypass it?
You can't change the WindowPadding of a window after Begin(), otherwise it seems what's blocking you is the active clipping rectangle. Try using ImGui::PushClipRect(). You shouldn't write to random fields in the window-> structure.
That single line is due to WindowBorderSize=1. If you push both WindowPadding to 0,0 and WindowBorderSize to 0 before Begin(), there will be zero-padding and the clipping rectangle will be equal to windows boundaries. But you can manipulate the clipping rectangle with PushClipRect/PopClipRect anytime, regardless of WindowPadding value.
Use Demo>Tools>Metrics/Debugger to visualize the clipping rectangle of each ImDrawCmd.
Hello! I'm developing my custom menu bar. It should look like a rectangle at top of the window, without paddings at the top, left, and right sides. My style has window padding for child windows, but ImGui uses this option for the simple windows too. So, my menu bar draws indented My application architecture draws UI element by element, after Begin call, so I can't give access to an element to call PushStyleVar(ImGuiStyleVar_WindowPadding) before Begin(). Also, the menu bar may be dynamically removed and added back, so, I can't just statically push the window padding variable before Begin() call. Also, change the style.WindowPadding I can't too because I need padding for child windows, and maybe in the future, I will need window padding for simple windows without a custom menu bar.
So, Is it possible to remove the current window padding after Begin() (or maybe just draw one frame bypassing padding)?
What I have tried already:
Nothing worked. If it's not possible, I'll find a way to call PushStyleVar before Begin(), but it'll hurt the architecture.
I hope for your help! Thanks in advance!
EDIT:
Example:
Screenshot with padding 20:
And with padding 0:
Why even drawing through ImDrawList depends on padding? How to bypass it?
The text was updated successfully, but these errors were encountered: