Uytab
Uytab

Reputation: 93

How to create ImGui window and render to it at any time you want?

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();

Upvotes: 4

Views: 17288

Answers (1)

janekb04
janekb04

Reputation: 4955

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.

Upvotes: 12

Related Questions