MCPcopy Create free account
hub / github.com/Aegel5/SimpleSwitcher / ShowExampleAppAutoResize

Function ShowExampleAppAutoResize

imgui_tiny_app/imgui/imgui_demo.cpp:9901–9919  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

9899
9900// Demonstrate creating a window which gets auto-resized according to its content.
9901static void ShowExampleAppAutoResize(bool* p_open)
9902{
9903 if (!ImGui::Begin("Example: Auto-resizing window", p_open, ImGuiWindowFlags_AlwaysAutoResize))
9904 {
9905 ImGui::End();
9906 return;
9907 }
9908 IMGUI_DEMO_MARKER("Examples/Auto-resizing window");
9909
9910 static int lines = 10;
9911 ImGui::TextUnformatted(
9912 "Window will resize every-frame to the size of its content.\n"
9913 "Note that you probably don't want to query the window size to\n"
9914 "output your content because that would create a feedback loop.");
9915 ImGui::SliderInt("Number of lines", &lines, 1, 20);
9916 for (int i = 0; i < lines; i++)
9917 ImGui::Text("%*sThis is line %d", i * 4, "", i); // Pad with space to extend size horizontally
9918 ImGui::End();
9919}
9920
9921//-----------------------------------------------------------------------------
9922// [SECTION] Example App: Constrained Resize / ShowExampleAppConstrainedResize()

Callers 1

ShowDemoWindowMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected