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

Method addChildHelper

core/2d/ParticleBatchNode.cpp:233–260  ·  view source on GitHub ↗

don't use lazy sorting, reordering the particle systems quads afterwards would be too complex FIXME: research whether lazy sorting + freeing current quads and calloc a new block with size of capacity would be faster FIXME: or possibly using vertexZ for reordering, that would be fastest this helper is almost equivalent to Node's addChild, but doesn't make use of the lazy sorting

Source from the content-addressed store, hash-verified

231// FIXME: or possibly using vertexZ for reordering, that would be fastest
232// this helper is almost equivalent to Node's addChild, but doesn't make use of the lazy sorting
233int ParticleBatchNode::addChildHelper(ParticleSystem* child, int z, int aTag, std::string_view name, bool setTag)
234{
235 AXASSERT(child != nullptr, "Argument must be non-nil");
236 AXASSERT(child->getParent() == nullptr, "child already added. It can't be added again");
237
238 _children.reserve(4);
239
240 // don't use a lazy insert
241 auto pos = searchNewPositionInChildrenForZ(z);
242
243 _children.insert(pos, child);
244
245 if (setTag)
246 child->setTag(aTag);
247 else
248 child->setName(name);
249
250 child->setLocalZOrder(z);
251
252 child->setParent(this);
253
254 if (_running)
255 {
256 child->onEnter();
257 child->onEnterTransitionDidFinish();
258 }
259 return pos;
260}
261
262// Reorder will be done in this function, no "lazy" reorder to particles
263void ParticleBatchNode::reorderChild(Node* aChild, int zOrder)

Callers

nothing calls this directly

Calls 9

setTagMethod · 0.80
getParentMethod · 0.45
reserveMethod · 0.45
insertMethod · 0.45
setNameMethod · 0.45
setLocalZOrderMethod · 0.45
setParentMethod · 0.45
onEnterMethod · 0.45

Tested by

no test coverage detected