Dear ImGui — Bloat-Free Immediate Mode GUI for C++ That Powers Every Game Tool
Dear ImGui is the immediate-mode GUI library used by virtually every game engine for in-game editors, debug overlays, and tooling. Minimal dependencies, minimal state, maximum productivity.
What it is
Dear ImGui is an immediate-mode GUI library for C++ used by virtually every game engine for in-game editors, debug overlays, profiling tools, and level editors. Unlike retained-mode GUI frameworks, ImGui redraws the entire interface each frame with minimal state management. This makes it trivial to add debug UI to any application with a render loop.
This tool is for game developers, engine programmers, and anyone building C++ applications with real-time rendering who needs quick, functional UI without the weight of full GUI frameworks.
How it saves time or tokens
Dear ImGui requires almost no setup. Include the headers, call a few functions in your render loop, and you have windows, sliders, buttons, color pickers, and plots. There is no layout engine to learn, no style system to configure, and no event loop to manage. The immediate-mode paradigm means UI code reads linearly: if a button is clicked, the code right after the button call handles it.
How to use
- Add ImGui source files to your project (no build system required).
- Initialize with your rendering backend.
- Call ImGui functions in your render loop.
- The UI appears immediately.
// Minimal setup in your render loop
#include "imgui.h"
void renderFrame() {
ImGui::NewFrame();
// Create a window with controls
ImGui::Begin("Debug Panel");
ImGui::Text("FPS: %.1f", ImGui::GetIO().Framerate);
static float speed = 1.0f;
ImGui::SliderFloat("Speed", &speed, 0.0f, 10.0f);
static bool wireframe = false;
ImGui::Checkbox("Wireframe", &wireframe);
if (ImGui::Button("Reset")) {
speed = 1.0f;
wireframe = false;
}
ImGui::End();
ImGui::Render();
}
Example
A property editor for a game object:
void drawObjectInspector(GameObject& obj) {
ImGui::Begin("Inspector");
ImGui::InputText("Name", obj.name, sizeof(obj.name));
ImGui::DragFloat3("Position", &obj.position.x, 0.1f);
ImGui::DragFloat3("Rotation", &obj.rotation.x, 1.0f);
ImGui::DragFloat3("Scale", &obj.scale.x, 0.01f);
ImGui::ColorEdit4("Color", &obj.color.r);
if (ImGui::CollapsingHeader("Physics")) {
ImGui::DragFloat("Mass", &obj.mass, 0.1f);
ImGui::Checkbox("Is Static", &obj.isStatic);
}
ImGui::End();
}
Related on TokRepo
- AI coding tools — Development tools
- Design tools — UI and interface design
Common pitfalls
- ImGui is designed for debug and tool UI, not end-user-facing applications. It looks functional rather than polished.
- Each frame redraws the entire UI. For complex UIs with thousands of elements, this can impact frame budgets.
- ImGui requires a rendering backend (OpenGL, DirectX, Vulkan, Metal). Integration complexity varies by backend.
- Text rendering uses a built-in bitmap font. Custom fonts require loading TTF files with ImGui's font atlas.
- The library is single-threaded by design. Multi-threaded rendering requires careful synchronization.
- Review the official documentation before deploying to production to ensure compatibility with your specific environment and requirements.
Frequently Asked Questions
In immediate mode, you call UI functions each frame and the library draws them immediately. There is no persistent widget tree or state management. This is simpler to code but redraws everything each frame, unlike retained-mode frameworks that update only changed elements.
Dear ImGui is used in Unreal Engine, Unity (via plugins), Godot (via addons), custom engines at major studios, and thousands of indie games. It is the de facto standard for game engine tooling.
Yes. ImGui supports multiple windows, docking (merging windows into tab groups), and viewports (rendering ImGui windows outside the main application window).
Yes. ImGui supports theming through its style system. You can customize colors, sizes, rounding, and spacing for all widget types. Community themes provide polished looks.
Yes. ImGui is used in audio editors, CAD tools, scientific visualization, and any C++ application that benefits from quick, functional UI. The key requirement is a render loop.
Citations (3)
- Dear ImGui GitHub— Dear ImGui is the immediate-mode GUI library for C++
- Dear ImGui Wiki— Dear ImGui documentation and examples
- Dear ImGui FAQ— Immediate mode GUI design pattern
Related on TokRepo
Discussion
Related Assets
NAPI-RS — Build Node.js Native Addons in Rust
Write high-performance Node.js native modules in Rust with automatic TypeScript type generation and cross-platform prebuilt binaries.
Mamba — Fast Cross-Platform Package Manager
A drop-in conda replacement written in C++ that resolves environments in seconds instead of minutes.
Plasmo — The Browser Extension Framework
Build, test, and publish browser extensions for Chrome, Firefox, and Edge using React or Vue with hot-reload and automatic manifest generation.