MCPcopy Create free account
hub / github.com/Raais/ImStudio / ShowExampleAppAutoResize

Function ShowExampleAppAutoResize

src/third-party/imgui/imgui_demo.cpp:7189–7207  ·  view source on GitHub ↗

Demonstrate creating a window which gets auto-resized according to its content.

Source from the content-addressed store, hash-verified

7187
7188// Demonstrate creating a window which gets auto-resized according to its content.
7189static void ShowExampleAppAutoResize(bool* p_open)
7190{
7191 if (!ImGui::Begin("Example: Auto-resizing window", p_open, ImGuiWindowFlags_AlwaysAutoResize))
7192 {
7193 ImGui::End();
7194 return;
7195 }
7196 IMGUI_DEMO_MARKER("Examples/Auto-resizing window");
7197
7198 static int lines = 10;
7199 ImGui::TextUnformatted(
7200 "Window will resize every-frame to the size of its content.\n"
7201 "Note that you probably don't want to query the window size to\n"
7202 "output your content because that would create a feedback loop.");
7203 ImGui::SliderInt("Number of lines", &lines, 1, 20);
7204 for (int i = 0; i < lines; i++)
7205 ImGui::Text("%*sThis is line %d", i * 4, "", i); // Pad with space to extend size horizontally
7206 ImGui::End();
7207}
7208
7209//-----------------------------------------------------------------------------
7210// [SECTION] Example App: Constrained Resize / ShowExampleAppConstrainedResize()

Callers 1

ShowDemoWindowMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected