| 1118 | // MARK: visit, draw, transform |
| 1119 | |
| 1120 | void Sprite::addChild(Node* child, int zOrder, int tag) |
| 1121 | { |
| 1122 | AXASSERT(child != nullptr, "Argument must be non-nullptr"); |
| 1123 | if (child == nullptr) |
| 1124 | return; |
| 1125 | |
| 1126 | if (_renderMode == RenderMode::QUAD_BATCHNODE) |
| 1127 | { |
| 1128 | Sprite* childSprite = dynamic_cast<Sprite*>(child); |
| 1129 | AXASSERT(childSprite, "CCSprite only supports Sprites as children when using SpriteBatchNode"); |
| 1130 | AXASSERT(childSprite->getTexture() == _textureAtlas->getTexture(), |
| 1131 | "childSprite's texture name should be equal to _textureAtlas's texture name!"); |
| 1132 | // put it in descendants array of batch node |
| 1133 | _batchNode->appendChild(childSprite); |
| 1134 | |
| 1135 | if (!_reorderChildDirty) |
| 1136 | { |
| 1137 | setReorderChildDirtyRecursively(); |
| 1138 | } |
| 1139 | } |
| 1140 | // CCNode already sets isReorderChildDirty_ so this needs to be after batchNode check |
| 1141 | Node::addChild(child, zOrder, tag); |
| 1142 | } |
| 1143 | |
| 1144 | void Sprite::addChild(Node* child, int zOrder, std::string_view name) |
| 1145 | { |
nothing calls this directly
no test coverage detected