文本绘制

来源:互联网 发布:qq forpad网络链接错误 编辑:程序博客网 时间:2024/05/17 04:51

一般使用CCLabelTTF

四步骤:

1、初始化

2、检测

3、设置坐标点

4、加入当前图层

代码:

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




原创粉丝点击