| 2598 | } |
| 2599 | |
| 2600 | void SpriteHybrid::reparentSprite(float dt) |
| 2601 | { |
| 2602 | auto p1 = getChildByTag(kTagNode); |
| 2603 | auto p2 = getChildByTag(kTagSpriteBatchNode); |
| 2604 | |
| 2605 | Vector<Node*> retArray(250); |
| 2606 | |
| 2607 | if (_usingSpriteBatchNode) |
| 2608 | std::swap(p1, p2); |
| 2609 | |
| 2610 | ////----AXLOGD("New parent is: {:#x}", p2); |
| 2611 | |
| 2612 | auto& p1Children = p1->getChildren(); |
| 2613 | for (const auto& node : p1Children) |
| 2614 | { |
| 2615 | retArray.pushBack(node); |
| 2616 | } |
| 2617 | |
| 2618 | int i = 0; |
| 2619 | p1->removeAllChildrenWithCleanup(false); |
| 2620 | |
| 2621 | for (const auto& node : retArray) |
| 2622 | { |
| 2623 | p2->addChild(node, i, i); |
| 2624 | i++; |
| 2625 | } |
| 2626 | |
| 2627 | _usingSpriteBatchNode = !_usingSpriteBatchNode; |
| 2628 | } |
| 2629 | |
| 2630 | void SpriteHybrid::onExit() |
| 2631 | { |
nothing calls this directly
no test coverage detected