Dear ImGui Examples

Aalekh NigamAalekh Nigam
1 min read

Below mentioned are Dear ImGui Examples along with screenshots of implementations, this will be an ongoing documentation so as I use/test a function I will just post it here.

Change Window color:

Use ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(255, 255, 255, 255));, here the color code used made my window white.


constexpr static auto window_size = ImVec2(1280.0F, 720.0F);
constexpr static auto window_pos = ImVec2(0.0F, 0.0F);

ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(255, 255, 255, 255));
ImGui::SetNextWindowSize(window_size);
ImGui::SetNextWindowPos(window_pos);

ImGui::Begin(label.data(), nullptr, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove |
        ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoScrollbar);

ImGui::PopStyleColor();
ImGui::End();

Result:

Additional Comments: Since, Dear ImGui works like a stack, always remember to pop the “pushed style color“ using ImGui::PopStyleColor() for that given ImGui::PushStyleColor. At the end of the program/function Frequency(PushStyleColor) == Frequency(PopStyleColor)

0
Subscribe to my newsletter

Read articles from Aalekh Nigam directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Aalekh Nigam
Aalekh Nigam

Twitter: https://twitter.com/aalekhnigam LinkedIn: https://www.linkedin.com/in/aalekh-nigam-a7962064/