Yan*_*niv 4 iphone xcode objective-c cocos2d-iphone
我正在尝试使用COCO2d创建一个简单的游戏,但到目前为止没有运气......当我正在尝试创建CCBitmapFontAtlas时,我收到一条错误消息:
"_OBJC_CLASS _ $ _ CCBitmapFontAtlas",引自:"
并且 :
"'CCBitmapFontAtlas'已被弃用"
这是我的头文件:
@interface MainMenuScene : CCLayer
Run Code Online (Sandbox Code Playgroud)
{CCBitmapFontAtlas*startNewGameLabel; }
@结束
这是我的实现文件:
#import "MainMenuScene.h"
Run Code Online (Sandbox Code Playgroud)
@implementation MainMenuScene
}
- (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;
Run Code Online (Sandbox Code Playgroud)
}
(void)dealloc {CCLOG(@"%@:%@",NSStringFromSelector(_cmd),self);
[super dealloc]; } @结束
我用继承人创建了.FNT文件和.PNG文件
您想要CCLabelBMFont而不是CCBitmapFontAtlas.
startNewGameLabel = [CCLabelBMFont
labelWithString:@"New Game"
fntFile:@"bitmapfont.fnt"];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2110 次 |
| 最近记录: |