Created
October 11, 2012 12:50
-
-
Save kw0006667/3872076 to your computer and use it in GitHub Desktop.
Add sprite to your scene(.cpp)
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
// on "init" you need to initialize your instance | |
bool HelloWorld::init() | |
{ | |
////////////////////////////// | |
// 1. super init first | |
if ( !CCLayer::init() ) | |
{ | |
return false; | |
} | |
CCSize size = CCDirector::sharedDirector()->getWinSize(); | |
this->charlie = CCSprite::create("Charlie.png"); | |
// position the sprite on the center of the screen | |
this->charlie->setPosition( ccp(size.width/2, size.height/2) ); | |
// add the sprite as a child to this layer | |
this->addChild(pSprite, 0); | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment