where is spriteWithTexture in version 2.1.4 ?


#1

Im learning the new version of cocos2d-x 2.1.4
im porting cocos2d to x version , i want to port this section :

@ spriteSheet = [CCSpriteBatchNode
batchNodeWithFile:"foo.gif"]; player = [CCSprite spriteWithBatchNode:spriteSheet rect:CGRectMake(0, 0, 30, 56)];

spritSheet = CCSpriteBatchNode::create("foo.gif"); player = CCSprite::??? which function here ???();

reading here : [[http://www.cocos2d-x.org/projects/cocos2d-x/wiki/API_Change_List_from_v1x_to_2x?version=2]]

CCSprite::spriteWithBatchNode(…) is removed, please use: sprite = CCSprite::spriteWithTexture(batchNode~~>getTexture, CCRect*); batchNode~~>addChild(sprite); instead

but there is no spriteWithTexture in CCSprite
what is replacement ?


#2

Use this,

CCSprite::createWithTexture(CCTexture2D *pTexture, const CCRect& rect)


#3

Thanks