03:把文字和图片加入图层

来源:互联网 发布:非递归后序遍历c语言 编辑:程序博客网 时间:2024/06/06 01:00

   把文字加入图层

    CCLabelTTF*pLabel = CCLabelTTF::create("Hello World", "Arial", 24);

    pLabel->setPosition(ccp(origin.x+ visibleSize.width/2,

                        origin.y +visibleSize.height - pLabel->getContentSize().height));

 this->addChild(pLabel,1);


    

把图片加入图层

    CCSprite* pSprite = CCSprite::create("beijing.png");

    pSprite->setPosition(ccp(visibleSize.width/2+ origin.x,visibleSize.height/2 + origin.y));

    this->addChild(pSprite, 0);

原创粉丝点击