CCLabelBMFont

CCLabelTTF: 使用系统字体,每个字符串会生成一个纹理,显示效率比较低下,适合不变化的文字

CCLabelAtlas: 使用NodeAtlas优化渲染,适合经常变化的数字,比如分数,金钱之类的数字,直接使用图片,将文字画在图片上

CCLabelBMFont的作用就是:处理不等长的复杂各种字体

bool T02Layers ::init()
{
       if (! CCLayer::init())
       {
               return false;
       }
        CCSize winSize = CCDirector::sharedDirector()->getWinSize();
        CCPoint ptCenter = ccp(winSize.width / 2, winSize.height / 2);
        CCLabelBMFont* label = CCLabelBMFont ::create("china\nchangchun\njida" , "bitmapFontTest.fnt" );
       label->setPosition(ptCenter);
       addChild(label);
#if 0
        //得到第一个孩子并且顺时针旋转90度后放大2倍
       CCArray* arr = label->getChildren();
       CCSprite* spriteA = (CCSprite*)arr->objectAtIndex(0);
       spriteA->setRotation(90);
       spriteA->setScale(2);
#endif
       return true;
}







posted @ 2015-05-26 17:01  外禅内定,程序人生  阅读(370)  评论(0编辑  收藏  举报