预加载+CCSpriteBatchNode + CCSpriteFrameCache

来源:互联网 发布:ubuntu 16.04安装软件 编辑:程序博客网 时间:2024/05/17 07:23

CCTexture2D *texture = CCTextureCache::sharedTextureCache()->addImage("showroom.png");

 

CCSpriteBatchNode *batchNode = CCSpriteBatchNode::createWithTexture(texture);


addChild(batchNode);


 CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("showroom.plist",texture);

 

CCSprite * pSpBracket1 = CCSprite::createWithSpriteFrameName("bracket4.png");  

pSpBracket1->setAnchorPoint(CCPointZero);  

pSpBracket1->setPosition(ccp(100,768-728));  

batchNode->addChild(pSpBracket1);  //注意这里就好了

 

 CCSprite * pSpBracket2 = CCSprite::createWithSpriteFrameName("bracket5.png");  

pSpBracket2->setAnchorPoint(CCPointZero);  

pSpBracket2->setPosition(ccp(320,768-490));

 batchNode->addChild(pSpBracket2);    //注意这里就好了

0 0
原创粉丝点击