Esempio n. 1
0
// TODO: find a way to release reference to the textures
TextureEntity* CParaWorldAsset::GetDefaultTexture(int nTextureID)
{
	static TextureEntity* s_default_textures[10] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
	PE_ASSERT(nTextureID < 10 && nTextureID >= 0);

	TextureEntity* tex = s_default_textures[nTextureID];
	if (tex)
	{
		return tex;
	}
	else
	{
		// create the texture if it is not assigned before. 
		char sName[2];
		sName[0] = '0' + nTextureID;
		sName[1] = '\0';
		tex = LoadTexture(sName, "Texture/whitedot.png", TextureEntity::StaticTexture);
		//tex->SetState(AssetEntity::ASSET_STATE_LOCAL);
		tex->LoadAsset();
		s_default_textures[nTextureID] = tex;
	}
	return tex;
}