Skip to content

Add Direct2d Backend for Windows#7

Merged
mfisher31 merged 15 commits intomainfrom
direct2d
Jan 14, 2026
Merged

Add Direct2d Backend for Windows#7
mfisher31 merged 15 commits intomainfrom
direct2d

Conversation

@mfisher31
Copy link
Copy Markdown
Member

Fixes #3

demo: enable Direct2D demo support and define LUI_STATIC for Windows
src: link against additional Direct2D libraries and define necessary GUIDs
- Created Direct2D backend implementation (win_direct2d.c, direct2d.cpp, direct2d.hpp)
- Integrated Direct2D into Windows build system
- Added MinGW cross-compilation toolchain (cmake/mingw32.cmake)
- Updated all copyright notices from Michael Fisher to Kushview, LLC
- Added Windows MSVC build job to CI alongside existing MinGW job
- Unified build and test steps in CI to work across all platforms
Wrapped std::min and std::max in parentheses in public headers (color.hpp,
rectangle.hpp, path.hpp) to prevent Windows min/max macro expansion without
requiring users to define NOMINMAX.
- Renamed win_direct2d.c to win_direct2d.cpp
- Converted C API calls to C++ method syntax (CreateHwndRenderTarget, Release, etc.)
- Added proper extern C linkage for puglDirect2DBackend function
- Wrapped win.h include in extern C block for correct linkage
- Removed COBJMACROS and manual GUID definitions (not needed in C++)
- Updated CMakeLists.txt to reference .cpp file
- Renamed win_direct2d.c to win_direct2d.cpp
- Converted C API calls to C++ Direct2D/DirectWrite methods
- Wrapped pugl win.h include in extern C block for proper linkage
- Added WIN32 flag to demo executables for WinMain entry point
- Updated CMakeLists.txt to reference .cpp file

MSVC requires C++ for Direct2D headers which contain C++-specific syntax
like static_cast and enum bitfields. MinGW can compile these headers in
either C or C++ mode, but MSVC only supports C++.
@mfisher31 mfisher31 merged commit 42a5365 into main Jan 14, 2026
5 checks passed
@mfisher31 mfisher31 deleted the direct2d branch January 14, 2026 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Direct2D Backend for Windows

1 participant