Created
September 4, 2014 14:17
-
-
Save sag333ar/b7d64734610951e08e9a to your computer and use it in GitHub Desktop.
Create Sprite in Cocos2d-x
This file contains hidden or 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
// create the sprite | |
auto spriteLeft = Sprite::create("FortuneWheel.png"); | |
// get the texture size / image size | |
auto spriteLeftRect = spriteLeft->getTextureRect(); | |
// set the position of sprite | |
spriteLeft->setPosition(Vec2(visibleSize.width-spriteLeftRect.size.width/2-20 , spriteLeftRect.size.height/2+40)); | |
// add the sprite to scene-layer | |
this->addChild(spriteLeft, 4); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment