Addendum to #2635. Add support for multi-viewports in SDL+DX!! example. making all Win32-centric back-ends handle PlatformHandleRaw. Using the field to use/store the HWND for internal purpose in SDL/GLFW back-ends. (#1542)

This commit is contained in:
omar
2019-06-18 23:35:48 +02:00
parent 3e8eebfbec
commit adbbd17cb6
11 changed files with 79 additions and 53 deletions

View File

@@ -564,13 +564,9 @@ static void ImGui_ImplDX11_CreateWindow(ImGuiViewport* viewport)
ImGuiViewportDataDx11* data = IM_NEW(ImGuiViewportDataDx11)();
viewport->RendererUserData = data;
// When using SDL, PlatformHandleRaw will be the HWND (because PlatformHandle would be the SDL_Window)
// If not using SDL, PlatformHandleRaw will be null and PlatformHandle will contain the HWND
HWND hwnd = (HWND)viewport->PlatformHandleRaw;
if (hwnd == 0)
{
hwnd = (HWND)viewport->PlatformHandle;
}
// PlatformHandleRaw should always be a HWND, whereas PlatformHandle might be a higher-level handle (e.g. GLFWWindow*, SDL_Window*).
// Some back-end will leave PlatformHandleRaw NULL, in which case we assume PlatformHandle will contain the HWND.
HWND hwnd = viewport->PlatformHandleRaw ? (HWND)viewport->PlatformHandleRaw : (HWND)viewport->PlatformHandle;
IM_ASSERT(hwnd != 0);
// Create swap chain