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

adjustable window size gfx fixes

parent 74d52460
......@@ -13,10 +13,10 @@ GDIPlusManager gdipm;
App::App()
:
wnd( 800,600,"The Donkey Fart Box" ),
wnd( 1280,720,"The Donkey Fart Box" ),
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()
......
......@@ -15,11 +15,11 @@ namespace dx = DirectX;
#pragma comment(lib,"D3DCompiler.lib")
Graphics::Graphics( HWND hWnd )
Graphics::Graphics( HWND hWnd,int width,int height )
{
DXGI_SWAP_CHAIN_DESC sd = {};
sd.BufferDesc.Width = 0;
sd.BufferDesc.Height = 0;
sd.BufferDesc.Width = width;
sd.BufferDesc.Height = height;
sd.BufferDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
sd.BufferDesc.RefreshRate.Numerator = 0;
sd.BufferDesc.RefreshRate.Denominator = 0;
......@@ -77,8 +77,8 @@ Graphics::Graphics( HWND hWnd )
// create depth stensil texture
wrl::ComPtr<ID3D11Texture2D> pDepthStencil;
D3D11_TEXTURE2D_DESC descDepth = {};
descDepth.Width = 800u;
descDepth.Height = 600u;
descDepth.Width = width;
descDepth.Height = height;
descDepth.MipLevels = 1u;
descDepth.ArraySize = 1u;
descDepth.Format = DXGI_FORMAT_D32_FLOAT;
......@@ -102,8 +102,8 @@ Graphics::Graphics( HWND hWnd )
// configure viewport
D3D11_VIEWPORT vp;
vp.Width = 800.0f;
vp.Height = 600.0f;
vp.Width = (float)width;
vp.Height = (float)height;
vp.MinDepth = 0.0f;
vp.MaxDepth = 1.0f;
vp.TopLeftX = 0.0f;
......
......@@ -57,7 +57,7 @@ public:
std::string reason;
};
public:
Graphics( HWND hWnd );
Graphics( HWND hWnd,int width,int height );
Graphics( const Graphics& ) = delete;
Graphics& operator=( const Graphics& ) = delete;
~Graphics();
......
......@@ -102,7 +102,7 @@ Window::Window( int width,int height,const char* name )
// Init ImGui Win32 Impl
ImGui_ImplWin32_Init( hWnd );
// create graphics object
pGfx = std::make_unique<Graphics>( hWnd );
pGfx = std::make_unique<Graphics>( hWnd,width,height );
}
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