コード例 #1
0
ファイル: Texture.cpp プロジェクト: MrBowler/SD6-A2
//-----------------------------------------------------------------------------------------------
STATIC Texture* Texture::CreateOrGetTexture( const std::string& imageFilePath )
{
	Texture* texture = GetTextureByName( imageFilePath );
	if( !texture )
	{
		texture = new Texture( imageFilePath );
	}

	return texture;
}
コード例 #2
0
//---------------------------------------------------------------------------
// Finds the named Texture among the registry of those already loaded; if
//	found, returns that Texture*.  If not, attempts to load that texture,
//	and returns a Texture* just created (or nullptr if unable to load file).
//
STATIC Texture* Texture::CreateOrGetTexture(const std::string& imageFilePath)
{
	Texture* texture = GetTextureByName(imageFilePath);
	if (texture != nullptr)
	{
		return texture;
	}
	else
	{
		texture = new Texture(imageFilePath);
		Texture::s_textureRegistry[imageFilePath] = texture;
		return texture;
	}
}