MCPcopy Create free account
hub / github.com/axmolengine/axmol / removeChild

Method removeChild

core/2d/ParticleBatchNode.cpp:387–410  ·  view source on GitHub ↗

override removeChild:

Source from the content-addressed store, hash-verified

385
386// override removeChild:
387void 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
412void ParticleBatchNode::removeChildAtIndex(int index, bool doCleanup)
413{

Callers

nothing calls this directly

Calls 6

removeQuadsAtIndexMethod · 0.80
getTotalParticlesMethod · 0.80
getTotalQuadsMethod · 0.80
containsMethod · 0.45
setBatchNodeMethod · 0.45

Tested by

no test coverage detected