CCSize size = CCDirector::sharedDirector()->getWinSize();
CCSprite* pSprite = CCSprite::create("bg.jpg");
pSprite->setPosition(ccp(size.width/2, size.height/2));
float winw = size.width; //获取屏幕宽度
float winh = size.height;//获取屏幕高度
float spx = pSprite->getTextureRect().getMaxX();
float spy = pSprite->getTextureRect().getMaxY();
pSprite->setScaleX(winw/spx); //设置精灵宽度缩放比例
pSprite->setScaleY(winh/spy);