用处是减少对精灵的渲染次数,用法如下
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);
时间: 2024-11-06 10:32:19