views:

19

answers:

1

Hello, i'm using cocos2d to make an ipad app and i'm just starting out.

So i added a label to my HelloWorld scene and when i tested it out it was really slow. Like i was getting 30 - 40 fps out of 60. i figured out that label's size that was causing the drop in fps. it is a fontsize 128when this happens and i'm just wondering if cclabels are supposed to be this slow or i am doing something wrong. here is my code:

CGSize screenSize = [[CCDirector sharedDirector] winSize];

_label = [CCLabel labelWithString:@"Hello World!" fontName:@"Marker Felt" fontSize:128];
_label.position = ccp(screenSize.width, screenSize.height);
_label.color = ccc3(0, 0, 0);
[self addChild: _label];

any feedback is appreciated

A: 

I don't even know what CCLabel is but I was curious so googled it and found this warning in CCLabel.h:

  • @warning Changing the string is as expensive as creating a new CCLabel. To obtain better performance use CCLabelAtlas

And CCLabelAtlas docs say:

  • It can be as a replacement of CCLabel since it is MUCH faster.
progrmr
yeah, sorry. CCLabel is a label used in the cocos2d engine. However, i am not changing the string unless there is something going on behind the scenes that is changing it. i have indeed seen that class references for both CCLabel and CCLabelAtlas but i dont really have a large font image to compare CCLabel to CCLabelAtlas
Petey_Pii
Have you looked at the [Improving Performance section](http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:best_practices)?
progrmr