override removeChild:
| 385 | |
| 386 | // override removeChild: |
| 387 | void ParticleBatchNode::removeChild(Node* aChild, bool cleanup) |
| 388 | { |
| 389 | // explicit nil handling |
| 390 | if (aChild == nullptr) |
| 391 | return; |
| 392 | |
| 393 | AXASSERT(dynamic_cast<ParticleSystem*>(aChild) != nullptr, |
| 394 | "CCParticleBatchNode only supports QuadParticleSystems as children"); |
| 395 | AXASSERT(_children.contains(aChild), "CCParticleBatchNode doesn't contain the sprite. Can't remove it"); |
| 396 | |
| 397 | ParticleSystem* child = static_cast<ParticleSystem*>(aChild); |
| 398 | |
| 399 | // remove child helper |
| 400 | _textureAtlas->removeQuadsAtIndex(child->getAtlasIndex(), child->getTotalParticles()); |
| 401 | |
| 402 | // after memmove of data, empty the quads at the end of array |
| 403 | _textureAtlas->fillWithEmptyQuadsFromIndex(_textureAtlas->getTotalQuads(), child->getTotalParticles()); |
| 404 | |
| 405 | // particle could be reused for self rendering |
| 406 | child->setBatchNode(nullptr); |
| 407 | Node::removeChild(child, cleanup); |
| 408 | |
| 409 | updateAllAtlasIndexes(); |
| 410 | } |
| 411 | |
| 412 | void ParticleBatchNode::removeChildAtIndex(int index, bool doCleanup) |
| 413 | { |
nothing calls this directly
no test coverage detected