本文整理汇总了C++中Dimensions::GetWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ Dimensions::GetWidth方法的具体用法?C++ Dimensions::GetWidth怎么用?C++ Dimensions::GetWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dimensions
的用法示例。
在下文中一共展示了Dimensions::GetWidth方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Resize
void SwapChain::Resize(const Dimensions& dimensions)
{
// Release outdated resources
backBuffer_.reset();
depthStencilTexture_.reset();
depthStencilView_.reset();
e_throw_com_ret_error(dxgiSwapChain_
->ResizeBuffers(dxgiSwapChainDesc_.BufferCount,
dimensions.GetWidth(), dimensions.GetHeight(),
dxgiSwapChainDesc_.BufferDesc.Format,
dxgiSwapChainDesc_.Flags), "IDXGISwapChain::ResizeBuffers");
// Temporarily grab the back buffer to get the view
boost::intrusive_ptr<ID3D11Texture2D> tempBackBuffer;
e_throw_com_ret_error(dxgiSwapChain_->GetBuffer(0,
__uuidof(ID3D11Texture2D),
ReceiveCOM(tempBackBuffer)), "IDXGISwapChain::GetBuffer");
// Now get the view
e_throw_com_ret_error(device_.GetD3DDevice()
.CreateRenderTargetView(tempBackBuffer.get(),
0,
ReceiveCOM(backBuffer_)), "ID3D11Device::CreateRenderTargetView");
// Create depth/stencil views
D3D11_TEXTURE2D_DESC depthTextureDesc = {0};
depthTextureDesc.Width = dimensions.GetWidth();
depthTextureDesc.Height = dimensions.GetHeight();
depthTextureDesc.MipLevels = 1;
depthTextureDesc.ArraySize = 1;
depthTextureDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
depthTextureDesc.SampleDesc.Count = 1;
depthTextureDesc.SampleDesc.Quality = 0;
depthTextureDesc.Usage = D3D11_USAGE_DEFAULT;
depthTextureDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
depthTextureDesc.CPUAccessFlags = 0;
depthTextureDesc.MiscFlags = 0;
e_throw_com_ret_error(device_.GetD3DDevice()
.CreateTexture2D(&depthTextureDesc,
NULL,
ReceiveCOM(depthStencilTexture_)), "ID3D11Device::CreateTexture2D");
D3D11_DEPTH_STENCIL_VIEW_DESC depthStencilViewDesc;
memset(&depthStencilViewDesc, 0, sizeof(depthStencilViewDesc));
depthStencilViewDesc.Format = depthTextureDesc.Format;
depthStencilViewDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
//depthStencilViewDesc.Texture2D.MipSlice = 0;
e_throw_com_ret_error(device_.GetD3DDevice()
.CreateDepthStencilView(depthStencilTexture_.get(),
&depthStencilViewDesc,
ReceiveCOM(depthStencilView_)), "ID3D11Device::CreateDepthStencilView");
e_throw_com_ret_error(dxgiSwapChain_
->SetFullscreenState(window_.GetWindowProperties().windowType == WindowType::FULLSCREEN ? TRUE : FALSE,
NULL), "IDXGISwapChain::SetFullscreenState");
}