4
votes

i'm trying to create a simple game with COCO2d but no luck so far... when i'm trying to create a CCBitmapFontAtlas i get a error saying :

"_OBJC_CLASS_$_CCBitmapFontAtlas", referenced from:"

and also :

"'CCBitmapFontAtlas' is deprecated "

here is my header file:

@interface MainMenuScene : CCLayer 

{ CCBitmapFontAtlas* startNewGameLabel; }

  • (id) scene;

@end

and here is my implementation file :

#import "MainMenuScene.h"

@implementation MainMenuScene

  • (id) scene { CCScene scene = [CCScene node]; CCLayer layer = [MainMenuScene node]; [scene addChild:layer]; return scene;

}

-(id) init { if ((self = [super init])) { CCLOG(@"%@: %@", NSStringFromSelector(_cmd), self); [self setVisible:YES];

     startNewGameLabel = [CCBitmapFontAtlas 
                          bitmapFontAtlasWithString:@"New Game" 
                          fntFile:@"bitmapfont.fnt"]; 
                                    //[CCLabelTTF labelWithString:@"New Game" 
                                    //                 fontName:@"AppleGothic" 
                                    //                 fontSize:48];
    CGSize size = [[CCDirector sharedDirector] winSize];
    startNewGameLabel.position = CGPointMake(size.width / 2, size.height / 2);
    [self addChild:startNewGameLabel];

}
return self;

}

  • (void) dealloc { CCLOG(@"%@: %@", NSStringFromSelector(_cmd), self);

    [super dealloc]; } @end

I created both .FNT file and .PNG file with heir

2

2 Answers

7
votes

You want CCLabelBMFont instead of CCBitmapFontAtlas.

startNewGameLabel = [CCLabelBMFont
                      labelWithString:@"New Game" 
                      fntFile:@"bitmapfont.fnt"]; 
1
votes

Use CCLabelBMFont instead. Will be removed 1.0.1