ahoura
ahoura

Reputation: 689

create a CCMenuItemLabel with a custom font file

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 fntFile:@"good_dog_plain_32.fnt"];

thanks

Upvotes: 2

Views: 3053

Answers (1)

Lukman
Lukman

Reputation: 19164

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)];

Upvotes: 5

Related Questions