I tested it in SpriteTest exmaple (0.99.5 beta2, iPad, device release, armv7 ). I changed codes like:
(Note! CCSpriteSheet was renamed CCSpriteBatchNode in 0.99.5 )
@implementation SpriteBatchNodeAnchorPoint
....
for(int i=0;i<100;i++) {
// CCSprite *sprite = [CCSprite spriteWithTexture:batch.texture rect:CGRectMake(85*i, 121*1, 85, 121)];
// sprite.position = ccp( s.width/4*(i+1), s.height/2);
CCSprite *sprite = [CCSprite spriteWithTexture:batch.texture rect:CGRectMake(85*1, 121*1, 85, 121)];
if (!(i%20)){
height += s.height/5;
width = 0;
}
else{
width++;
}
sprite.position = ccp( width*(s.width/20), height);
CCSprite *point = [CCSprite spriteWithFile:@"r1.png"];
point.scale = 0.25f;
point.position = sprite.position;
[self addChild:point z:1];
switch(i) {
case 0:
sprite.anchorPoint = CGPointZero;
break;
case 1:
sprite.anchorPoint = ccp(0.5f, 0.5f);
break;
case 2:
sprite.anchorPoint = ccp(1,1);
break;
}
point.position = sprite.position;
id copy = [[action copy] autorelease];
[sprite runAction:copy];
[self addChild:sprite z:i];
// [batch addChild:sprite z:i];
}
I drawed 100 sprites in the screen. I tested '[self addChild:sprite z:i]' and '[batch addChild:sprite z:i]' separately. The fps are same, about 60. Then I add a big background image:
CCSprite *sp = [CCSprite spriteWithFile:@"GameBackground.png"];
sp.anchorPoint = CGPointZero;
[self addChild:sp z:0 tag:1];
It's about 32 fps with '[self addChild:sprite z:i]', and about 25 fps with '[batch addChild:sprite z:i]'. Why so different?
All the examples tell us to add sprites to CCSpriteBatchNode. But the result of test tell adding it to CCSpriteBatchNode will slow your frame rate. I am confused now.