コード例 #1
0
bool ApexResourceProvider::checkResource(ResID nameSpace, const char* name)
{
	/* Return true is named resource has known non-null pointer */
	uint32_t nsIndex = getNSIndex(nameSpace);
	if (nsIndex < mNameSpaces.size())
	{
		NameSpace* ns = mNameSpaces[nsIndex];
		ResID id = ns->getOrCreateID(name, mResources[ns->getID()].name);
		PX_ASSERT(id < mResources.size());
		return checkResource(id);
	}
	return false;
}
コード例 #2
0
ResID ApexResourceProvider::createResource(ResID nameSpace, const char* name, bool refCount)
{
	uint32_t nsIndex = getNSIndex(nameSpace);
	if (nsIndex < mNameSpaces.size())
	{
		NameSpace* ns = mNameSpaces[nsIndex];
		ResID id = ns->getOrCreateID(name, mResources[ns->getID()].name);
		PX_ASSERT(id < mResources.size());
		if (id < mResources.size() && refCount)
		{
			mResources[id].refCount++;
		}
		return id;
	}
	else
	{
		return INVALID_RESOURCE_ID;
	}
}