Пример #1
0
iGpuProgram* cGpuProgramManager::CreateProgram(const tString& asName,const tString& asEntry,
        eGpuProgramType aType)
{
    tString sPath;
    iGpuProgram* pProgram;
    pProgram = static_cast<iGpuProgram*>(FindLoadedResource(asName,sPath));

    BeginLoad(asName);

    if(pProgram==NULL && sPath!="")
        {
            pProgram = mpLowLevelGraphics->CreateGpuProgram(asName, aType);

            if(pProgram->CreateFromFile(sPath,asEntry)==false)
                {
                    Error("Couldn't create program '%s'\n",asName.c_str());
                    hplDelete(pProgram);
                    EndLoad();
                    return NULL;
                }

            AddResource(pProgram);
        }

    if(pProgram)pProgram->IncUserCount();
    else Error("Couldn't load program '%s'\n",asName.c_str());

    EndLoad();
    return pProgram;
}
Пример #2
0
	iResourceBase* cImageEntityManager::Create(const tString& asName)
	{
		tString sPath;
		cImageEntityData* pIEData;
		tString asNewName;

		BeginLoad(asName);

		asNewName = cString::SetFileExt(asName,"hed");

		pIEData = static_cast<cImageEntityData*>(FindLoadedResource(asNewName,sPath));

		if(pIEData==NULL && sPath!="")
		{
			pIEData = hplNew( cImageEntityData, (asNewName,mpGraphics,mpResources) );

			if(pIEData->CreateFromFile(sPath,mvImageHandle)==false){
				EndLoad();
				return NULL;
			}

			if(pIEData)AddResource(pIEData);
		}
		else
		{
		}

		if(pIEData)pIEData->IncUserCount();
		else Error("Couldn't load image entity data '%s'\n",asNewName.c_str());
		
		EndLoad();
		return pIEData;
	}
Пример #3
0
	iSoundData *cSoundManager::FindData(const tString &a_sName, tString &a_sFilePath)
	{
		iSoundData *pData = NULL;

		if (cString::GetFileExt(a_sName) == "")
		{
			for (tStringListIt it = m_lstFileFormats.begin(); it != m_lstFileFormats.end(); ++it)
			{
				tString sNewName = cString::SetFileExt(a_sName, *it);
				pData = static_cast<iSoundData*> (FindLoadedResource(sNewName, a_sFilePath));

				if ((pData==NULL && a_sFilePath != "") || pData!=NULL) break;
			}
		}
		else
			pData = static_cast<iSoundData*> (FindLoadedResource(a_sName, a_sFilePath));

		return pData;
	}
Пример #4
0
	cResourceImage *cImageManager::FindImage(const tString &asName, tString &asFilePath)
	{
		cResourceImage *pImage=NULL;

		if(cString::GetFileExt(asName)=="")
		{
			for(tStringListIt it = mlstFileFormats.begin();it!=mlstFileFormats.end();++it)
			{
				tString sNewName = cString::SetFileExt(asName,*it);
				pImage = static_cast<cResourceImage*> (FindLoadedResource(sNewName, asFilePath));

				if((pImage==NULL && asFilePath!="") || pImage!=NULL)break;
			}
		}
		else
		{
			pImage = static_cast<cResourceImage*> (FindLoadedResource(asName, asFilePath));
		}

		return pImage;
	}