本文整理汇总了C++中CGrowableArray::Contains方法的典型用法代码示例。如果您正苦于以下问题:C++ CGrowableArray::Contains方法的具体用法?C++ CGrowableArray::Contains怎么用?C++ CGrowableArray::Contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGrowableArray
的用法示例。
在下文中一共展示了CGrowableArray::Contains方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ClearAdapterInfoList
//--------------------------------------------------------------------------------------
// Enumerates available D3D adapters, devices, modes, etc.
//--------------------------------------------------------------------------------------
HRESULT CD3DEnumeration::Enumerate( IDirect3D9* pD3D,
LPDXUTCALLBACKISDEVICEACCEPTABLE IsDeviceAcceptableFunc,
void* pIsDeviceAcceptableFuncUserContext )
{
if( pD3D == NULL )
{
pD3D = DXUTGetD3DObject();
if( pD3D == NULL )
return DXUTERR_NODIRECT3D;
}
m_pD3D = pD3D;
m_IsDeviceAcceptableFunc = IsDeviceAcceptableFunc;
m_pIsDeviceAcceptableFuncUserContext = pIsDeviceAcceptableFuncUserContext;
HRESULT hr;
ClearAdapterInfoList();
CGrowableArray<D3DFORMAT> adapterFormatList;
const D3DFORMAT allowedAdapterFormatArray[] =
{
D3DFMT_X8R8G8B8,
D3DFMT_X1R5G5B5,
D3DFMT_R5G6B5,
D3DFMT_A2R10G10B10
};
const UINT allowedAdapterFormatArrayCount = sizeof(allowedAdapterFormatArray) / sizeof(allowedAdapterFormatArray[0]);
UINT numAdapters = pD3D->GetAdapterCount();
for (UINT adapterOrdinal = 0; adapterOrdinal < numAdapters; adapterOrdinal++)
{
CD3DEnumAdapterInfo* pAdapterInfo = MEMALLOC_NEW(CD3DEnumAdapterInfo);
if( pAdapterInfo == NULL )
return E_OUTOFMEMORY;
pAdapterInfo->AdapterOrdinal = adapterOrdinal;
pD3D->GetAdapterIdentifier(adapterOrdinal, 0, &pAdapterInfo->AdapterIdentifier);
// Get list of all display modes on this adapter.
// Also build a temporary list of all display adapter formats.
adapterFormatList.RemoveAll();
for( UINT iFormatList = 0; iFormatList < allowedAdapterFormatArrayCount; iFormatList++ )
{
D3DFORMAT allowedAdapterFormat = allowedAdapterFormatArray[iFormatList];
UINT numAdapterModes = pD3D->GetAdapterModeCount( adapterOrdinal, allowedAdapterFormat );
for (UINT mode = 0; mode < numAdapterModes; mode++)
{
D3DDISPLAYMODE displayMode;
pD3D->EnumAdapterModes( adapterOrdinal, allowedAdapterFormat, mode, &displayMode );
if( displayMode.Width < m_nMinWidth ||
displayMode.Height < m_nMinHeight ||
displayMode.Width > m_nMaxWidth ||
displayMode.Height > m_nMaxHeight ||
displayMode.RefreshRate < m_nRefreshMin ||
displayMode.RefreshRate > m_nRefreshMax )
{
continue;
}
pAdapterInfo->displayModeList.Add( displayMode );
if( !adapterFormatList.Contains(displayMode.Format) )
adapterFormatList.Add( displayMode.Format );
}
}
D3DDISPLAYMODE displayMode;
pD3D->GetAdapterDisplayMode( adapterOrdinal, &displayMode );
if( !adapterFormatList.Contains(displayMode.Format) )
adapterFormatList.Add( displayMode.Format );
// Sort displaymode list
::qsort( pAdapterInfo->displayModeList.GetData(),
pAdapterInfo->displayModeList.GetSize(), sizeof( D3DDISPLAYMODE ),
SortModesCallback );
// Get info for each device on this adapter
if( FAILED( EnumerateDevices( pAdapterInfo, &adapterFormatList ) ) )
{
delete pAdapterInfo;
continue;
}
// If at least one device on this adapter is available and compatible
// with the app, add the adapterInfo to the list
if( pAdapterInfo->deviceInfoList.GetSize() > 0 )
{
hr = m_AdapterInfoList.Add( pAdapterInfo );
if( FAILED(hr) )
return hr;
} else
delete pAdapterInfo;
}
//.........这里部分代码省略.........