#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>

namespace Li::Gui {
	class D3D : public Renderer {
	private:
		HWND hwnd;
		ID3D11Device* d3dDevice;
		ID3D11DeviceContext* d3dDeviceContext;
		IDXGISwapChain* swapChain;
		ID3D11RenderTargetView* mainRenderTargetView;

		bool createDeviceD3D();
		void cleanupDeviceD3D();
		void createRenderTarget();
		void cleanupRenderTarget();
	public:
		ID3D11Device* D3dDevice();
		ID3D11DeviceContext* D3dDeviceContext();

		void Resize();
		void InitImgui();
		void ImGuiNewFrame();
		void Render(ImVec4 clearColor);
		
		D3D(HWND hwnd);
		~D3D();
	};
}
#endif