get whole screen size;add background

来源:互联网 发布:2017中国机电贸易数据 编辑:程序博客网 时间:2024/05/17 06:27
// get whole screen size 

CCSize size= CCDirector::sharedDirector()->getWinSize();

//add background

 CCSprite* uiBackground = CCSprite::create("main_background.png",CCRectMake(0, 0, 640, 960));
uiBackground->setPosition(ccp(size.width/2, size.height/2));
this->addChild(uiBackground, 0);       // the bottom layer

0 0