This commit is contained in:
minggo 2013-02-06 11:53:58 +08:00
commit 682910b5f8
5 changed files with 51 additions and 7 deletions

View File

@ -559,6 +559,11 @@ void CCFileUtils::setSearchResolutionsOrder(const std::vector<std::string>& sear
}
}
void CCFileUtils::addSearchResolutionsOrder(const char* order)
{
m_searchResolutionsOrderArray.push_back(order);
}
const std::vector<std::string>& CCFileUtils::getSearchResolutionsOrder()
{
return m_searchResolutionsOrderArray;
@ -601,6 +606,22 @@ void CCFileUtils::setSearchPaths(const std::vector<std::string>& searchPaths)
}
}
void CCFileUtils::addSearchPath(const char* path_)
{
std::string strPrefix;
std::string path(path_);
if (!isAbsolutePath(path))
{ // Not an absolute path
strPrefix = m_strDefaultResRootPath;
}
path = strPrefix + path;
if (path.length() > 0 && path[path.length()-1] != '/')
{
path += "/";
}
m_searchPathArray.push_back(path);
}
void CCFileUtils::setFilenameLookupDictionary(CCDictionary* pFilenameLookupDict)
{
CC_SAFE_RELEASE(m_pFilenameLookupDict);

View File

@ -210,6 +210,14 @@ public:
* @since v2.1
*/
virtual void setSearchResolutionsOrder(const std::vector<std::string>& searchResolutionsOrder);
/**
* Append search order of the resources.
*
* @see setSearchResolutionsOrder(), fullPathForFilename().
* @since v2.1
*/
virtual void addSearchResolutionsOrder(const char* order);
/**
* Gets the array that contains the search order of the resources.
@ -238,6 +246,13 @@ public:
*/
virtual void setSearchPaths(const std::vector<std::string>& searchPaths);
/**
* Add search path.
*
* @since v2.1
*/
void addSearchPath(const char* path);
/**
* Gets the array of search paths.
*

View File

@ -253,7 +253,6 @@ bool CCTexture2D::initWithImage(CCImage *uiImage)
if (uiImage == NULL)
{
CCLOG("cocos2d: CCTexture2D. Can't create Texture. UIImage is nil");
this->release();
return false;
}
@ -266,8 +265,7 @@ bool CCTexture2D::initWithImage(CCImage *uiImage)
if (imageWidth > maxTextureSize || imageHeight > maxTextureSize)
{
CCLOG("cocos2d: WARNING: Image (%u x %u) is bigger than the supported %u x %u", imageWidth, imageHeight, maxTextureSize, maxTextureSize);
this->release();
return NULL;
return false;
}
// always load premultiplied images
@ -526,7 +524,6 @@ bool CCTexture2D::initWithPVRTCData(const void *data, int level, int bpp, bool h
if( !(CCConfiguration::sharedConfiguration()->supportsPVRTC()) )
{
CCLOG("cocos2d: WARNING: PVRTC images is not supported.");
this->release();
return false;
}

View File

@ -1 +1 @@
e9c1a806c486b8420ea0bfd4fd99acf5a3a983ca
191c26cba3c327bda5db6f92d8fe63330155c461

View File

@ -2,7 +2,18 @@
class CCFileUtils
{
static CCFileUtils* sharedFileUtils();
std::string getWriteablePath();
const char* fullPathFromRelativeFile(const char *pszFilename, const char *pszRelativeFile);
static void purgeFileUtils();
void purgeCachedEntries();
std::string fullPathForFilename(const char *pszFileName);
void loadFilenameLookupDictionaryFromFile(const char* filename);
const char* fullPathFromRelativeFile(const char *pszFilename, const char *pszRelativeFile);
void addSearchResolutionsOrder(const char* order);
void addSearchPath(const char* path);
std::string getWriteablePath();
void setPopupNotify(bool bNotify);
bool isPopupNotify();
};