相关几个重要的类的继承关系如下
1.所有文本框必须实现CCLabelProtocol接口
2.CCLableTTF比另外两个文本框渲染慢
3.CCLabelBMFont中每个文字相当于一个CCSprite,可以旋转,移动,改变尺寸等
下面列出基本的用法:(很多其他的用法请查阅官方的API文档)
// add a label shows "Hello World"
// create and initialize a label
CCLabelTTF* pLabel = CCLabelTTF::create("Hello World", "Arial", TITLE_FONT_SIZE);
// position the label on the center of the screen
pLabel->setPosition(ccp(origin.x + visibleSize.width/2,
origin.y + visibleSize.height - pLabel->getContentSize().height));
// add the label as a child to this layer
this->addChild(pLabel, 1);
CCLabelBMFont* label = CCLabelBMFont::create("configuration", "fonts/bitmapFontTest3.fnt");
CCLabelAtlas* labelAtlas = CCLabelAtlas::create("0123456789", "fonts/labelatlas.png", 16, 24, '.');