cocos2dx SpriteBatchNode 精灵的渲染优化类

用处是减少对精灵的渲染次数,用法如下

1     SpriteFrameCache::getInstance()->addSpriteFramesWithFile("person.plist");
2     SpriteBatchNode *node = SpriteBatchNode::create("person.png");
3     bg->addChild(node);
4     
5     SpriteFrame *frame = SpriteFrameCache::getInstance()->getSpriteFrameByName("navigationbar_back.png");
6     Sprite *spt1 = Sprite::createWithSpriteFrame(frame);
7     
8     node->addChild(spt1);

 

posted @ 2015-12-20 13:07  我要开发游戏  阅读(674)  评论(0编辑  收藏  举报