Merge pull request #13297 from yangws/bug_21861

Fix bug: #21861 cpp-tests->Node:Sprite->Testing Sprite BatchNode's ef…
This commit is contained in:
子龙山人 2015-08-11 15:55:26 +08:00
commit 5fb0135bc2
1 changed files with 12 additions and 3 deletions

View File

@ -675,15 +675,24 @@ std::string SpriteBatchNodeReorderIssue744::subtitle() const
Sprite* SpriteBatchNodeReorderIssue766::makeSpriteZ(int aZ) Sprite* SpriteBatchNodeReorderIssue766::makeSpriteZ(int aZ)
{ {
auto sprite = Sprite::createWithTexture(batchNode->getTexture(), Rect(128,0,64,64)); Rect rcw(128,0,64,64);
rcw = CC_RECT_PIXELS_TO_POINTS(rcw);
auto sprite = Sprite::createWithTexture(batchNode->getTexture(), rcw);
sprite->setScale(CC_CONTENT_SCALE_FACTOR());
batchNode->addChild(sprite, aZ+1, 0); batchNode->addChild(sprite, aZ+1, 0);
//children //children
auto spriteShadow = Sprite::createWithTexture(batchNode->getTexture(), Rect(0,0,64,64)); Rect rc1(0,0,64,64);
rc1 = CC_RECT_PIXELS_TO_POINTS(rc1);
auto spriteShadow = Sprite::createWithTexture(batchNode->getTexture(), rc1);
spriteShadow->setOpacity(128); spriteShadow->setOpacity(128);
sprite->setScale(CC_CONTENT_SCALE_FACTOR());
sprite->addChild(spriteShadow, aZ, 3); sprite->addChild(spriteShadow, aZ, 3);
auto spriteTop = Sprite::createWithTexture(batchNode->getTexture(), Rect(64,0,64,64)); Rect rc2(64,0,64,64);
rc2 = CC_RECT_PIXELS_TO_POINTS(rc2);
auto spriteTop = Sprite::createWithTexture(batchNode->getTexture(), rc2);
sprite->setScale(CC_CONTENT_SCALE_FACTOR());
sprite->addChild(spriteTop, aZ+2, 3); sprite->addChild(spriteTop, aZ+2, 3);
return sprite; return sprite;