C'est init mais marche pas.... ALED
This commit is contained in:
parent
db2c357472
commit
b8724d7f28
@ -1,4 +1,6 @@
|
|||||||
#include "systemclass.h"
|
#include "systemclass.h"
|
||||||
|
#include <iostream>
|
||||||
|
extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
SystemClass::SystemClass()
|
SystemClass::SystemClass()
|
||||||
{
|
{
|
||||||
@ -36,12 +38,22 @@ bool SystemClass::Initialize()
|
|||||||
// Create and initialize the application class object. This object will handle rendering all the graphics for this application.
|
// Create and initialize the application class object. This object will handle rendering all the graphics for this application.
|
||||||
m_Application = new ApplicationClass;
|
m_Application = new ApplicationClass;
|
||||||
|
|
||||||
|
// Initialize the application object.
|
||||||
|
|
||||||
result = m_Application->Initialize(screenWidth, screenHeight, m_hwnd);
|
result = m_Application->Initialize(screenWidth, screenHeight, m_hwnd);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initialize imgui
|
||||||
|
IMGUI_CHECKVERSION();
|
||||||
|
ImGui::CreateContext();
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
|
||||||
|
ImGui_ImplWin32_Init(m_hwnd);
|
||||||
|
ImGui_ImplDX11_Init(m_Application->GetDirect3D()->GetDevice(), m_Application->GetDirect3D()->GetDeviceContext());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,6 +74,11 @@ void SystemClass::Shutdown()
|
|||||||
m_Input = 0;
|
m_Input = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Shutdown imgui
|
||||||
|
ImGui_ImplDX11_Shutdown();
|
||||||
|
ImGui_ImplWin32_Shutdown();
|
||||||
|
ImGui::DestroyContext();
|
||||||
|
|
||||||
// Shutdown the window.
|
// Shutdown the window.
|
||||||
ShutdownWindows();
|
ShutdownWindows();
|
||||||
|
|
||||||
@ -111,6 +128,7 @@ void SystemClass::Run()
|
|||||||
bool SystemClass::Frame()
|
bool SystemClass::Frame()
|
||||||
{
|
{
|
||||||
bool result;
|
bool result;
|
||||||
|
float value = 0.0f;
|
||||||
|
|
||||||
|
|
||||||
// Check if the user pressed escape and wants to exit the application.
|
// Check if the user pressed escape and wants to exit the application.
|
||||||
@ -119,6 +137,19 @@ bool SystemClass::Frame()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui_ImplDX11_NewFrame();
|
||||||
|
ImGui_ImplWin32_NewFrame();
|
||||||
|
ImGui::NewFrame();
|
||||||
|
|
||||||
|
//ImGui Widget
|
||||||
|
ImGui::Begin("Khaotic Engine", NULL);
|
||||||
|
ImGui::Text("Salam");
|
||||||
|
ImGui::SliderFloat("Slider", &value, 0.0f, 1.0f);
|
||||||
|
ImGui::End();
|
||||||
|
|
||||||
|
ImGui::Render();
|
||||||
|
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
|
||||||
|
|
||||||
// Do the frame processing for the application class object.
|
// Do the frame processing for the application class object.
|
||||||
result = m_Application->Frame();
|
result = m_Application->Frame();
|
||||||
if (!result)
|
if (!result)
|
||||||
@ -131,6 +162,12 @@ bool SystemClass::Frame()
|
|||||||
|
|
||||||
LRESULT CALLBACK SystemClass::MessageHandler(HWND hwnd, UINT umsg, WPARAM wparam, LPARAM lparam)
|
LRESULT CALLBACK SystemClass::MessageHandler(HWND hwnd, UINT umsg, WPARAM wparam, LPARAM lparam)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (ImGui_ImplWin32_WndProcHandler(hwnd, umsg, wparam, lparam))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
switch (umsg)
|
switch (umsg)
|
||||||
{
|
{
|
||||||
// Check if a key has been pressed on the keyboard.
|
// Check if a key has been pressed on the keyboard.
|
||||||
|
@ -152,4 +152,9 @@ bool ApplicationClass::Render()
|
|||||||
m_Direct3D->EndScene();
|
m_Direct3D->EndScene();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
D3DClass* ApplicationClass::GetDirect3D()
|
||||||
|
{
|
||||||
|
return m_Direct3D;
|
||||||
}
|
}
|
@ -25,6 +25,7 @@ public:
|
|||||||
ApplicationClass();
|
ApplicationClass();
|
||||||
ApplicationClass(const ApplicationClass&);
|
ApplicationClass(const ApplicationClass&);
|
||||||
~ApplicationClass();
|
~ApplicationClass();
|
||||||
|
D3DClass* GetDirect3D();
|
||||||
|
|
||||||
bool Initialize(int, int, HWND);
|
bool Initialize(int, int, HWND);
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
@ -24,6 +24,12 @@
|
|||||||
<ClCompile Include="Cameraclass.cpp" />
|
<ClCompile Include="Cameraclass.cpp" />
|
||||||
<ClCompile Include="Colorshaderclass.cpp" />
|
<ClCompile Include="Colorshaderclass.cpp" />
|
||||||
<ClCompile Include="d3dclass.cpp" />
|
<ClCompile Include="d3dclass.cpp" />
|
||||||
|
<ClCompile Include="include\backends\imgui_impl_dx11.cpp" />
|
||||||
|
<ClCompile Include="include\backends\imgui_impl_win32.cpp" />
|
||||||
|
<ClCompile Include="include\imgui.cpp" />
|
||||||
|
<ClCompile Include="include\imgui_draw.cpp" />
|
||||||
|
<ClCompile Include="include\imgui_tables.cpp" />
|
||||||
|
<ClCompile Include="include\imgui_widgets.cpp" />
|
||||||
<ClCompile Include="inputclass.cpp" />
|
<ClCompile Include="inputclass.cpp" />
|
||||||
<ClCompile Include="Main.cpp" />
|
<ClCompile Include="Main.cpp" />
|
||||||
<ClCompile Include="modelclass.cpp" />
|
<ClCompile Include="modelclass.cpp" />
|
||||||
@ -145,6 +151,7 @@
|
|||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)enginecustom\include\backends;$(SolutionDir)enginecustom\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
|
8
enginecustom/imgui.ini
Normal file
8
enginecustom/imgui.ini
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
[Window][Debug##Default]
|
||||||
|
Pos=60,60
|
||||||
|
Size=400,400
|
||||||
|
|
||||||
|
[Window][Khaotic Engine]
|
||||||
|
Pos=60,60
|
||||||
|
Size=51,48
|
||||||
|
|
@ -5,6 +5,9 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include "inputclass.h"
|
#include "inputclass.h"
|
||||||
#include "applicationclass.h"
|
#include "applicationclass.h"
|
||||||
|
#include "imgui.h"
|
||||||
|
#include "imgui_impl_win32.h"
|
||||||
|
#include "imgui_impl_dx11.h"
|
||||||
|
|
||||||
class SystemClass
|
class SystemClass
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user