------------------------------------------------------------------ AnimationCache ------------------------------------------------------------------
| 3677 | // |
| 3678 | //------------------------------------------------------------------ |
| 3679 | AnimationCacheTest::AnimationCacheTest() |
| 3680 | { |
| 3681 | auto frameCache = SpriteFrameCache::getInstance(); |
| 3682 | frameCache->addSpriteFramesWithFile("animations/grossini.plist"); |
| 3683 | frameCache->addSpriteFramesWithFile("animations/grossini_gray.plist"); |
| 3684 | frameCache->addSpriteFramesWithFile("animations/grossini_blue.plist"); |
| 3685 | |
| 3686 | // |
| 3687 | // create animation "dance" |
| 3688 | // |
| 3689 | Vector<SpriteFrame*> animFrames(15); |
| 3690 | char str[100] = {0}; |
| 3691 | for (int i = 1; i < 15; i++) |
| 3692 | { |
| 3693 | fmt::format_to_z(str, "grossini_dance_{:02d}.png", i); |
| 3694 | auto frame = frameCache->getSpriteFrameByName(str); |
| 3695 | animFrames.pushBack(frame); |
| 3696 | } |
| 3697 | |
| 3698 | auto animation = Animation::createWithSpriteFrames(animFrames, 0.2f); |
| 3699 | |
| 3700 | // Add an animation to the Cache |
| 3701 | AnimationCache::getInstance()->addAnimation(animation, "dance"); |
| 3702 | |
| 3703 | // |
| 3704 | // create animation "dance gray" |
| 3705 | // |
| 3706 | animFrames.clear(); |
| 3707 | |
| 3708 | for (int i = 1; i < 15; i++) |
| 3709 | { |
| 3710 | fmt::format_to_z(str, "grossini_dance_gray_{:02d}.png", i); |
| 3711 | auto frame = frameCache->getSpriteFrameByName(str); |
| 3712 | animFrames.pushBack(frame); |
| 3713 | } |
| 3714 | |
| 3715 | animation = Animation::createWithSpriteFrames(animFrames, 0.2f); |
| 3716 | |
| 3717 | // Add an animation to the Cache |
| 3718 | AnimationCache::getInstance()->addAnimation(animation, "dance_gray"); |
| 3719 | |
| 3720 | // |
| 3721 | // create animation "dance blue" |
| 3722 | // |
| 3723 | animFrames.clear(); |
| 3724 | |
| 3725 | for (int i = 1; i < 4; i++) |
| 3726 | { |
| 3727 | fmt::format_to_z(str, "grossini_blue_{:02d}.png", i); |
| 3728 | auto frame = frameCache->getSpriteFrameByName(str); |
| 3729 | animFrames.pushBack(frame); |
| 3730 | } |
| 3731 | |
| 3732 | animation = Animation::createWithSpriteFrames(animFrames, 0.2f); |
| 3733 | |
| 3734 | // Add an animation to the Cache |
| 3735 | AnimationCache::getInstance()->addAnimation(animation, "dance_blue"); |
| 3736 |
nothing calls this directly
no test coverage detected