本文整理汇总了C++中CPUTAssetLibraryDX11::GetFont方法的典型用法代码示例。如果您正苦于以下问题:C++ CPUTAssetLibraryDX11::GetFont方法的具体用法?C++ CPUTAssetLibraryDX11::GetFont怎么用?C++ CPUTAssetLibraryDX11::GetFont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPUTAssetLibraryDX11
的用法示例。
在下文中一共展示了CPUTAssetLibraryDX11::GetFont方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ASSERT
//.........这里部分代码省略.........
ASSERT( SUCCEEDED(hr), _L("Error creating CPUT GUI system input layout" ));
CPUTSetDebugName( mpVertexLayout, _L("CPUT GUI InputLayout object"));
// 5. create the vertex shader constant buffer pointers
D3D11_BUFFER_DESC bd;
ZeroMemory( &bd, sizeof(bd) );
bd.Usage = D3D11_USAGE_DEFAULT;
bd.ByteWidth = sizeof(GUIConstantBufferVS);
bd.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
bd.CPUAccessFlags = 0;
hr = pD3dDevice->CreateBuffer( &bd, NULL, &mpConstantBufferVS );
ASSERT( SUCCEEDED(hr), _L("Error creating constant buffer VS" ));
CPUTSetDebugName( mpConstantBufferVS, _L("GUI ConstantBuffer"));
// Set the texture directory for loading the control texture atlas
pAssetLibrary->SetTextureDirectoryName(ResourceDirectory);
// load the control atlas
mpControlTextureAtlas = (CPUTTextureDX11*) pAssetLibrary->GetTexture(ControlAtlasTexture);
if(NULL==mpControlTextureAtlas)
{
return CPUT_TEXTURE_LOAD_ERROR;
}
mpControlTextureAtlasView = mpControlTextureAtlas->GetShaderResourceView();
mpControlTextureAtlasView->AddRef();
// restore the asset library's texture directory
pAssetLibrary->SetTextureDirectoryName(OriginalAssetLibraryDirectory);
// 6. Load the font atlas
// store the existing asset library font directory
OriginalAssetLibraryDirectory = pAssetLibrary->GetFontDirectory();
// set font directory to the resource directory
pAssetLibrary->SetFontDirectoryName(ResourceDirectory);
mpFont = (CPUTFontDX11*) pAssetLibrary->GetFont(DefaultFontFilename);
if(NULL==mpFont)
{
return CPUT_TEXTURE_LOAD_ERROR;
}
mpTextTextureAtlas = mpFont->GetAtlasTexture();
mpTextTextureAtlas->AddRef();
mpTextTextureAtlasView = mpFont->GetAtlasTextureResourceView();
mpTextTextureAtlasView->AddRef();
// restore the asset library's font directory
pAssetLibrary->SetTextureDirectoryName(OriginalAssetLibraryDirectory);
// 7. Set up the DirectX uber-buffers that the controls draw into
int maxSize = max(CPUT_GUI_BUFFER_STRING_SIZE, CPUT_GUI_BUFFER_SIZE);
maxSize = max(maxSize, CPUT_GUI_VERTEX_BUFFER_SIZE);
maxSize *= sizeof( CPUTGUIVertex );
char *pZeroedBuffer= new char[maxSize];
memset(pZeroedBuffer, 0, maxSize);
// set up buffer description
ZeroMemory( &bd, sizeof(bd) );
bd.Usage = D3D11_USAGE_DEFAULT;
bd.ByteWidth = sizeof( CPUTGUIVertex ) * CPUT_GUI_VERTEX_BUFFER_SIZE; //mUberBufferIndex;
bd.BindFlags = D3D11_BIND_VERTEX_BUFFER;
bd.CPUAccessFlags = 0;
// initialization data (all 0's for now)
D3D11_SUBRESOURCE_DATA InitData;