dear imgui
Dear Imgui is an immediate mode gui framework written in c++. This is a cheasheet like blog post containing commonly used components.
Creating a imgui window.
imgui renders top - bottom, left - right by default
Making the Window Static
constexpr static auto window_flags = ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse;
const char *label = "App";
ImGui::Begin(label, nullptr, window_flags);
ImGui::End();
To Display Text
Rendering Content in the Same Line can be done by calling the ImGui::SameLine().
Drawing a Line Separator
Button Click
Creating a Popup
To make a label hidden use ### before the label
To set a window position
To set a window size
To have a text input with multiple lines, we'll use TextInputMultiline
To Create a Child window inside a Imgui Window
Creating an imgui window
Taking Single Line UserInput
Creating a PopUp
Setting the cursor ( Implies where we want to start drawing )
Adding a style component to an element
Plotting a graph with ImPlot
ImPlot::BeginPlot("###label", ImVec2(-1.0F, -1.0F));
ImPlot::PlotLine("label", x_axis_data, y_axis_data);
ImPlot::EndPlot();
Placing a Modal in the Center of the main Window.