0

I have found one bug that causes the cocos2d view to stop rendering its contents. The bug can be reproduced using the example project found in Jpsarda's post about integration between UIKit and cocos2d-x. The link to the website is: http://jpsarda.tumblr.com/post/24983791554/mixing-cocos2d-x-uikit and the link to the project is: http://dl.dropbox.com/u/12856650/Cocos2dxOnUikit.zip.

To reproduce the bug it is sufficient to trigger several times between uikit views and cocos2d views by pressing repeatedly the "Cocos2d-x GO!" button on the first view followed by the "Close" button on the second view. I have also done a video that shows how to reproduce the bug: http://youtu.be/EIvf-Ao6u5I. The bug occurs only on a real device and not on the simulator. Because of this bug it is pretty difficult to create applications that allow the user to switch frequently between cocos2d views and uikit views such the one on which I am working. For the moment I can't understand the root cause and I haven't received a reply on the forum yet. Is there anyone that have an idea/intution/suggestion about the possible cause?

4

1 回答 1

0

我找到了原因。EAGLView 永远不会被释放,这会导致资源泄漏。要解决 JPSARDA 示例中的错误,添加以下行就足够了:

[[EAGLView sharedEGLView] 发布];

在 CCEGELView::release 方法的末尾。这将解决 JPSARDA(和我的应用程序:D)的问题,但该解决方案可能不适用于以不同方式处理 EAGLView 生命周期的项目

于 2012-12-09T22:19:49.540 回答