From e9fda936322bb5c5a8d874551900a832673a1f38 Mon Sep 17 00:00:00 2001 From: StratiX0 Date: Thu, 21 Mar 2024 20:25:52 +0100 Subject: [PATCH] ca marcheeeeeeee --- enginecustom/Systemclass.cpp | 23 +++++++--- enginecustom/applicationclass.h | 1 + enginecustom/d3dclass.h | 2 +- enginecustom/enginecustom.vcxproj | 9 ++++ enginecustom/enginecustom.vcxproj.filters | 51 +++++++++++++++++++++++ enginecustom/imgui.ini | 4 +- 6 files changed, 81 insertions(+), 9 deletions(-) diff --git a/enginecustom/Systemclass.cpp b/enginecustom/Systemclass.cpp index 5d65897..991419d 100644 --- a/enginecustom/Systemclass.cpp +++ b/enginecustom/Systemclass.cpp @@ -53,6 +53,7 @@ bool SystemClass::Initialize() ImGui_ImplWin32_Init(m_hwnd); ImGui_ImplDX11_Init(m_Application->GetDirect3D()->GetDevice(), m_Application->GetDirect3D()->GetDeviceContext()); + ImGui::StyleColorsDark(); return true; } @@ -137,6 +138,14 @@ bool SystemClass::Frame() return false; } + // Do the frame processing for the application class object. + result = m_Application->Frame(); + if (!result) + { + return false; + } + + // Start the Dear ImGui frame ImGui_ImplDX11_NewFrame(); ImGui_ImplWin32_NewFrame(); ImGui::NewFrame(); @@ -147,15 +156,12 @@ bool SystemClass::Frame() ImGui::SliderFloat("Slider", &value, 0.0f, 1.0f); ImGui::End(); + // Assemble Together Draw Data ImGui::Render(); + // Render Draw Data ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData()); - // Do the frame processing for the application class object. - result = m_Application->Frame(); - if (!result) - { - return false; - } + this->m_Application->GetDirect3D()->m_swapChain->Present(0, NULL); return true; } @@ -297,6 +303,11 @@ void SystemClass::ShutdownWindows() // Release the pointer to this class. ApplicationHandle = NULL; + //Releases COM references that ImGui was given on setup + ImGui_ImplDX11_Shutdown(); + ImGui_ImplWin32_Shutdown(); + ImGui::DestroyContext(); + return; } diff --git a/enginecustom/applicationclass.h b/enginecustom/applicationclass.h index 3620a8a..5e37594 100644 --- a/enginecustom/applicationclass.h +++ b/enginecustom/applicationclass.h @@ -39,6 +39,7 @@ private: CameraClass* m_Camera; ModelClass* m_Model; ColorShaderClass* m_ColorShader; + IDXGISwapChain* m_swapChain; }; #endif \ No newline at end of file diff --git a/enginecustom/d3dclass.h b/enginecustom/d3dclass.h index df75750..a2f4e31 100644 --- a/enginecustom/d3dclass.h +++ b/enginecustom/d3dclass.h @@ -39,6 +39,7 @@ public: ID3D11Device* GetDevice(); ID3D11DeviceContext* GetDeviceContext(); + IDXGISwapChain* m_swapChain; void GetProjectionMatrix(XMMATRIX&); void GetWorldMatrix(XMMATRIX&); @@ -53,7 +54,6 @@ private: bool m_vsync_enabled; int m_videoCardMemory; char m_videoCardDescription[128]; - IDXGISwapChain* m_swapChain; ID3D11Device* m_device; ID3D11DeviceContext* m_deviceContext; ID3D11RenderTargetView* m_renderTargetView; diff --git a/enginecustom/enginecustom.vcxproj b/enginecustom/enginecustom.vcxproj index b72f17c..40f5725 100644 --- a/enginecustom/enginecustom.vcxproj +++ b/enginecustom/enginecustom.vcxproj @@ -27,6 +27,7 @@ + @@ -40,6 +41,14 @@ + + + + + + + + diff --git a/enginecustom/enginecustom.vcxproj.filters b/enginecustom/enginecustom.vcxproj.filters index c3fe977..40d0fb8 100644 --- a/enginecustom/enginecustom.vcxproj.filters +++ b/enginecustom/enginecustom.vcxproj.filters @@ -16,6 +16,12 @@ {b016e481-576e-4d99-bdde-34cc10c55b1d} + + {dcad57f9-720f-4170-b850-be65a68a8e67} + + + {2f09e599-272c-4cd3-b095-62c0b10b439b} + @@ -42,6 +48,27 @@ Fichiers sources + + Fichiers sources\ImGui + + + Fichiers sources\ImGui + + + Fichiers sources\ImGui + + + Fichiers sources\ImGui + + + Fichiers sources\ImGui + + + Fichiers sources\ImGui + + + Fichiers sources\ImGui + @@ -65,6 +92,30 @@ Fichiers d%27en-tête + + Fichiers d%27en-tête\ImGui + + + Fichiers d%27en-tête\ImGui + + + Fichiers d%27en-tête\ImGui + + + Fichiers d%27en-tête\ImGui + + + Fichiers d%27en-tête\ImGui + + + Fichiers d%27en-tête\ImGui + + + Fichiers d%27en-tête\ImGui + + + Fichiers d%27en-tête\ImGui + diff --git a/enginecustom/imgui.ini b/enginecustom/imgui.ini index 1bea7cb..49ade17 100644 --- a/enginecustom/imgui.ini +++ b/enginecustom/imgui.ini @@ -3,6 +3,6 @@ Pos=60,60 Size=400,400 [Window][Khaotic Engine] -Pos=60,60 -Size=51,48 +Pos=137,66 +Size=144,109