Cocos2d iphone Cocos2D-重新声明帧缓存?
我已在我的主要课堂上声明:Cocos2d iphone Cocos2D-重新声明帧缓存?,cocos2d-iphone,Cocos2d Iphone,我已在我的主要课堂上声明: [[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"atlas.plist"]; CCSpriteBatchNode *batchNode = [CCSpriteBatchNode batchNodeWithFile:@"atlas.png"]; 现在我在另一个类上,我想创建一个新的batchNode,但是从atlas获取SpriteFrame,这是在主类上声明的。我该怎么做?
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"atlas.plist"];
CCSpriteBatchNode *batchNode = [CCSpriteBatchNode batchNodeWithFile:@"atlas.png"];
现在我在另一个类上,我想创建一个新的batchNode,但是从atlas获取SpriteFrame,这是在主类上声明的。我该怎么做?我需要在我的另一节课上再写同样的句子吗?这样,我是否将冗余图像导入到SharedPriteFrameCache?我的想法是节省内存,而不是浪费
有什么线索吗?谢谢。您不需要调用
[[CCSpriteFrameCache sharedSpriteFrameCache]addSpriteFramesWithFile:@“atlas.plist”]代码>再次假设您尚未删除这些精灵帧
您需要创建另一个批处理节点来放置精灵
如果要再次尝试将精灵帧添加到缓存中,则不会浪费空间,精灵帧只会添加一次,但在cocos2D解析文件并确定每个精灵帧是否确实已添加时,会浪费时间。谢谢。这就是我需要的!