本文整理汇总了C++中ParticleSystem::_setZOrder方法的典型用法代码示例。如果您正苦于以下问题:C++ ParticleSystem::_setZOrder方法的具体用法?C++ ParticleSystem::_setZOrder怎么用?C++ ParticleSystem::_setZOrder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParticleSystem
的用法示例。
在下文中一共展示了ParticleSystem::_setZOrder方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: reorderChild
// Reorder will be done in this function, no "lazy" reorder to particles
void ParticleBatchNode::reorderChild(Node * aChild, int zOrder)
{
CCASSERT( aChild != NULL, "Child must be non-NULL");
CCASSERT( dynamic_cast<ParticleSystem*>(aChild) != NULL, "CCParticleBatchNode only supports QuadParticleSystems as children");
CCASSERT( _children->containsObject(aChild), "Child doesn't belong to batch" );
ParticleSystem* child = static_cast<ParticleSystem*>(aChild);
if( zOrder == child->getZOrder() )
{
return;
}
// no reordering if only 1 child
if( _children->count() > 1)
{
unsigned int newIndex = 0, oldIndex = 0;
getCurrentIndex(&oldIndex, &newIndex, child, zOrder);
if( oldIndex != newIndex )
{
// reorder _children->array
child->retain();
_children->removeObjectAtIndex(oldIndex);
_children->insertObject(child, newIndex);
child->release();
// save old altasIndex
int oldAtlasIndex = child->getAtlasIndex();
// update atlas index
updateAllAtlasIndexes();
// Find new AtlasIndex
int newAtlasIndex = 0;
for( int i=0;i < _children->count();i++)
{
ParticleSystem* pNode = (ParticleSystem*)_children->getObjectAtIndex(i);
if( pNode == child )
{
newAtlasIndex = child->getAtlasIndex();
break;
}
}
// reorder textureAtlas quads
_textureAtlas->moveQuadsFromIndex(oldAtlasIndex, child->getTotalParticles(), newAtlasIndex);
child->updateWithNoTime();
}
}
child->_setZOrder(zOrder);
}