开发者

create a CCMenuItemLabel with a custom font file

开发者 https://www.devze.com 2023-04-10 07:29 出处:网络
I have a CCMenuitemLabel CCMenuItemLabel *startGame = [CCMenuItemLabel itemWithLabel:str target:self selector:@selector(startGamefn)];

I have a CCMenuitemLabel

  CCMenuItemLabel *startGame = [CCMenuItemLabel itemWithLabel:str target:self selector:@selector(startGamefn)];

and I was wondering how I would load a font file as you would do in CCLabelBMFont (example :

CCLabelBMFont *label = [CCLabelBMFont labelWithString:str fn开发者_开发知识库tFile:@"good_dog_plain_32.fnt"];

thanks


CCMenuItemLabel can accept CCLabelBMFont so you can just past the label object in the function call to CCMenuItemLabel:

CCLabelBMFont *label = [CCLabelBMFont labelWithString:str fntFile:@"good_dog_plain_32.fnt"];
CCMenuItemLabel *startGame = [CCMenuItemLabel itemWithLabel:label target:self selector:@selector(startGamefn)];
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号