本文整理汇总了C++中LPDIRECT3DDEVICE9::SetCurrentTexturePalette方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECT3DDEVICE9::SetCurrentTexturePalette方法的具体用法?C++ LPDIRECT3DDEVICE9::SetCurrentTexturePalette怎么用?C++ LPDIRECT3DDEVICE9::SetCurrentTexturePalette使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDIRECT3DDEVICE9
的用法示例。
在下文中一共展示了LPDIRECT3DDEVICE9::SetCurrentTexturePalette方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
HRESULT HookIDirect3DDevice9::SetCurrentTexturePalette(LPVOID _this, UINT PaletteNumber)
{
LOG_API();
return pD3Dev->SetCurrentTexturePalette(PaletteNumber);
}
示例2: SetPalette
/* Load the palette, if any, for the given texture into a palette slot, and make
* it current. */
static void SetPalette( unsigned TexResource )
{
/* If the texture isn't paletted, we have nothing to do. */
if( g_TexResourceToTexturePalette.find(TexResource) == g_TexResourceToTexturePalette.end() )
return;
/* Is the palette already loaded? */
if( g_TexResourceToPaletteIndex.find(TexResource) == g_TexResourceToPaletteIndex.end() )
{
/* It's not. Grab the least recently used slot. */
int iPalIndex = g_PaletteIndex.front();
/* If any other texture is currently using this slot, mark that palette unloaded. */
for( map<unsigned,int>::iterator i = g_TexResourceToPaletteIndex.begin(); i != g_TexResourceToPaletteIndex.end(); ++i )
{
if( i->second != iPalIndex )
continue;
g_TexResourceToPaletteIndex.erase(i);
break;
}
/* Load it. */
#if !defined(XBOX)
TexturePalette& pal = g_TexResourceToTexturePalette[TexResource];
g_pd3dDevice->SetPaletteEntries( iPalIndex, pal.p );
#else
ASSERT(0);
#endif
g_TexResourceToPaletteIndex[TexResource] = iPalIndex;
}
const int iPalIndex = g_TexResourceToPaletteIndex[TexResource];
/* Find this palette index in the least-recently-used queue and move it to the end. */
for(list<int>::iterator i = g_PaletteIndex.begin(); i != g_PaletteIndex.end(); ++i)
{
if( *i != iPalIndex )
continue;
g_PaletteIndex.erase(i);
g_PaletteIndex.push_back(iPalIndex);
break;
}
#if !defined(XBOX)
g_pd3dDevice->SetCurrentTexturePalette( iPalIndex );
#else
ASSERT(0);
#endif
}