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

Method SpriteSlice9Test10

tests/cpp-tests/Source/SpriteTest/SpriteTest.cpp:5800–5829  ·  view source on GitHub ↗

------------------------------------------------------------------ Slice9 Test #10 ------------------------------------------------------------------

Source from the content-addressed store, hash-verified

5798//
5799//------------------------------------------------------------------
5800SpriteSlice9Test10::SpriteSlice9Test10()
5801{
5802 Size s = Director::getInstance()->getVisibleSize();
5803
5804 SpriteFrameCache::getInstance()->addSpriteFramesWithFile("Images/blocks9ss.plist");
5805
5806 auto s1 = Sprite::createWithSpriteFrameName("blocks9ss/blocks9r.png");
5807 addChild(s1);
5808 s1->setPosition(s.width / 2 - s.width / 3, s.height / 2);
5809 s1->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
5810 s1->setCenterRectNormalized(Rect(1 / 3.f, 1 / 3.f, 1 / 3.f, 1 / 3.f));
5811 s1->setContentSize(s1->getContentSize() * 1.5);
5812 s1->setFlippedX(true);
5813
5814 auto s2 = Sprite::createWithSpriteFrameName("blocks9ss/blocks9r.png");
5815 addChild(s2);
5816 s2->setPosition(s.width * 2 / 4, s.height / 2);
5817 s2->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
5818 s2->setCenterRectNormalized(Rect(1 / 3.f, 1 / 3.f, 1 / 3.f, 1 / 3.f));
5819 s2->setContentSize(s2->getContentSize() * 1.5);
5820
5821 // Create reference sprite that's rotating based on there anchor point
5822 auto s3 = Sprite::createWithSpriteFrameName("blocks9ss/blocks9r.png");
5823 addChild(s3);
5824 s3->setPosition(s.width / 2 + s.width / 3, s.height / 2);
5825 s3->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
5826 s3->setCenterRectNormalized(Rect(1 / 3.f, 1 / 3.f, 1 / 3.f, 1 / 3.f));
5827 s3->setContentSize(s3->getContentSize() * 1.5);
5828 s3->setFlippedY(true);
5829}
5830
5831//------------------------------------------------------------------
5832//

Callers

nothing calls this directly

Calls 11

getInstanceFunction · 0.85
RectClass · 0.50
getVisibleSizeMethod · 0.45
setPositionMethod · 0.45
setAnchorPointMethod · 0.45
setContentSizeMethod · 0.45
getContentSizeMethod · 0.45
setFlippedXMethod · 0.45
setFlippedYMethod · 0.45

Tested by

no test coverage detected