Created
May 19, 2016 11:24
-
-
Save indatawetrust/d04611d445a4ef7fc53cec3d038c3913 to your computer and use it in GitHub Desktop.
cocos2d-x sprite center position
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Size visibleSize = Director::getInstance()->getVisibleSize(); | |
Vec2 origin = Director::getInstance()->getVisibleOrigin(); | |
auto sprite = Sprite::create("ball.png"); | |
sprite->setPosition(Vec2(visibleSize.width / 2 + origin.x, | |
visibleSize.height / 2 + origin.y)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment