Begin
Starts a new window and pushes it onto the window stack.Parameters
const char*
required
Window title and unique identifier. Use ”###” to separate display name from ID (e.g., “MyWindow###UniqueID”).
bool*
default:"NULL"
Pointer to a boolean controlling window visibility. When not NULL, displays a close button that sets this to false when clicked.
ImGuiWindowFlags
default:"0"
Window behavior flags. See
ImGuiWindowFlags_ enum for available options.Returns
bool
Returns false if the window is collapsed or fully clipped. You can use this to skip rendering content, but you must still call
End().Description
Begin() pushes a window onto the stack and begins appending to it. Key points:
- Always call
End()for eachBegin(), regardless of return value - Return value indicates visibility, not whether you should call
End() - Multiple
Begin()/End()pairs with the same name append to the same window - First call in a frame determines window flags and
p_openbehavior
Example
Common Flags
End
Pops the current window from the stack.Description
Ends the current window context. Must be called for everyBegin() call, regardless of its return value.
Example
The bottom of the window stack always contains a window called “Debug”. You cannot pop this window.
Window Positioning and Sizing
SetNextWindowPos
Sets the position of the next window beforeBegin().
Parameters
const ImVec2&
required
Window position in screen coordinates.
ImGuiCond
default:"0"
Condition for setting position. Use
ImGuiCond_FirstUseEver to allow user to move window.const ImVec2&
default:"ImVec2(0, 0)"
Pivot point for positioning. (0,0) = top-left, (0.5,0.5) = center, (1,1) = bottom-right.
Example
SetNextWindowSize
Sets the size of the next window beforeBegin().
Parameters
const ImVec2&
required
Window size. Set axis to 0.0f to force auto-fit on that axis.
ImGuiCond
default:"0"
Condition for setting size.