当前位置: 首页>>代码示例>>C++>>正文


C++ Dimensions::GetHeight方法代码示例

本文整理汇总了C++中Dimensions::GetHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ Dimensions::GetHeight方法的具体用法?C++ Dimensions::GetHeight怎么用?C++ Dimensions::GetHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dimensions的用法示例。


在下文中一共展示了Dimensions::GetHeight方法的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");
}
开发者ID:kaylynb,项目名称:Sunflower,代码行数:59,代码来源:SwapChain.cpp


注:本文中的Dimensions::GetHeight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。