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

Method reorderSprites

tests/cpp-tests/Source/SpriteTest/SpriteTest.cpp:940–954  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

938}
939
940void SpriteBatchNodeReorderIssue767::reorderSprites(float dt)
941{
942 auto spritebatch = static_cast<SpriteBatchNode*>(getChildByTag(kTagSprite1));
943 auto father = static_cast<Sprite*>(spritebatch->getChildByTag(kTagSprite2));
944 auto left = static_cast<Sprite*>(father->getChildByTag(kTagSpriteLeft));
945 auto right = static_cast<Sprite*>(father->getChildByTag(kTagSpriteRight));
946
947 int newZLeft = 1;
948
949 if (left->getLocalZOrder() == 1)
950 newZLeft = -1;
951
952 father->reorderChild(left, newZLeft);
953 father->reorderChild(right, -newZLeft);
954}
955
956//------------------------------------------------------------------
957//

Callers

nothing calls this directly

Calls 3

getChildByTagFunction · 0.85
getChildByTagMethod · 0.45
reorderChildMethod · 0.45

Tested by

no test coverage detected