cocos2d-x 2.1.4的版本bug cocos2d-x android返回黑屏问题的

cocos2d-x 2.1.4 android版Home到桌面,然后重新返回游戏,会出现黑屏(Black Screen),声音一直在播放。这是2.1.4的一个bug,2.1.5解决了这个bug。但是由于种种原因,游戏不能立马更换2.1.5 sdk,就去github上找到了这个问题的解决日志。


修改的地方:

1.cocos2dx/platform/CCFileUtils.cpp
2. cocos2dx/platform/CCPlatformMacros.h
3.自己android程序 jni/main/main.cpp


cocos2dx/platform/CCFileUtils.cpp


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)

     {

@@ -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)

     {

@@ -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);

cocos2dx/platform/CCPlatformMacros.h

-#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


jni/hellocpp/main.cpp

AppDelegate *pAppDelegate = new AppDelegate();

         CCApplication::sharedApplication()->run();

     }

-    /*

     else

     {

         ccDrawInit();

@@ -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(); 

     }

-    */

 }


原文链接地址http://vincenttung.blog.51cto.com/6249439/1309727

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值