gpt4 book ai didi

iphone - Coco2d - 使用 CCBitmapFontAtlas

转载 作者:太空狗 更新时间:2023-10-30 04:00:40 24 4
gpt4 key购买 nike

我正在尝试使用 COCO2d 创建一个简单的游戏,但到目前为止运气不佳......当我尝试创建 CCBitmapFontAtlas 时,我收到一条错误消息:

“_OBJC_CLASS_$_CCBitmapFontAtlas”,引用自:“

还有:

“‘CCBitmapFontAtlas’已弃用”

这是我的头文件:

@interface MainMenuScene : CCLayer 

{ CCBitmapFontAtlas* startNewGameLabel;

  • (id) 场景;

@结束

这是我的实现文件:

#import "MainMenuScene.h"

@implementation MainMenuScene

  • (id) 场景{CCScene scene = [CCScene 节点];CCLayer layer = [MainMenuScene 节点];[场景 addChild:layer];返回场景;

-(id) 初始化{ 如果(( self = [ super 初始化])) { CCLOG(@"%@: %@", NSStringFromSelector(_cmd), self); [ self 设置可见:是];

     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) 释放{CCLOG(@"%@: %@", NSStringFromSelector(_cmd), self);

    [ super 释放];}@结束

我用 heir 创建了 .FNT 文件和 .PNG 文件

最佳答案

你想要CCLabelBMFont而不是 CCBitmapFontAtlas。

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

关于iphone - Coco2d - 使用 CCBitmapFontAtlas,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4692376/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com