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

    CCSprite *bg = CCSprite::create("HelloWorld.png");
bg->setPosition(ccp(size.width/,size.height/));//ccp CCPoint
this->addChild(bg); CCSprite *sp1 = CCSprite::create("icon.png");
sp1->setPosition(ccp(size.width*0.2,size.height*0.7));
this->addChild(sp1); CCSprite *sp2 = CCSprite::create("icon.png",CCRect(,,,));
sp2->setPosition(ccp(size.width*0.4, size.height*0.7));
this->addChild(sp2); CCTexture2D *texture = CCTextureCache::sharedTextureCache()->addImage("icon.png");//创建2d纹理 CCSprite *sp3 = CCSprite::createWithTexture(texture);
sp3->setPosition(ccp(size.width*0.6, size.height*0.7));
this->addChild(sp3); CCSprite *sp4 = CCSprite::createWithTexture(texture, CCRect(, , , ));
sp4->setPosition(ccp(size.width*0.8,size.height*0.7));
this->addChild(sp4); CCSpriteFrame *frame = CCSpriteFrame::create("icon.png",CCRect(,,,)); CCSprite *sp5 = CCSprite::createWithSpriteFrame(frame);//缓存帧
sp5->setPosition(ccp(size.width*0.3,size.height*0.3));
this->addChild(sp5);
sp5->setScale(0.5f);
sp5->setRotation(30.0f);//大于0顺时针小于0逆时针
sp5->setSkewX();//倾斜 以图片的中央位置进行倾斜
//sp5->setVisible(false);//不可见
//sp5->setColor(ccc3(255,0,0));
sp5->setOpacity();//0-255
sp5->setTexture(CCTextureCache::sharedTextureCache()->addImage("CloseNormal.png"));
/*
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("img.plist"); CCSprite *sp6 = CCSprite::createWithSpriteFrameName("icon.png");//缓存帧
sp6->setPosition(ccp(size.width*0.7,size.height*0.3));
this->addChild(sp6);
*/
05-11 13:59