Throughout this book, we've been making use of a number of different label types. In this recipe, we will briefly explain the three commonly used label classes: CCLabelAtlas
, CCLabelBMFont
,
and CCLabelTTF
.
Execute the following code:
@implementation Ch5_UsingCCLabel -(CCLayer*) runRecipe { [super runRecipe]; //CCLabelAtlas for fixed-width bitmap fonts CCLabelAtlas *labelAtlas = [CCLabelAtlas labelWithString:@"Atlas Label Test" charMapFile:@"tuffy_bold_italic-charmap.png" itemWidth:48 itemHeight:65 startCharMap:' ']; [self addChild:labelAtlas z:0]; labelAtlas.anchorPoint = ccp(0.5f,0.5f); labelAtlas.scale = 0.5f; labelAtlas.position = ccp(240,220); [labelAtlas setColor:ccc3(0,255,0)]; [labelAtlas runAction:[CCRepeatForever actionWithAction: [CCSequence actions: [CCScaleTo actionWithDuration:1.0f scale:0.5f], [CCScaleTo actionWithDuration:1.0f...