两部分代码比较,所带来的问题,下面已解决
// position the label on the center of the screen
// bg->setPosition(Vec2(origin.x + visibleSize.width / 2,
// origin.y + visibleSize.height / 2));
// this->addChild(bg);
<span style="color:#ff0000;">auto bg = Sprite::create("background.png");
bg->setPosition(Vec2(visibleSize.width / 2, visibleSize.height / 2));</span>
<span style="color:#ff0000;background-color: rgb(204, 204, 204);"> this->addChild(bg);</span>
能正常显示!!

浙公网安备 33010602011771号