An optional library to simplify integrating ImGui with a renderer that uses CrossWindow by providing a forked ImGui backend with simplified defaults and bindings for CrossWindow events.
Note - Don't install ImGui if you're using this library,
CrossWindow-Imgui
wraps ImGui and includes a copy.
- โ DirectX 12.x
- โช OpenGL
With more graphics APIs supported in future updates.
First add the repo as a submodule in your dependencies folder such as external/
:
cd external
git submodule add https://github.com/alaingalvan/crosswindow-imgui.git
Then in your CMakeLists.txt
file, include the following:
add_subdirectory(external/crosswindow-imgui)
target_link_libraries(
CrossWindowImGui
CrossWindowGraphics
CrossWindow
)
add_dependencies(
CrossWindowImGui
CrossWindowGraphics
CrossWindow
)
target_link_libraries(
${PROJECT_NAME}
CrossWindowImGui
)
#include "CrossWindow/CrossWindow.h"
#include "CrossWindow/ImGui.h"
#include "CrossWindow/Graphics.h"
void xmain(int argc, char** argv)
{
// ๐ผ๏ธ Create your xwin::Window...
xwin::Window window;
// ๐๏ธ Create your renderer...
#if defined(XGFX_DIRECTX12)
// โ DirectX 12.x
xgfx::D3D12ImGuiManager manager;
manager.init(device, numFramesInFlight, rtvFormat, cbvSrvHeap, fontCpuDescHandle, fontGpuDeschandle);
#elif defined(XGFX_OPENGL)
// โช OpenGL
xgfx::OpenGLImGuiManager manager;
manager.init();
#endif
}
CMake Options | Description |
---|---|
XGFX_API |
The graphics API you're targeting, defaults to VULKAN , can be can be VULKAN , OPENGL , DIRECTX12 , METAL , or NONE . |
Alternatively you can set the following preprocessor definitions manually:
Definition | Description |
---|---|
XGFX_VULKAN |
Vulkan |
XGFX_OPENGL |
OpenGL / OpenGL ES / WebGL |
XGFX_DIRECTX12 |
DirectX 12.x |
XGFX_DIRECTX11 |
DirectX 11.x |
XGFX_METAL |
Metal |
CrossWindow-ImGui is licensed as either MIT or Apache-2.0, whichever you would prefer.