【发布时间】:2012-06-13 04:05:53
【问题描述】:
我正在尝试通过使用 CCSpriteBatchNode 来减少 OpenGL 调用次数和内存使用量。
我需要使用此代码创建一个 CCMenu:
CCSpriteBatchNode *batchNode = [CCSpriteBatchNode batchNodeWithFile:@"atlasGeral.png"];
CCSprite *inputNormal = [CCSprite spriteWithSpriteFrameName:@"normalInput.png"];
CCSprite *inputPressed = [CCSprite spriteWithSpriteFrameName:@"PressedInput.png"];
[batchNode addChild:inputNormal];
[batchNode addChild:inputPressed];
CCMenuItem *input =
[CCMenuItemSprite itemWithNormalSprite:inputNormal
selectedSprite:inputPressed
target:self
selector:@selector(InputMenu:)];
CCMenu *mInputMenu = [CCMenu menuWithItems:input, nil];
这是灾难性的崩溃,消息 Assertion failure in -[CCMenuItemSprite addChild:z:tag:]
有什么线索吗?顺便说一句,有人可以创建或指向一些教程来体面地解释如何将此 CCSpriteBatchNode 与这些其他元素(如 CCMenus、CCMenuItems 和其他美女)一起使用吗? Cocos2D 几乎没有关于所有最重要特性的文档。
谢谢。
【问题讨论】:
标签: cocos2d-iphone