Commit 33c43a2c authored by chili's avatar chili
Browse files

adjustable window size gfx fixes

parent 74d52460
...@@ -13,10 +13,10 @@ GDIPlusManager gdipm; ...@@ -13,10 +13,10 @@ GDIPlusManager gdipm;
App::App() App::App()
: :
wnd( 800,600,"The Donkey Fart Box" ), wnd( 1280,720,"The Donkey Fart Box" ),
light( wnd.Gfx() ) light( wnd.Gfx() )
{ {
wnd.Gfx().SetProjection( dx::XMMatrixPerspectiveLH( 1.0f,3.0f / 4.0f,0.5f,40.0f ) ); wnd.Gfx().SetProjection( dx::XMMatrixPerspectiveLH( 1.0f,9.0f / 16.0f,0.5f,40.0f ) );
} }
void App::DoFrame() void App::DoFrame()
......
...@@ -15,11 +15,11 @@ namespace dx = DirectX; ...@@ -15,11 +15,11 @@ namespace dx = DirectX;
#pragma comment(lib,"D3DCompiler.lib") #pragma comment(lib,"D3DCompiler.lib")
Graphics::Graphics( HWND hWnd ) Graphics::Graphics( HWND hWnd,int width,int height )
{ {
DXGI_SWAP_CHAIN_DESC sd = {}; DXGI_SWAP_CHAIN_DESC sd = {};
sd.BufferDesc.Width = 0; sd.BufferDesc.Width = width;
sd.BufferDesc.Height = 0; sd.BufferDesc.Height = height;
sd.BufferDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; sd.BufferDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
sd.BufferDesc.RefreshRate.Numerator = 0; sd.BufferDesc.RefreshRate.Numerator = 0;
sd.BufferDesc.RefreshRate.Denominator = 0; sd.BufferDesc.RefreshRate.Denominator = 0;
...@@ -77,8 +77,8 @@ Graphics::Graphics( HWND hWnd ) ...@@ -77,8 +77,8 @@ Graphics::Graphics( HWND hWnd )
// create depth stensil texture // create depth stensil texture
wrl::ComPtr<ID3D11Texture2D> pDepthStencil; wrl::ComPtr<ID3D11Texture2D> pDepthStencil;
D3D11_TEXTURE2D_DESC descDepth = {}; D3D11_TEXTURE2D_DESC descDepth = {};
descDepth.Width = 800u; descDepth.Width = width;
descDepth.Height = 600u; descDepth.Height = height;
descDepth.MipLevels = 1u; descDepth.MipLevels = 1u;
descDepth.ArraySize = 1u; descDepth.ArraySize = 1u;
descDepth.Format = DXGI_FORMAT_D32_FLOAT; descDepth.Format = DXGI_FORMAT_D32_FLOAT;
...@@ -102,8 +102,8 @@ Graphics::Graphics( HWND hWnd ) ...@@ -102,8 +102,8 @@ Graphics::Graphics( HWND hWnd )
// configure viewport // configure viewport
D3D11_VIEWPORT vp; D3D11_VIEWPORT vp;
vp.Width = 800.0f; vp.Width = (float)width;
vp.Height = 600.0f; vp.Height = (float)height;
vp.MinDepth = 0.0f; vp.MinDepth = 0.0f;
vp.MaxDepth = 1.0f; vp.MaxDepth = 1.0f;
vp.TopLeftX = 0.0f; vp.TopLeftX = 0.0f;
......
...@@ -57,7 +57,7 @@ public: ...@@ -57,7 +57,7 @@ public:
std::string reason; std::string reason;
}; };
public: public:
Graphics( HWND hWnd ); Graphics( HWND hWnd,int width,int height );
Graphics( const Graphics& ) = delete; Graphics( const Graphics& ) = delete;
Graphics& operator=( const Graphics& ) = delete; Graphics& operator=( const Graphics& ) = delete;
~Graphics(); ~Graphics();
......
...@@ -102,7 +102,7 @@ Window::Window( int width,int height,const char* name ) ...@@ -102,7 +102,7 @@ Window::Window( int width,int height,const char* name )
// Init ImGui Win32 Impl // Init ImGui Win32 Impl
ImGui_ImplWin32_Init( hWnd ); ImGui_ImplWin32_Init( hWnd );
// create graphics object // create graphics object
pGfx = std::make_unique<Graphics>( hWnd ); pGfx = std::make_unique<Graphics>( hWnd,width,height );
} }
Window::~Window() Window::~Window()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment