关于cocos2d-x 3.0 new render batchnode

关于cocos2d-x 3.0 new render batchnode

这几天cocos2d-x 放出了新的render

说是有auto-batch功能

看了test code

坑爹的还是一样阿还是一样要建立SpriteBatchNode. 再把Sprite加进去阿
auto batch的功能​​呢 还是我看错地方阿

//----------------------------------------------------------------------------------
//-------- New Sprite Batch Test

NewSpriteBatchTest::NewSpriteBatchTest()
{
auto touchListener = EventListenerTouchAllAtOnce::create();
touchListener->onTouchesEnded = CC_CALLBACK_2(NewSpriteBatchTest::onTouchesEnded, this);
_eventDispatcher->addEventListenerWithSceneGraphPriority(touchListener, this);

auto BatchNode = SpriteBatchNode::create("Images/grossini_dance_atlas.png", 50);
addChild(BatchNode, 0, kTagSpriteBatchNode);

}

NewSpriteBatchTest::~NewSpriteBatchTest()
{

}

std::string NewSpriteBatchTest::title() const
{
return “NewRender”;
}

std::string NewSpriteBatchTest::subtitle() const
{
return “SpriteBatchTest”;
}

void NewSpriteBatchTest::onTouchesEnded(const std::vector<Touch *> &touches, Event *event)
{
for (auto &touch : touches)
{
auto location = touch->getLocation();
addNewSpriteWithCoords(location);
}
}

void NewSpriteBatchTest::addNewSpriteWithCoords(Point p)
{
auto BatchNode = static_cast<SpriteBatchNode*>( getChildByTag(kTagSpriteBatchNode) );

int idx = (int) (CCRANDOM_0_1() * 1400 / 100);
int x = (idx%5) * 85;
int y = (idx/5) * 121;




auto sprite = Sprite::createWithTexture(BatchNode->getTexture(), Rect(x,y,85,121));
BatchNode->addChild(sprite);


sprite->setPosition( Point( p.x, p.y) );


ActionInterval* action;
float random = CCRANDOM_0_1();


if( random < 0.20 )
    action = ScaleBy::create(3, 2);
else if(random < 0.40)
    action = RotateBy::create(3, 360);
else if( random < 0.60)
    action = Blink::create(1, 3);
else if( random < 0.8 )
    action = TintBy::create(2, 0, -255, -255);
else
    action = FadeOut::create(2);


auto action_back = action->reverse();
auto seq = Sequence::create(action, action_back, NULL);


sprite->runAction( RepeatForever::create(seq));

}

//---------------------------------------------------------------------------------------------

auto batch 在哪呢