1

私は cocos2d-x 2.1.4 の新しいバージョンを学習しており、cocos2d を x バージョンに移植しています。このセクションを移植したいと考えています。

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 ???();

ここを読む: http://www.cocos2d-x.org/projects/cocos2dx/wiki/API_Change_List_from_v1x_to_2x?version=2

CCSprite::spriteWithBatchNode(...) は削除されました。使用してください: sprite = CCSprite::spriteWithTexture(batchNode->getTexture(), CCRect*); batchNode->addChild(スプライト); 代わりは

しかし、CCSprite には spriteWithTexture がありません。置換とは何ですか?

4

2 に答える 2

3

Well You can use this. They have modified the function calls

CCSprite *pSprite = CCSprite::createWithTexture(pTexture, rect);
于 2013-06-19T08:50:29.867 に答える