4

I don't know much about ImGui, and it's also poorly documented.
I'd like to know if there is a way to create an ImGui window, and then render to it anytime you want. I only know this way of creating a window:

ImGui::Begin("Window");
ImGui::Button("Button");
ImGui::End();
Uytab
  • 85
  • 1
  • 7
  • 1
    just to touch on: `it's poorly documented`... see: https://imgui-test.readthedocs.io/en/latest/ and more importantly check out the examples: https://github.com/ocornut/imgui/tree/master/examples You'll find everything you need there. – FuzzyBall May 27 '22 at 08:30

1 Answers1

11

You can simply use ImGui::Begin and ImGui::End with the appropriate window title again if you want to append to a window.

The following works:

ImGui::Begin("Window A");
ImGui::Text("This is window A");
ImGui::End();

ImGui::Begin("Window B");
ImGui::Text("This is window B");
ImGui::End();

ImGui::Begin("Window A");
ImGui::Button("Button on window A");
ImGui::End();

ImGui::Begin("Window B");
ImGui::Button("Button on window B");
ImGui::End();

It produces two windows that like this:

windows

Regarding poor documentation, you are right. The library authors provide a list of resources that can serve as documentation material.

janekb04
  • 4,304
  • 2
  • 20
  • 51