本文整理汇总了C++中CTextureMap::size方法的典型用法代码示例。如果您正苦于以下问题:C++ CTextureMap::size方法的具体用法?C++ CTextureMap::size怎么用?C++ CTextureMap::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTextureMap
的用法示例。
在下文中一共展示了CTextureMap::size方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HasTexture
bool CGUITextureManager::HasTexture(const CStdString &textureName, CStdString *path, int *bundle, int *size)
{
// default values
if (bundle) *bundle = -1;
if (size) *size = 0;
if (path) *path = textureName;
if (textureName == "-")
return false;
if (textureName.Find("://") >= 0)
return false;
// first check of texture exists...
for (int i = 0; i < (int)m_vecTextures.size(); ++i)
{
CTextureMap *pMap = m_vecTextures[i];
if (pMap->GetName() == textureName)
{
for (int i = 0; i < 2; i++)
{
if (m_iNextPreload[i] != m_PreLoadNames[i].end() && (*m_iNextPreload[i] == textureName))
{
++m_iNextPreload[i];
// preload next file
if (m_iNextPreload[i] != m_PreLoadNames[i].end())
m_TexBundle[i].PreloadFile(*m_iNextPreload[i]);
}
}
if (size) *size = pMap->size();
return true;
}
}
for (int i = 0; i < 2; i++)
{
if (m_iNextPreload[i] != m_PreLoadNames[i].end() && (*m_iNextPreload[i] == textureName))
{
if (bundle) *bundle = i;
++m_iNextPreload[i];
// preload next file
if (m_iNextPreload[i] != m_PreLoadNames[i].end())
m_TexBundle[i].PreloadFile(*m_iNextPreload[i]);
return true;
}
else if (m_TexBundle[i].HasFile(textureName))
{
if (bundle) *bundle = i;
return true;
}
}
CStdString fullPath = GetTexturePath(textureName);
if (path)
*path = fullPath;
return !fullPath.IsEmpty();
}
示例2: Load
int CGUITextureManager::Load(const CStdString& strTextureName, DWORD dwColorKey, bool checkBundleOnly /*= false */)
{
CStdString strPath;
int bundle = -1;
int size = 0;
if (!HasTexture(strTextureName, &strPath, &bundle, &size))
return 0;
if (size) // we found the texture
return size;
// See if texture is being overridden.
CStdString strTextureFile = strTextureName;
CStdString strTextureOverridePath1;
CStdString strTextureOverridePath2;
CStdString strExt = CUtil::GetExtension(strTextureFile);
CUtil::RemoveExtension(strTextureFile);
// Check original format and JPEG.
strTextureOverridePath1.Format("%s/media/%s%s", _P("Q:"), strTextureFile.c_str(), strExt.c_str());
strTextureOverridePath2.Format("%s/media/%s.jpg", _P("Q:"), strTextureFile.c_str(), strExt.c_str());
if (checkBundleOnly && bundle == -1)
return 0;
if (XFILE::CFile::Exists(strTextureOverridePath1))
{ strPath = strTextureOverridePath1; bundle = -1; }
else if (XFILE::CFile::Exists(strTextureOverridePath2))
{ strPath = strTextureOverridePath2; bundle = -1; }
else if (bundle == -1)
strPath = GetTexturePath(strTextureName);
else
strPath = strTextureName;
//Lock here, we will do stuff that could break rendering
CSingleLock lock(g_graphicsContext);
#ifndef HAS_SDL
LPDIRECT3DTEXTURE8 pTexture;
LPDIRECT3DPALETTE8 pPal = 0;
#else
SDL_Surface* pTexture;
SDL_Palette* pPal = NULL;
#endif
#ifdef _DEBUG
LARGE_INTEGER start;
QueryPerformanceCounter(&start);
#endif
D3DXIMAGE_INFO info;
if (strPath.Right(4).ToLower() == ".gif")
{
CTextureMap* pMap;
if (bundle >= 0)
{
#ifndef HAS_SDL
LPDIRECT3DTEXTURE8* pTextures;
#else
SDL_Surface** pTextures;
#endif
int nLoops = 0;
int* Delay;
#ifndef HAS_SDL
int nImages = m_TexBundle[bundle].LoadAnim(g_graphicsContext.Get3DDevice(), strTextureName, &info, &pTextures, &pPal, nLoops, &Delay);
#else
int nImages = m_TexBundle[bundle].LoadAnim(strTextureName, &info, &pTextures, &pPal, nLoops, &Delay);
#endif
if (!nImages)
{
CLog::Log(LOGERROR, "Texture manager unable to load bundled file: %s", strTextureName.c_str());
return 0;
}
pMap = new CTextureMap(strTextureName);
for (int iImage = 0; iImage < nImages; ++iImage)
{
CTexture* pclsTexture = new CTexture(pTextures[iImage], info.Width, info.Height, true, 100, pPal);
pclsTexture->SetDelay(Delay[iImage]);
pclsTexture->SetLoops(nLoops);
pMap->Add(pclsTexture);
#ifndef HAS_SDL
delete pTextures[iImage];
#else
SDL_FreeSurface(pTextures[iImage]);
#endif
}
delete [] pTextures;
delete [] Delay;
}
else
{
CAnimatedGifSet AnimatedGifSet;
int iImages = AnimatedGifSet.LoadGIF(strPath.c_str());
if (iImages == 0)
{
if (!strnicmp(strPath.c_str(), "q:\\skin", 7))
//.........这里部分代码省略.........