------------------------------------------------------------------ Slice9 Test #6 ------------------------------------------------------------------
| 5545 | // |
| 5546 | //------------------------------------------------------------------ |
| 5547 | SpriteSlice9Test6::SpriteSlice9Test6() |
| 5548 | { |
| 5549 | Size s = Director::getInstance()->getVisibleSize(); |
| 5550 | |
| 5551 | SpriteFrameCache::getInstance()->addSpriteFramesWithFile("animations/grossini_family.plist"); |
| 5552 | SpriteFrameCache::getInstance()->addSpriteFramesWithFile("animations/grossini.plist"); |
| 5553 | |
| 5554 | // Create reference sprite that's rotating based on there anchor point |
| 5555 | auto s1 = Sprite::create("Images/grossinis_heads.png"); |
| 5556 | addChild(s1); |
| 5557 | s1->getTexture()->setAliasTexParameters(); |
| 5558 | s1->setTextureRect(AX_RECT_PIXELS_TO_POINTS(Rect(0, 0, 64, 128))); |
| 5559 | s1->setPosition(s.width / 2 - s.width / 3, s.height / 2); |
| 5560 | s1->setAnchorPoint(Vec2::ANCHOR_MIDDLE); |
| 5561 | s1->setContentSize(Size(s.width / 3, s.height)); |
| 5562 | s1->setCenterRectNormalized(Rect(0, 0, 1, 1)); |
| 5563 | _sprites[0] = s1; |
| 5564 | |
| 5565 | // Create reference sprite that's rotating based on there anchor point |
| 5566 | auto s2 = Sprite::create("Images/grossinis_heads.png"); |
| 5567 | addChild(s2); |
| 5568 | s2->setTextureRect(AX_RECT_PIXELS_TO_POINTS(Rect(64, 0, 64, 128))); |
| 5569 | s2->setPosition(s.width * 2 / 4, s.height / 2); |
| 5570 | s2->setAnchorPoint(Vec2::ANCHOR_MIDDLE); |
| 5571 | s2->setContentSize(Size(s.width / 3, s.height)); |
| 5572 | s2->setCenterRectNormalized(Rect(0, 0, 1, 1)); |
| 5573 | _sprites[1] = s2; |
| 5574 | |
| 5575 | // Create reference sprite that's rotating based on there anchor point |
| 5576 | auto s3 = Sprite::create("Images/grossinis_heads.png"); |
| 5577 | addChild(s3); |
| 5578 | s3->setTextureRect(AX_RECT_PIXELS_TO_POINTS(Rect(128, 0, 64, 128))); |
| 5579 | s3->setPosition(s.width / 2 + s.width / 3, s.height / 2); |
| 5580 | s3->setAnchorPoint(Vec2::ANCHOR_MIDDLE); |
| 5581 | s3->setContentSize(Size(s.width / 3, s.height)); |
| 5582 | s3->setCenterRectNormalized(Rect(0, 0, 1, 1)); |
| 5583 | _sprites[2] = s3; |
| 5584 | |
| 5585 | scheduleUpdate(); |
| 5586 | |
| 5587 | _elapsed = 0; |
| 5588 | } |
| 5589 | |
| 5590 | void SpriteSlice9Test6::update(float dt) |
| 5591 | { |
nothing calls this directly
no test coverage detected