From b7cf2c6f643be3c1ac1e08db30bd11c64878e31a Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sun, 18 Jun 2023 17:50:11 +0200 Subject: [PATCH] Cleanup ImGui shutdown Move to separate function. --- r5dev/windows/id3dx.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/r5dev/windows/id3dx.cpp b/r5dev/windows/id3dx.cpp index 0e5815df..2a9dd43c 100644 --- a/r5dev/windows/id3dx.cpp +++ b/r5dev/windows/id3dx.cpp @@ -78,7 +78,7 @@ BOOL WINAPI HPostMessageW(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) // IMGUI //################################################################################# -void SetupImGui() +void ImGui_Init() { /////////////////////////////////////////////////////////////////////////////// IMGUI_CHECKVERSION(); @@ -92,6 +92,13 @@ void SetupImGui() io.ConfigFlags |= ImGuiConfigFlags_IsSRGB; } +void ImGui_Shutdown() +{ + ImGui_ImplDX11_Shutdown(); + ImGui_ImplWin32_Shutdown(); + ImGui::DestroyContext(); +} + void DrawImGui() { ImGui_ImplDX11_NewFrame(); @@ -126,7 +133,7 @@ HRESULT __stdcall Present(IDXGISwapChain* pSwapChain, UINT nSyncInterval, UINT n { if (!s_bInitialized) { - SetupImGui(); + ImGui_Init(); g_ThreadRenderThreadID = GetCurrentThreadId(); s_bInitialized = true; } @@ -380,9 +387,7 @@ void DirectX_Shutdown() // Shutdown ImGui if (s_bInitialized) { - ImGui_ImplDX11_Shutdown(); - ImGui_ImplWin32_Shutdown(); - ImGui::DestroyContext(); + ImGui_Shutdown(); s_bInitialized = false; } }