1
0
mirror of https://github.com/Mauler125/r5sdk.git synced 2025-02-09 19:15:03 +01:00

Cleanup ImGui shutdown

Move to separate function.
This commit is contained in:
Kawe Mazidjatari 2023-06-18 17:50:11 +02:00
parent b8304e116c
commit b7cf2c6f64

@ -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;
}
}