light/Engine/src/Platform/GraphicsAPI/DirectX/dxUserInterface.cpp
Light 2ab97d3863 Major Maintenance
- Major tidying
- Moved 'RendererProgram' classes out of the 'Renderer' class
- Moved 'RenderCommand' member variable out of 'GraphicsContext' and into
       the 'Renderer' class as a unique_ptr. results in 'Renderer' taking a
       windowHandle for construction
- Defined new macros for max quads in 'Renderer.h'
- Added the 'Stringifier' to 'Base.h'
- Added the 'ResourceManager' to the 'LightEngine.h'
- Application now logs the current file directory
- Fixed the forward declaration in GraphicsContext
- Fixed the debug break in Base.h
- Fixed 'dxShader' not logging compile errors
- 'glVertexLayout' now takes in a shared_ptr for 'VertexBuffer'
- 'glShader' now logs the shader compilation errors properly
- 'dxVertexLayout' now takes in a shared_ptr for 'Shader"
- Modified 'dxSharedContext' members to be private and made getters for them
- 'dxRenderCommand::SwapBuffers' now throws dxException for
       DXGI_ERROR_DEVICE_REMOD error
2021-07-01 19:25:46 +04:30

67 lines
No EOL
1.5 KiB
C++

#include "ltpch.h"
#include "dxUserInterface.h"
#include "dxSharedContext.h"
#include <imgui.h>
#include <imgui_impl_win32.h>
#include <imgui_impl_dx11.h>
#define GLFW_EXPOSE_NATIVE_WIN32
#include <glfw/glfw3.h>
#include <glfw/glfw3native.h>
namespace Light {
dxUserInterface::dxUserInterface(GLFWwindow* windowHandle, std::shared_ptr<dxSharedContext> sharedContext)
{
// create context
IMGUI_CHECKVERSION();
ImGui::CreateContext();
// configure io
ImGuiIO& io = ImGui::GetIO();
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
// style
ImGui::StyleColorsDark();
// init
ImGui_ImplWin32_Init(glfwGetWin32Window(windowHandle));
ImGui_ImplDX11_Init(sharedContext->GetDevice().Get(), sharedContext->GetDeviceContext().Get());
}
dxUserInterface::~dxUserInterface()
{
ImGui_ImplDX11_Shutdown();
ImGui_ImplWin32_Shutdown();
ImGui::DestroyContext();
}
void dxUserInterface::Begin()
{
ImGui_ImplDX11_NewFrame();
ImGui_ImplWin32_NewFrame();
ImGui::NewFrame();
//** #TEMP_IMGUI_DEMO_TEMP# **//
ImGui::ShowDemoWindow();
}
void dxUserInterface::End()
{
ImGui::Render();
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
}
void dxUserInterface::LogDebugData()
{
// #todo: improve
LT_ENGINE_INFO("________________________________________");
LT_ENGINE_INFO("UserInterface::");
LT_ENGINE_INFO(" API : ImGui");
LT_ENGINE_INFO(" Version: {}", ImGui::GetVersion());
LT_ENGINE_INFO(" GraphicsAPI : DirectX");
LT_ENGINE_INFO("________________________________________");
}
}