Skip to content

Commit

Permalink
[2.1.5] Fixing black screen on android. Refer to cocos2d#3117 .
Browse files Browse the repository at this point in the history
  • Loading branch information
James Chen committed Aug 21, 2013
1 parent 91a6ddb commit 2bb2211
Show file tree
Hide file tree
Showing 11 changed files with 5 additions and 20 deletions.
5 changes: 4 additions & 1 deletion cocos2dx/platform/CCFileUtils.cpp
Expand Up @@ -654,6 +654,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)
{
Expand Down Expand Up @@ -694,7 +695,8 @@ 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)
{
Expand Down Expand Up @@ -741,6 +743,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);
Expand Down
2 changes: 1 addition & 1 deletion cocos2dx/platform/CCPlatformMacros.h
Expand Up @@ -80,7 +80,7 @@ Basically, it's only enabled for Emscripten.
It's new in cocos2d-x since v0.99.5
*/
#if (CC_TARGET_PLATFORM == CC_PLATFORM_EMSCRIPTEN)
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_EMSCRIPTEN)
#define CC_ENABLE_CACHE_TEXTURE_DATA 1
#else
#define CC_ENABLE_CACHE_TEXTURE_DATA 0
Expand Down
Expand Up @@ -28,7 +28,6 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
AppDelegate *pAppDelegate = new AppDelegate();
CCApplication::sharedApplication()->run();
}
/*
else
{
ccDrawInit();
Expand All @@ -39,7 +38,6 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL);
CCDirector::sharedDirector()->setGLDefaultValues();
}
*/
}

}
2 changes: 0 additions & 2 deletions samples/Cpp/SimpleGame/proj.android/jni/hellocpp/main.cpp
Expand Up @@ -30,7 +30,6 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
AppDelegate *pAppDelegate = new AppDelegate();
CCApplication::sharedApplication()->run();
}
/*
else
{
ccDrawInit();
Expand All @@ -41,7 +40,6 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL);
CCDirector::sharedDirector()->setGLDefaultValues();
}
*/
}

}
2 changes: 0 additions & 2 deletions samples/Cpp/TestCpp/proj.android/jni/testcpp/main.cpp
Expand Up @@ -30,7 +30,6 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
AppDelegate *pAppDelegate = new AppDelegate();
CCApplication::sharedApplication()->run();
}
/*
else
{
ccDrawInit();
Expand All @@ -41,7 +40,6 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL);
CCDirector::sharedDirector()->setGLDefaultValues();
}
*/
}

}
Expand Up @@ -30,7 +30,6 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
AppDelegate *pAppDelegate = new AppDelegate();
CCApplication::sharedApplication()->run();
}
/*
else
{
ccDrawInit();
Expand All @@ -41,7 +40,6 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL);
CCDirector::sharedDirector()->setGLDefaultValues();
}
*/
}

}
Expand Up @@ -30,7 +30,6 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
AppDelegate *pAppDelegate = new AppDelegate();
CCApplication::sharedApplication()->run();
}
/*
else
{
ccDrawInit();
Expand All @@ -41,7 +40,6 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL);
CCDirector::sharedDirector()->setGLDefaultValues();
}
*/
}

}
Expand Up @@ -30,7 +30,6 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
AppDelegate *pAppDelegate = new AppDelegate();
CCApplication::sharedApplication()->run();
}
/*
else
{
ccDrawInit();
Expand All @@ -41,7 +40,6 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL);
CCDirector::sharedDirector()->setGLDefaultValues();
}
*/
}

}
Expand Up @@ -30,7 +30,6 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
AppDelegate *pAppDelegate = new AppDelegate();
CCApplication::sharedApplication()->run();
}
/*
else
{
ccDrawInit();
Expand All @@ -41,7 +40,6 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL);
CCDirector::sharedDirector()->setGLDefaultValues();
}
*/
}

}
Expand Up @@ -30,7 +30,6 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
AppDelegate *pAppDelegate = new AppDelegate();
CCApplication::sharedApplication()->run();
}
/*
else
{
ccDrawInit();
Expand All @@ -41,7 +40,6 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL);
CCDirector::sharedDirector()->setGLDefaultValues();
}
*/
}

}
Expand Up @@ -30,7 +30,6 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
AppDelegate *pAppDelegate = new AppDelegate();
CCApplication::sharedApplication()->run();
}
/*
else
{
ccDrawInit();
Expand All @@ -41,7 +40,6 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL);
CCDirector::sharedDirector()->setGLDefaultValues();
}
*/
}

}

0 comments on commit 2bb2211

Please sign in to comment.