Cocos2d-x is a suite of open-source, cross-platform, game-development tools utilized by millions of developers across the globe. Its core has evolved to serve as the foundation for Cocos Creator 1.x & 2.x.
// position the sprite on the center of the screen
newSprite->setPosition(Vec2(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
// add the sprite as a child to this layer
this->addChild(newSprite, 0);
On Android/Win32 (OpenGL), this is the output:
![image](https://user-images.githubusercontent.com/8603230/99973956-6d107f80-2df4-11eb-9825-1d8af17dae4b.png)
On Mac OS X/iOS (Metal) this is the output:
![image](https://user-images.githubusercontent.com/8603230/99973873-59fdaf80-2df4-11eb-9d7a-cc76e838547d.png)
They should both be the same.
@slackmoehrle As requested, adding you to this so you're notified about it. I'm not too familiar with the backend renderers, so I don't know the cause of this issue.
Steps to Reproduce:
Generate a new project as you normally would, like this:
cocos new gamename -p com.example.gamename -l cpp -d .
Change the code related to displaying the HelloWorld.png in
HelloWorldScene::init()
to this:auto* newSprite = Sprite::createWithTexture(renderTexture->getSprite()->getTexture());
// position the sprite on the center of the screen newSprite->setPosition(Vec2(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
// add the sprite as a child to this layer this->addChild(newSprite, 0);