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

Method setBatchNode

core/2d/Sprite.cpp:1642–1673  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1640}
1641
1642void Sprite::setBatchNode(SpriteBatchNode* spriteBatchNode)
1643{
1644 _batchNode = spriteBatchNode; // weak reference
1645
1646 // self render
1647 if (!_batchNode)
1648 {
1649 if (_renderMode != RenderMode::SLICE9)
1650 _renderMode = RenderMode::QUAD;
1651
1652 _atlasIndex = INDEX_NOT_INITIALIZED;
1653 setTextureAtlas(nullptr);
1654 _recursiveDirty = false;
1655 setDirty(false);
1656
1657 float x1 = _offsetPosition.x;
1658 float y1 = _offsetPosition.y;
1659 float x2 = x1 + _rect.size.width;
1660 float y2 = y1 + _rect.size.height;
1661 _quad.bl.vertices.set(x1, y1, 0);
1662 _quad.br.vertices.set(x2, y1, 0);
1663 _quad.tl.vertices.set(x1, y2, 0);
1664 _quad.tr.vertices.set(x2, y2, 0);
1665 }
1666 else
1667 {
1668 // using batch
1669 _renderMode = RenderMode::QUAD_BATCHNODE;
1670 _transformToBatch = Mat4::IDENTITY;
1671 setTextureAtlas(_batchNode->getTextureAtlas()); // weak ref
1672 }
1673}
1674
1675// MARK: Texture protocol
1676void Sprite::updateBlendFunc()

Callers 12

updateBatchNodeMethod · 0.45
addChildByTagOrNameMethod · 0.45
removeChildMethod · 0.45
appendChildMethod · 0.45
removeSpriteFromAtlasMethod · 0.45
insertQuadFromSpriteMethod · 0.45
updateQuadFromSpriteMethod · 0.45
addChildMethod · 0.45
removeChildMethod · 0.45

Calls 4

getTextureAtlasMethod · 0.80
setTextureAtlasFunction · 0.70
setDirtyFunction · 0.70
setMethod · 0.45

Tested by

no test coverage detected