| 709 | // implementation SpriteSheet (TMXTiledMapExtension) |
| 710 | |
| 711 | void SpriteBatchNode::insertQuadFromSprite(Sprite* sprite, ssize_t index) |
| 712 | { |
| 713 | AXASSERT(sprite != nullptr, "Argument must be non-nullptr"); |
| 714 | AXASSERT(dynamic_cast<Sprite*>(sprite), "CCSpriteBatchNode only supports Sprites as children"); |
| 715 | |
| 716 | // make needed room |
| 717 | while (index >= _textureAtlas->getCapacity() || _textureAtlas->getCapacity() == _textureAtlas->getTotalQuads()) |
| 718 | { |
| 719 | this->increaseAtlasCapacity(); |
| 720 | } |
| 721 | // |
| 722 | // update the quad directly. Don't add the sprite to the scene graph |
| 723 | // |
| 724 | sprite->setBatchNode(this); |
| 725 | sprite->setAtlasIndex(static_cast<unsigned int>(index)); |
| 726 | |
| 727 | auto&& quad = sprite->getQuad(); |
| 728 | _textureAtlas->insertQuad(quad, index); |
| 729 | |
| 730 | // FIXME:: updateTransform will update the textureAtlas too, using updateQuad. |
| 731 | // FIXME:: so, it should be AFTER the insertQuad |
| 732 | sprite->setDirty(true); |
| 733 | sprite->updateTransform(); |
| 734 | } |
| 735 | |
| 736 | void SpriteBatchNode::updateQuadFromSprite(Sprite* sprite, ssize_t index) |
| 737 | { |
no test coverage detected