------------------------------------------------------------------ Slice9 Test #5 ------------------------------------------------------------------
| 5469 | // |
| 5470 | //------------------------------------------------------------------ |
| 5471 | SpriteSlice9Test5::SpriteSlice9Test5() |
| 5472 | { |
| 5473 | Size s = Director::getInstance()->getVisibleSize(); |
| 5474 | |
| 5475 | SpriteFrameCache::getInstance()->addSpriteFramesWithFile("animations/grossini_family.plist"); |
| 5476 | SpriteFrameCache::getInstance()->addSpriteFramesWithFile("animations/grossini.plist"); |
| 5477 | |
| 5478 | // Create reference sprite that's rotating based on there anchor point |
| 5479 | auto s1 = Sprite::create("Images/grossinis_heads.png"); |
| 5480 | addChild(s1); |
| 5481 | s1->getTexture()->setAliasTexParameters(); |
| 5482 | s1->setTextureRect(AX_RECT_PIXELS_TO_POINTS(Rect(0, 0, 64, 128))); |
| 5483 | s1->setPosition(s.width / 2 - s.width / 3, s.height / 2); |
| 5484 | s1->setAnchorPoint(Vec2::ANCHOR_MIDDLE); |
| 5485 | s1->setContentSize(Size(s.width / 3, s.height)); |
| 5486 | s1->setCenterRectNormalized(Rect(0, 0, 1, 1)); |
| 5487 | _sprites[0] = s1; |
| 5488 | |
| 5489 | // Create reference sprite that's rotating based on there anchor point |
| 5490 | auto s2 = Sprite::create("Images/grossinis_heads.png"); |
| 5491 | addChild(s2); |
| 5492 | s2->setTextureRect(AX_RECT_PIXELS_TO_POINTS(Rect(64, 0, 64, 128))); |
| 5493 | s2->setPosition(s.width * 2 / 4, s.height / 2); |
| 5494 | s2->setAnchorPoint(Vec2::ANCHOR_MIDDLE); |
| 5495 | s2->setContentSize(Size(s.width / 3, s.height)); |
| 5496 | s2->setCenterRectNormalized(Rect(0, 0, 1, 1)); |
| 5497 | _sprites[1] = s2; |
| 5498 | |
| 5499 | // Create reference sprite that's rotating based on there anchor point |
| 5500 | auto s3 = Sprite::create("Images/grossinis_heads.png"); |
| 5501 | addChild(s3); |
| 5502 | s3->setTextureRect(AX_RECT_PIXELS_TO_POINTS(Rect(128, 0, 64, 128))); |
| 5503 | s3->setPosition(s.width / 2 + s.width / 3, s.height / 2); |
| 5504 | s3->setAnchorPoint(Vec2::ANCHOR_MIDDLE); |
| 5505 | s3->setContentSize(Size(s.width / 3, s.height)); |
| 5506 | s3->setCenterRectNormalized(Rect(0, 0, 1, 1)); |
| 5507 | _sprites[2] = s3; |
| 5508 | |
| 5509 | scheduleUpdate(); |
| 5510 | |
| 5511 | _elapsed = 0; |
| 5512 | } |
| 5513 | |
| 5514 | void SpriteSlice9Test5::update(float dt) |
| 5515 | { |
nothing calls this directly
no test coverage detected