Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cocos2d iphone 菜单项的CCLabelBMFont?_Cocos2d Iphone - Fatal编程技术网

Cocos2d iphone 菜单项的CCLabelBMFont?

Cocos2d iphone 菜单项的CCLabelBMFont?,cocos2d-iphone,Cocos2d Iphone,嘿,我被这个迷住了。我想用我很酷的heiro字体表,我得到的CCLabelBMFont作为标签和分数变量工作得很好,但不能将它们作为可点击的项目进入菜单!但是CCLabelMBFont特别指出,您可以将它们用作菜单项--请参见此处: 详细说明 CCLabelBMFont是CCSpriteBatchNode的一个子类 特点: * Treats each character like a CCSprite. This means that each individual character can

嘿,我被这个迷住了。我想用我很酷的heiro字体表,我得到的CCLabelBMFont作为标签和分数变量工作得很好,但不能将它们作为可点击的项目进入菜单!但是CCLabelMBFont特别指出,您可以将它们用作菜单项--请参见此处:

详细说明

CCLabelBMFont是CCSpriteBatchNode的一个子类

特点:

* 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

然而,我在网络上到处寻找,却找不到任何人将CCLabelBMFont作为菜单项的例子。以下是我目前掌握的代码:

-(id)init { if((self=[super init])){


}

我找到了线索和可能的解决方案!请查看以下代码:

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);
很好!他先做了标签,然后用
CCLabelBMFont
作为
CCMenuItemLabel
Weeee!我永远也想不到。我要试试

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