1
0
mirror of https://github.com/borgesdan/xn65 synced 2024-12-29 21:54:47 +01:00
xn65/framework/platform/device-dx.hpp

55 lines
1.2 KiB
C++
Raw Normal View History

2024-03-18 15:41:46 -03:00
#ifndef XNA_PLATFORM_DEVICE_DX_HPP
#define XNA_PLATFORM_DEVICE_DX_HPP
#include "../graphics/device.hpp"
#include "../graphics/presentparams.hpp"
2024-03-18 15:41:46 -03:00
#include "dxgi.h"
#include "d3d11.h"
namespace xna {
2024-03-21 16:01:47 -03:00
class GraphicsDevice : public IGraphicsDevice {
2024-03-18 15:41:46 -03:00
public:
2024-03-21 16:01:47 -03:00
GraphicsDevice();
GraphicsDevice(GraphicsDeviceInformation const& info);
2024-03-18 15:41:46 -03:00
2024-03-21 16:01:47 -03:00
virtual ~GraphicsDevice() override {
2024-03-18 15:41:46 -03:00
if (_device) {
_device->Release();
_device = nullptr;
}
if (_context) {
_context->Release();
_context = nullptr;
}
}
2024-03-21 16:01:47 -03:00
virtual void Clear() override;
virtual bool Initialize(GameWindow& gameWindow) override;
virtual bool Present() override;
2024-03-18 15:41:46 -03:00
constexpr void SetCreateFlags(D3D11_CREATE_DEVICE_FLAG flags) {
_createDeviceFlags |= flags;
}
constexpr void ClearCreateFlags() {
_createDeviceFlags = 0;
}
2024-03-21 16:01:47 -03:00
bool GetSwapChainBackBuffer(ID3D11Texture2D*& texture2D);
2024-03-18 15:41:46 -03:00
public:
ID3D11Device* _device{ nullptr };
ID3D11DeviceContext* _context{ nullptr };
private:
unsigned int _createDeviceFlags{ 0 };
D3D_FEATURE_LEVEL _featureLevel{ D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_11_0 };
float _backgroundColor[4] = { 0, 0, 0, 0 };
xna::PresentationParameters _presentParameters;
2024-03-21 16:01:47 -03:00
bool createDevice();
};
2024-03-18 15:41:46 -03:00
}
#endif