DumpDVD/DumpDVD/Gui/D3D.hpp

50 lines
1.0 KiB
C++
Raw Normal View History

2023-03-14 13:36:58 +00:00
#ifndef _LI_D3D_H
#define _LI_D3D_H 1
#ifndef _WIN32
#error d3d not availible except on windows
#endif
#include "Renderer.hpp"
#include <imgui.h>
#include <imgui_impl_dx11.h>
#include <d3d11.h>
#include <Windows.h>
2023-03-20 09:39:23 +00:00
#include <string>
2023-03-14 13:36:58 +00:00
namespace Li::Gui {
class D3D : public Renderer {
private:
HWND hwnd;
ID3D11Device* d3dDevice;
ID3D11DeviceContext* d3dDeviceContext;
IDXGISwapChain* swapChain;
ID3D11RenderTargetView* mainRenderTargetView;
2023-03-20 09:39:23 +00:00
int windowWidth;
int windowHeight;
2023-03-14 13:36:58 +00:00
bool createDeviceD3D();
void createRenderTarget();
2023-03-20 09:39:23 +00:00
void setupRenderTarget();
2023-03-14 13:36:58 +00:00
void cleanupRenderTarget();
2023-03-20 09:39:23 +00:00
void cleanupDeviceD3D();
2023-03-14 13:36:58 +00:00
public:
ID3D11Device* D3dDevice();
ID3D11DeviceContext* D3dDeviceContext();
2023-03-20 09:39:23 +00:00
int CompileShader(std::string shaderSrc, std::string entryPoint, std::string shaderModel, void** shaderObjectOut);
void Resize(int newWidth, int newHeight);
2023-03-14 13:36:58 +00:00
void InitImgui();
void ImGuiNewFrame();
2023-03-20 09:39:23 +00:00
void Render();
2023-03-14 13:36:58 +00:00
2023-03-20 09:39:23 +00:00
int WindowWidth();
int WindowHeight();
D3D(HWND hwnd, int windowWidth, int windowHeight);
2023-03-14 13:36:58 +00:00
~D3D();
};
}
#endif