Skip to content

Instantly share code, notes, and snippets.

@syuhari
Created August 26, 2013 19:26
Show Gist options
  • Save syuhari/6345552 to your computer and use it in GitHub Desktop.
Save syuhari/6345552 to your computer and use it in GitHub Desktop.
resolved a black screen for cocos2d-x ver.2.1.4 as entering foreground after tapping the power button
diff --git a/cocos2dx/platform/CCFileUtils.cpp b/cocos2dx/platform/CCFileUtils.cpp
index ba5b497..0faafa7 100755
--- a/cocos2dx/platform/CCFileUtils.cpp
+++ b/cocos2dx/platform/CCFileUtils.cpp
@@ -533,6 +533,7 @@ const char* CCFileUtils::fullPathFromRelativeFile(const char *pszFilename, const
void CCFileUtils::setSearchResolutionsOrder(const std::vector<std::string>& searchResolutionsOrder)
{
bool bExistDefault = false;
+ m_fullPathCache.clear();
m_searchResolutionsOrderArray.clear();
for (std::vector<std::string>::const_iterator iter = searchResolutionsOrder.begin(); iter != searchResolutionsOrder.end(); ++iter)
{
@@ -573,6 +574,7 @@ const std::vector<std::string>& CCFileUtils::getSearchPaths()
void CCFileUtils::setSearchPaths(const std::vector<std::string>& searchPaths)
{
bool bExistDefaultRootPath = false;
+ m_fullPathCache.clear();
m_searchPathArray.clear();
for (std::vector<std::string>::const_iterator iter = searchPaths.begin(); iter != searchPaths.end(); ++iter)
@@ -620,6 +622,7 @@ void CCFileUtils::addSearchPath(const char* path_)
void CCFileUtils::setFilenameLookupDictionary(CCDictionary* pFilenameLookupDict)
{
+ m_fullPathCache.clear();
CC_SAFE_RELEASE(m_pFilenameLookupDict);
m_pFilenameLookupDict = pFilenameLookupDict;
CC_SAFE_RETAIN(m_pFilenameLookupDict);
diff --git a/cocos2dx/platform/CCPlatformMacros.h b/cocos2dx/platform/CCPlatformMacros.h
index 662bc9d..3b4e584 100755
--- a/cocos2dx/platform/CCPlatformMacros.h
+++ b/cocos2dx/platform/CCPlatformMacros.h
@@ -81,7 +81,7 @@ Basically,it's only enabled in android
It's new in cocos2d-x since v0.99.5
*/
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
- #define CC_ENABLE_CACHE_TEXTURE_DATA 0
+ #define CC_ENABLE_CACHE_TEXTURE_DATA 1
#else
#define CC_ENABLE_CACHE_TEXTURE_DATA 0
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment