预加载+CCSpriteBatchNode + CCSpriteFrameCache

  /////////////////-------------------  2-22-13 14:20 ------------

//添加plist
 CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("showroom.plist",
  CCTextureCache::sharedTextureCache()->addImage("showroom.png"));
 //去纹理
 CCTexture2D * tex = CCTextureCache::sharedTextureCache()->textureForKey("showroom.png");
 CCSpriteBatchNode *batchNode = CCSpriteBatchNode::createWithTexture(tex);
 addChild(batchNode);

//////////////---------------------------我是 分割线 ---------------------------

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);    //注意这里就好了

posted @ 2013-02-22 09:26  JaoYE  阅读(1803)  评论(0编辑  收藏  举报