imgui-mirror/backends/imgui_impl_dx11.cppm
Sharadh Rajaraman eaed70b584 backends: add C++20 named modules 'imgui.impl.*'
Each imgui_impl_X.cppm builds one backend as module imgui.impl.X,
following the same layout as imgui.cppm. The global module fragment
holds the platform and graphics API headers, using the same conditions
as the backend's .cpp. The purview imports std.compat and imgui and
includes the backend header. The .cpp goes in 'module :private;'.

The backend header includes imgui.h, but its declarations already come
from 'import imgui;' and must not be redeclared in this module. Module
units therefore define IMGUI_CXX_MODULE_IMPORTED, which makes imgui.h
contribute only its macros.

Usage: 'import imgui; import imgui.impl.glfw;'. Link the module
library in place of the backend .cpp.
2026-09-28 16:11:53 +00:00

25 lines
532 B
C++

// dear imgui: Renderer Backend for DirectX11, as a C++20 named module.
// See imgui.cppm for usage and design. Import with: 'import imgui; import imgui.impl.dx11;'
module;
#define IMGUI_CXX_MODULE 1
#define IMGUI_CXX_MODULE_IMPORTED 1
#include "imgui_macros.h"
#include <stddef.h> // offsetof
// DirectX (same as imgui_impl_dx11.cpp)
#include <d3d11.h>
#include <d3dcompiler.h>
export module imgui.impl.dx11;
import std.compat;
import imgui;
#include "imgui_impl_dx11.h"
module :private;
#include "imgui_impl_dx11.cpp"