mirror of
https://github.com/ocornut/imgui.git
synced 2025-09-12 22:38:23 +00:00
Examples: DirectX12: Merged to new example format, imgui_impl_dx12.cpp contains the DX12 stuff, couple with imgui_impl_win32.cpp
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
// FIXME: 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*))
|
||||
|
||||
#include "imgui.h"
|
||||
#include "imgui_impl_dx12.h"
|
||||
#include "../imgui_impl_win32.h"
|
||||
#include "../imgui_impl_dx12.h"
|
||||
#include <d3d12.h>
|
||||
#include <dxgi1_4.h>
|
||||
#include <tchar.h>
|
||||
@@ -289,10 +290,9 @@ int main(int, char**)
|
||||
ImGui::CreateContext();
|
||||
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||
//io.NavFlags |= ImGuiNavFlags_EnableKeyboard; // Enable Keyboard Controls
|
||||
ImGui_ImplDX12_Init(hwnd, NUM_FRAMES_IN_FLIGHT, g_pd3dDevice,
|
||||
DXGI_FORMAT_R8G8B8A8_UNORM,
|
||||
g_pd3dSrvDescHeap->GetCPUDescriptorHandleForHeapStart(),
|
||||
g_pd3dSrvDescHeap->GetGPUDescriptorHandleForHeapStart());
|
||||
ImGui_ImplWin32_Init(hwnd);
|
||||
ImGui_ImplDX12_Init(g_pd3dDevice, NUM_FRAMES_IN_FLIGHT, DXGI_FORMAT_R8G8B8A8_UNORM,
|
||||
g_pd3dSrvDescHeap->GetCPUDescriptorHandleForHeapStart(), g_pd3dSrvDescHeap->GetGPUDescriptorHandleForHeapStart());
|
||||
|
||||
// Setup style
|
||||
ImGui::StyleColorsDark();
|
||||
@@ -333,6 +333,7 @@ int main(int, char**)
|
||||
continue;
|
||||
}
|
||||
ImGui_ImplDX12_NewFrame(g_pd3dCommandList);
|
||||
ImGui_ImplWin32_NewFrame();
|
||||
|
||||
// 1. Show a simple window.
|
||||
// Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug".
|
||||
@@ -409,6 +410,7 @@ int main(int, char**)
|
||||
|
||||
WaitForLastSubmittedFrame();
|
||||
ImGui_ImplDX12_Shutdown();
|
||||
ImGui_ImplWin32_Shutdown();
|
||||
ImGui::DestroyContext();
|
||||
CleanupDeviceD3D();
|
||||
UnregisterClass(_T("ImGui Example"), wc.hInstance);
|
||||
|
Reference in New Issue
Block a user