2010-10-18 15:07:55 +08:00
|
|
|
#include "ResourceHandle.h"
|
|
|
|
#include "TG3.h"
|
|
|
|
|
2010-12-15 18:28:18 +08:00
|
|
|
namespace CocosDenshion {
|
|
|
|
|
2010-10-18 15:07:55 +08:00
|
|
|
ResourceHandle::ResourceHandle()
|
|
|
|
:m_pResLib(NULL)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ResourceHandle::~ResourceHandle()
|
|
|
|
{
|
|
|
|
release();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ResourceHandle::release()
|
|
|
|
{
|
|
|
|
if (m_pResLib)
|
|
|
|
{
|
|
|
|
delete m_pResLib;
|
|
|
|
m_pResLib = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ResourceHandle::setResourceEntry(const void* pResEntry)
|
|
|
|
{
|
|
|
|
release();
|
|
|
|
|
|
|
|
m_pResLib = new TResourceLib((const AppResourceEntry*)pResEntry);
|
|
|
|
}
|
|
|
|
|
|
|
|
const void* ResourceHandle::LoadConstRawData(int nResID, unsigned int* nLen)
|
|
|
|
{
|
|
|
|
const void* pResult = NULL;
|
|
|
|
|
|
|
|
if (m_pResLib)
|
|
|
|
{
|
|
|
|
pResult = m_pResLib->LoadConstRawData(nResID, nLen);
|
|
|
|
}
|
|
|
|
|
|
|
|
return pResult;
|
|
|
|
}
|
2010-12-15 18:28:18 +08:00
|
|
|
|
|
|
|
} // end of namespace CocosDenshion
|