Reputation: 41
Hey I am crazy stuck on this. I want to use my cool heiro font sheet i got the CCLabelBMFont working great as labels and score variables but can't get them into the menu as clickable items! but it the CCLabelMBFont says specifically that you can use them as menu items -- see here:
Detailed Description
CCLabelBMFont is a subclass of CCSpriteBatchNode
Features:
* Treats each character like a CCSprite. This means that each individual character can be:
o rotated
o scaled
o translated
o tinted
o chage the opacity
* It can be used as part of a menu item.
* anchorPoint can be used to align the "label"
* Supports AngelCode text format
Yet i've looked all over the web and can't find one example of anybody getting a CCLabelBMFont as a menu item. Here's the code I have so far:
-(id) init { if( (self=[super init] )) {
CCLabelBMFont *homeTest = [CCLabelBMFont labelWithString:@"HomeTEST" fntFile:@"hieroTitle2.fnt"];
homeTest.position = ccp(0, 0);
//finalScoreFont.position = ccp(wrapper.position.x, wrapper.position.y-40);
[self addChild:homeTest z:2 tag:kTagHomeTest];
/* here's where I am lost and want to put the CCLabelBMFont
CCMenuItem *homeButton =
home.position = ccp(0, 0);
CCMenu *menu = [CCMenu menuWithItems:homeButton, nil];
menu.position = ccp(60, 50);
*/
[self addChild:menu z:3];
}
return self;
}
Upvotes: 1
Views: 2761
Reputation: 41
i found a clue and possible solution! Check out this guys code:
CCLabelBMFont *tlabel = [CCLabelBMFont labelWithString:@"Page 2" fntFile:@"customfont.fnt"];
CCMenuItemLabel *titem = [CCMenuItemLabel itemWithLabel:tlabel target:self selector:@selector(testCallback:)];
CCMenu *menu = [CCMenu menuWithItems: titem, nil];
menu.position = ccp(screenSize.width/2, screenSize.height/2);
Nice! he first makes the label and then uses that CCLabelBMFont
as the CCMenuItemLabel
Weeee! I would have never figured that out. I'm going to try it
Upvotes: 3