Cocos2d-x 绘制字符串

1、绘制简单的字符串

1  CCLabelTTF* pLabel = CCLabelTTF::create("Hello World", "Arial", 24);
2         CC_BREAK_IF(! pLabel);
3 
4         // Get window size and place the label upper. 
5         CCSize size = CCDirector::sharedDirector()->getWinSize();
6         pLabel->setPosition(ccp(size.width / 2, size.height / 2));
7 
8         // Add the label to HelloWorld layer as a child layer.
9         this->addChild(pLabel, 1);

建立一个CCLabelTTF并添加到子节点即可。

 

posted @ 2013-03-14 15:58  【Winco】  阅读(237)  评论(0编辑  收藏  举报