IMDUI is an immediate-mode C++ UI library for Windows desktop applications, rendered with Direct3D 11. It includes a layout engine, animated controls, editable text, SVG images, and a configurable settings menu.
It is a collaboration between myself & Xenial to create an immediate mode UI framework specifically optimized for Windows. We accept contributions via PR.
IMDUI is not a general-purpose replacement for Dear ImGui. It is intentionally narrower: Windows only, Direct3D 11 only, one window per context, no backend abstraction. It exists because ImGui cannot fill one specific gap: keeping the process's Win32 call surface as small as possible.
Dear ImGui's Win32 backend supports every kind of desktop application, so ImGui_ImplWin32_NewFrame reads the client rectangle, the performance counter, the foreground window, and the cursor position every frame. Across the backend it calls around 36 distinct Win32 functions, including DPI queries, DWM, GDI, clipboard, IME, and cursor capture and management. In an ordinary desktop application that is invisible. In an injected overlay, or any process where external tooling inspects API usage, it is a large and recognizable pattern.
IMDUI uses a smaller contract instead. The host already owns the window procedure, so it forwards messages to processWindowMessage and the library keeps input state as they arrive; it does not poll the OS on a schedule. Its Win32 surface is about a dozen functions: GetClientRect once at startup, GetModuleFileNameA and MultiByteToWideChar for paths, MapVirtualKeyW and GetKeyNameTextW for key names, capture and focus calls for drags, GetKeyState only when the application asks, ScreenToClient, and TrackMouseEvent. There is no clipboard, IME, DWM, GDI, cursor management, or DPI code, and rendering is Direct3D 11 only.
Use IMDUI when:
- you are on Windows and already own (or can create) a D3D11 device for your window;
- you want the smallest OS-visible call surface, or a message-driven input model that plugs into an existing
WndProc; - you prefer RAII guards and fluent node properties over begin/end pairs;
- you want a layout engine, animated widgets, editable text, SVG images, and a settings menu included with nothing to configure.
Use Dear ImGui when:
- you need cross-platform support, multiple renderer or platform backends, docking, or multi-viewport;
- you want its broader widget ecosystem and community;
- per-frame Win32 polling is not a concern, which is true for most desktop applications.
The full reasoning is in "IMDUI: an immediate-mode C++ UI framework for Windows".
Requires Windows 10 or newer, CMake 3.25 or newer, and a C++23-capable Visual Studio C++ toolchain with the Windows SDK. The x64 build is tested.
cmake -S . -B build -A x64
cmake --build build --config Release --parallel
ctest --test-dir build -C Release --output-on-failure
.\build\Release\imdui_demo.exeThe build produces imdui.lib, a desktop example, and integration tests. Tests use a hidden Win32 window and a real D3D11 device, with WARP available as a fallback.
CMake options:
IMDUI_BUILD_EXAMPLES: build the desktop example. Defaults to on for a standalone build.IMDUI_BUILD_TESTS: build core and integration tests. Defaults to on for a standalone build.IMDUI_ENABLE_DEBUG_LOG: send diagnostics toOutputDebugStringA. Defaults to on.
The Inter font atlas is embedded in the library. CMake regenerates it when the source assets change. The default font needs no external asset files. Applications still need the C++ runtime required by their toolchain.
Add the source tree to an application:
add_subdirectory(path/to/IMDUI imdui-build)
target_link_libraries(your_app PRIVATE IMDUI::imdui)Or install and consume a package:
cmake --install build --config Release --prefix C:/Libraries/IMDUIfind_package(IMDUI CONFIG REQUIRED)
target_link_libraries(your_app PRIVATE IMDUI::imdui)Pass -DCMAKE_PREFIX_PATH=C:/Libraries/IMDUI when configuring the consuming project. The target supplies the public include directory, C++23 requirement, and Windows/Direct3D link dependencies.
Create a Unicode Win32 window and call imdui::init(hwnd). Initialization creates the D3D11 device, swap chain, and default font. Forward window messages through imdui::processWindowMessage and call TranslateMessage in your message loop. The adapter handles mouse, wheel, keyboard, and character input.
#include <IMDUI/IMDUI.h>
#include <IMDUI/Text.h>
// After pumping window messages and checking HRESULTs:
if (SUCCEEDED(imdui::newFrame()))
{
imdui::clearViewport({0.03F, 0.04F, 0.06F, 1.0F});
imdui::drawText(L"Hello, desktop").x(24).y(24).fontSize(20);
imdui::endFrame();
imdui::renderFrame();
const HRESULT result = imdui::present();
// Handle failures or DXGI_STATUS_OCCLUDED in your application loop.
}The host handles WM_SIZE, passes nonzero client dimensions to resizeViewport, and skips rendering while minimized. Call destroyContext before destroying the window. See the complete example for message forwarding, DPI changes, resizing, input, controls, and cleanup.
For a settings menu, call Menu::setHeaderText(title, subtitle), assign sections or tabs, then call update and render within each frame.
The current implementation owns one HWND, D3D11 device, and swap chain. Use the UI on the window's thread. Multiple contexts, other operating systems, external-device initialization, and native accessibility integration are not implemented. The bundled font covers printable ASCII; load a larger atlas for additional glyphs. Text input accepts UTF-16.
To create a source ZIP containing the library, example, tests, documentation, and licenses:
cmake --build build --target imdui_source_package --config ReleaseThe archive is written to build/IMDUI-0.1.0-source.zip. Local build directories and editor settings are excluded.
IMDUI uses the MIT license. Bundled libraries and font assets retain the licenses listed in third-party notices.