Mesen-X/GUI/Renderer.h

56 lines
1.4 KiB
C
Raw Normal View History

#include "stdafx.h"
#include "DirectXTK\SpriteBatch.h"
2014-06-23 16:38:01 -04:00
#include "DirectXTK\SpriteFont.h"
#include "../Core/IVideoDevice.h"
using namespace DirectX;
namespace NES {
struct SimpleVertex
{
XMFLOAT3 Pos;
};
class Renderer : IVideoDevice
{
private:
HINSTANCE _hInst = nullptr;
HWND _hWnd = nullptr;
D3D_DRIVER_TYPE _driverType = D3D_DRIVER_TYPE_NULL;
D3D_FEATURE_LEVEL _featureLevel = D3D_FEATURE_LEVEL_11_0;
ID3D11Device* _pd3dDevice = nullptr;
ID3D11Device1* _pd3dDevice1 = nullptr;
ID3D11DeviceContext* _pImmediateContext = nullptr;
ID3D11DeviceContext1* _pImmediateContext1 = nullptr;
IDXGISwapChain* _pSwapChain = nullptr;
ID3D11RenderTargetView* _pRenderTargetView = nullptr;
2014-06-23 16:38:01 -04:00
ID3D11SamplerState* _samplerState = nullptr;
ID3D11Texture2D* _pTexture = nullptr;
byte* _videoRAM;
uint8_t* _nextFrameBuffer;
2014-06-13 23:12:56 -04:00
2014-06-23 16:38:01 -04:00
unique_ptr<SpriteFont> _font;
ID3D11Texture2D* _overlayTexture = nullptr;
byte* _overlayBuffer;
std::unique_ptr<SpriteBatch> _overlaySpriteBatch;
std::unique_ptr<SpriteBatch> _sprites;
2014-06-23 16:38:01 -04:00
HRESULT InitDevice();
void CleanupDevice();
ID3D11ShaderResourceView* GetDisplayBufferShaderResourceView();
public:
bool Initialize(HINSTANCE hInst, HWND hWnd);
2014-06-23 16:38:01 -04:00
void Render();
void UpdateFrame(uint8_t* frameBuffer)
{
memcpy(_nextFrameBuffer, frameBuffer, 256 * 240 * 4);
}
};
}