2024-03-18 15:41:46 -03:00
|
|
|
#ifndef XNA_PLATFORM_SWAPCHAIN_DX_HPP
|
|
|
|
#define XNA_PLATFORM_SWAPCHAIN_DX_HPP
|
|
|
|
|
|
|
|
#include "../graphics/swapchain.hpp"
|
|
|
|
#include "window-dx.hpp"
|
2024-04-22 11:22:18 -03:00
|
|
|
#include "dxheaders.hpp"
|
2024-03-18 15:41:46 -03:00
|
|
|
|
|
|
|
namespace xna {
|
2024-03-21 16:01:47 -03:00
|
|
|
class SwapChain : public ISwapChain{
|
2024-03-18 15:41:46 -03:00
|
|
|
public:
|
2024-03-21 16:01:47 -03:00
|
|
|
virtual ~SwapChain() override {
|
2024-03-18 15:41:46 -03:00
|
|
|
if (_swapChain) {
|
|
|
|
_swapChain->Release();
|
|
|
|
_swapChain = nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-22 11:22:18 -03:00
|
|
|
virtual bool Initialize(GraphicsDevice& device, GameWindow const& gameWindow) override;
|
|
|
|
bool Initialize(GraphicsDevice& device, GameWindow const& gameWindow, DXGI_SWAP_CHAIN_DESC1 const& desc, DXGI_SWAP_CHAIN_FULLSCREEN_DESC const& fullScreenDesc);
|
2024-03-21 16:01:47 -03:00
|
|
|
|
2024-03-18 15:41:46 -03:00
|
|
|
bool GetBackBuffer(ID3D11Texture2D*& texture2D) {
|
|
|
|
if FAILED(_swapChain->GetBuffer(0, __uuidof(texture2D), (void**)(&texture2D)))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2024-03-21 16:01:47 -03:00
|
|
|
public:
|
2024-04-22 11:22:18 -03:00
|
|
|
IDXGISwapChain1* _swapChain{ nullptr };
|
|
|
|
DXGI_SWAP_CHAIN_DESC1 _description{};
|
|
|
|
DXGI_SWAP_CHAIN_FULLSCREEN_DESC _fullScreenDescription{};
|
2024-03-21 16:01:47 -03:00
|
|
|
};
|
2024-03-18 15:41:46 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|