您的位置:首页 > 移动开发 > Cocos引擎

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

2013-12-26 10:01 477 查看
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();

}

-    */

}


原文链接地址/article/7325960.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐