Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c++

imgui

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();
like image 511
Uytab Avatar asked Oct 27 '25 07:10

Uytab


1 Answers

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.

like image 184
janekb04 Avatar answered Oct 29 '25 07:10

janekb04



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!