diff --git a/includes/xna-dx/implementations.hpp b/includes/xna-dx/implementations.hpp index 5d1a5fe..0b36182 100644 --- a/includes/xna-dx/implementations.hpp +++ b/includes/xna-dx/implementations.hpp @@ -59,6 +59,11 @@ namespace xna { D3D11_RASTERIZER_DESC Description{}; }; + struct RenderTarget2DImplementation { + comptr RenderTargetView; + D3D11_RENDER_TARGET_VIEW_DESC Description{}; + }; + struct SamplerStateImplementation { comptr SamplerState; D3D11_SAMPLER_DESC Description{}; @@ -151,12 +156,7 @@ namespace xna { return !FAILED(hr); } - }; - - struct RenderTarget2D::PlatformImplementation { - comptr _renderTargetView = nullptr; - D3D11_RENDER_TARGET_VIEW_DESC _renderTargetDesc{}; - }; + }; enum class GameWindowMode : UINT { Fullscreen = WS_POPUP | WS_VISIBLE, diff --git a/includes/xna/graphics/rendertarget.hpp b/includes/xna/graphics/rendertarget.hpp index 8e7979a..57f3412 100644 --- a/includes/xna/graphics/rendertarget.hpp +++ b/includes/xna/graphics/rendertarget.hpp @@ -1,7 +1,6 @@ #ifndef XNA_GRAPHICS_RENDERTARGET_HPP #define XNA_GRAPHICS_RENDERTARGET_HPP -#include "../default.hpp" #include "texture.hpp" namespace xna { @@ -11,14 +10,13 @@ namespace xna { class RenderTarget2D : public Texture2D { public: RenderTarget2D(); - RenderTarget2D(sptr const& device); + RenderTarget2D(std::shared_ptr const& device); - static P_RenderTarget2D FromBackBuffer(P_GraphicsDevice const& device); + static P_RenderTarget2D FromBackBuffer(std::shared_ptr const& device); - void Initialize(); - public: - struct PlatformImplementation; - uptr impl2 = nullptr; + void Initialize(); + + std::unique_ptr Implementation2; }; } diff --git a/sources/framework-dx/device.cpp b/sources/framework-dx/device.cpp index 20b30fa..865b063 100644 --- a/sources/framework-dx/device.cpp +++ b/sources/framework-dx/device.cpp @@ -175,7 +175,7 @@ namespace xna { Implementation->RenderTarget2D = RenderTarget2D::FromBackBuffer(_this); } - const auto& renderView = Implementation->RenderTarget2D->impl2->_renderTargetView; + const auto& renderView = Implementation->RenderTarget2D->Implementation2->RenderTargetView; Implementation->Context->OMSetRenderTargets(1, renderView.GetAddressOf(), nullptr); } @@ -184,7 +184,7 @@ namespace xna { Implementation->Context->OMSetRenderTargets( 1, - Implementation->RenderTarget2D->impl2->_renderTargetView.GetAddressOf(), + Implementation->RenderTarget2D->Implementation2->RenderTargetView.GetAddressOf(), nullptr); return result; @@ -201,7 +201,7 @@ namespace xna { Implementation->backgroundColor[3] = v4.W; Implementation->Context->ClearRenderTargetView( - Implementation->RenderTarget2D->impl2->_renderTargetView.Get(), + Implementation->RenderTarget2D->Implementation2->RenderTargetView.Get(), Implementation->backgroundColor); } diff --git a/sources/framework-dx/rendertarget.cpp b/sources/framework-dx/rendertarget.cpp index e9db058..b4d5fc2 100644 --- a/sources/framework-dx/rendertarget.cpp +++ b/sources/framework-dx/rendertarget.cpp @@ -2,18 +2,18 @@ namespace xna { RenderTarget2D::RenderTarget2D() : Texture2D(nullptr) { - impl2 = unew(); + Implementation2 = unew(); } RenderTarget2D::RenderTarget2D(sptr const& device) : Texture2D(device) { - impl2 = unew(); + Implementation2 = unew(); } P_RenderTarget2D RenderTarget2D::FromBackBuffer(P_GraphicsDevice const& device) { auto& swapChain = device->Implementation->SwapChain; auto rt = snew(device); auto& implementation = rt->Implementation; - auto& implementation2 = rt->impl2; + auto& implementation2 = rt->Implementation2; if (!swapChain->impl->GetBackBuffer(implementation->Texture2D)) { @@ -30,7 +30,7 @@ namespace xna { Exception::Throw(Exception::UNABLE_TO_INITIALIZE); } - if (impl2->_renderTargetView) + if (Implementation2->RenderTargetView) return; Implementation->Description.Width = width; @@ -44,12 +44,12 @@ namespace xna { const auto hr = dxdevice->CreateRenderTargetView( Implementation->Texture2D.Get(), NULL, - impl2->_renderTargetView.ReleaseAndGetAddressOf()); + Implementation2->RenderTargetView.ReleaseAndGetAddressOf()); if (FAILED(hr)) { Exception::Throw(Exception::FAILED_TO_CREATE); } - impl2->_renderTargetView->GetDesc(&impl2->_renderTargetDesc); + Implementation2->RenderTargetView->GetDesc(&Implementation2->Description); } } \ No newline at end of file