图片没有全覆盖Size mywinsize=Director::getInstance()->getWinSize(); float winw = mywinsize.width;float winh = mywinsize.height;float spx = backImg->getTextureRect().getMaxX();
float spy = backImg->getTextureRect().getMaxY();
backImg->setScaleX(winw/spx);
backImg->setScaleY(winh/spy);
float spy = backImg->getTextureRect().getMaxY();
backImg->setScaleX(winw/spx);
backImg->setScaleY(winh/spy);
如果小伙伴发现你的onscheduleUpddate不起作用的话 是因为没有进入你的update()函数 此时你应该先调用一个onEnter()的方法才能进入你的update()函数
已采纳回答 / wyt1996
void HelloWorld::setBackGround(const char *filename){ if(backImg == 0){ backImg=Sprite::create(filename); backImg->setAnchorPoint(Point::ZERO); backImg->setPosition(Point::ZERO); Size mywinsize=Director::getInstance()-...
2017-04-21