ios - cocos2d iPad 设置时崩溃 [_director displayStats :NO]

标签 ios ipad cocos2d-iphone

我刚刚完成了一个 cocos2d iPad 应用程序的快速原型(prototype)初稿。我没有修改CCTextureAtlas.m文件。

我离开时应用程序运行良好 [director_ setDisplayStats:YES]AppDelegate ,但如果我删除该行或替换 [director_setDisplayStats:NO] ,它在 CCTextureAtlas.m 中崩溃.
-(void) drawNumberOfQuads: (NSUInteger) n fromIndex: (NSUInteger) start在第 522 行,内容如下:
glDrawElements(GL_TRIANGLES, (GLsizei) n*6, GL_UNSIGNED_SHORT, (GLvoid*) (start*6*sizeof(_indices[0])) );
供引用,[director_ setDisplayStats:YES]位于 AppDelegate.m 的第 154 行.

应用原型(prototype)的完整源代码位于此处:

https://github.com/GameAid/Toddler-Taxonomist

对于那些可能查看代码的人来说,点击开始后,BoardLayer是协调大部分工作和屏幕上显示内容的主要节点。

对于我的一生,我无法弄清楚我在做什么导致这成为一个问题。起初,我怀疑我使用 [[CCTextureCache sharedCache] removeUnusedTextures] (在'BoardLayer'中)是一个问题,但现在我认为它没有任何区别。

这是出现在 Xcode 中的调用堆栈:

enter image description here

关于如何解决这个问题的任何想法?

最佳答案

BoardLayer.m , 我用的是 [self removeAllChildrenWithCleanup:YES] ,这似乎是导致问题的原因。当我将其更改为简单的 [self removeAllChildren] ,当 [director_ setShowStats:NO] 时一切正常到位。

我不确定这种冲突的性质是什么——它似乎处于低 OpenGL 级别——但它已在我的代码中修复。

关于ios - cocos2d iPad 设置时崩溃 [_director displayStats :NO],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16137454/

相关文章:

ios - 如何通过命令行/使用 shell 脚本在项目中安装配置文件和证书

iphone - 获取 writeToFile :atomically: URL saved to

ios - 在 Cocos2d 中加载 multipack spritesheet 时找不到文件

ios - iOS Swift 上的 Azure 推送通知

ios - 如何动态设置uibutton的标签颜色和对齐方式

ios - 将标签连接到 UITableViewCell

android - android中的水波纹效果

ios - Paypal 集成 iOS 8 应用程序

iPad CSS3 webkitTransform 和触摸事件 - 轻微的无法解释的口吃

ios - NSObject 可能无法响应 'onEnter'(在 AppDelegate 中使用 iAd 时)