imgui-mirror/backends/imgui_impl_win32.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

33 lines
763 B
C++

// dear imgui: Platform Backend for Windows (standard windows API for 32-bits AND 64-bits applications), as a C++20 named module.
// See imgui.cppm for usage and design. Import with: 'import imgui; import imgui.impl.win32;'
module;
#define IMGUI_CXX_MODULE 1
#define IMGUI_CXX_MODULE_IMPORTED 1
#include "imgui_macros.h"
#include <float.h> // FLT_MAX
// Windows (same as imgui_impl_win32.cpp)
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include <windowsx.h>
#include <tchar.h>
#include <dwmapi.h>
#ifndef IMGUI_IMPL_WIN32_DISABLE_GAMEPAD
#include <xinput.h>
#endif
export module imgui.impl.win32;
import std.compat;
import imgui;
#include "imgui_impl_win32.h"
module :private;
#include "imgui_impl_win32.cpp"