| 693 | } |
| 694 | |
| 695 | CameraCenterTest::CameraCenterTest() |
| 696 | { |
| 697 | auto s = Director::getInstance()->getWinSize(); |
| 698 | |
| 699 | Sprite* sprite; |
| 700 | OrbitCamera* orbit; |
| 701 | |
| 702 | // LEFT-TOP |
| 703 | sprite = Sprite::create("Images/white-512x512.png"); |
| 704 | addChild(sprite, 0); |
| 705 | sprite->setPosition(Vec2(s.width / 5 * 1, s.height / 5 * 1)); |
| 706 | sprite->setColor(Color3B::RED); |
| 707 | sprite->setTextureRect(Rect(0.0f, 0.0f, 120.0f, 50.0f)); |
| 708 | orbit = OrbitCamera::create(10.0f, 1.0f, 0.0f, 0.0f, 360.0f, 0.0f, 0.0f); |
| 709 | sprite->runAction(RepeatForever::create(orbit)); |
| 710 | // [sprite setAnchorPoint: Vec2(0,1)); |
| 711 | |
| 712 | // LEFT-BOTTOM |
| 713 | sprite = Sprite::create("Images/white-512x512.png"); |
| 714 | addChild(sprite, 0, 40); |
| 715 | sprite->setPosition(Vec2(s.width / 5 * 1, s.height / 5 * 4)); |
| 716 | sprite->setColor(Color3B::BLUE); |
| 717 | sprite->setTextureRect(Rect(0.0f, 0.0f, 120.0f, 50.0f)); |
| 718 | orbit = OrbitCamera::create(10.0f, 1.0f, 0.0f, 0.0f, 360.0f, 0.0f, 0.0f); |
| 719 | sprite->runAction(RepeatForever::create(orbit)); |
| 720 | |
| 721 | // RIGHT-TOP |
| 722 | sprite = Sprite::create("Images/white-512x512.png"); |
| 723 | addChild(sprite, 0); |
| 724 | sprite->setPosition(Vec2(s.width / 5 * 4, s.height / 5 * 1)); |
| 725 | sprite->setColor(Color3B::YELLOW); |
| 726 | sprite->setTextureRect(Rect(0.0f, 0.0f, 120.0f, 50.0f)); |
| 727 | orbit = OrbitCamera::create(10.0f, 1.0f, 0.0f, 0.0f, 360.0f, 0.0f, 0.0f); |
| 728 | sprite->runAction(RepeatForever::create(orbit)); |
| 729 | |
| 730 | // RIGHT-BOTTOM |
| 731 | sprite = Sprite::create("Images/white-512x512.png"); |
| 732 | addChild(sprite, 0, 40); |
| 733 | sprite->setPosition(Vec2(s.width / 5 * 4, s.height / 5 * 4)); |
| 734 | sprite->setColor(Color3B::GREEN); |
| 735 | sprite->setTextureRect(Rect(0.0f, 0.0f, 120.0f, 50.0f)); |
| 736 | orbit = OrbitCamera::create(10.0f, 1.0f, 0.0f, 0.0f, 360.0f, 0.0f, 0.0f); |
| 737 | sprite->runAction(RepeatForever::create(orbit)); |
| 738 | |
| 739 | // CENTER |
| 740 | sprite = Sprite::create("Images/white-512x512.png"); |
| 741 | addChild(sprite, 0, 40); |
| 742 | sprite->setPosition(Vec2(s.width / 2, s.height / 2)); |
| 743 | sprite->setColor(Color3B::WHITE); |
| 744 | sprite->setTextureRect(Rect(0.0f, 0.0f, 120.0f, 50.0f)); |
| 745 | orbit = OrbitCamera::create(10.0f, 1.0f, 0.0f, 0.0f, 360.0f, 0.0f, 0.0f); |
| 746 | sprite->runAction(RepeatForever::create(orbit)); |
| 747 | } |
| 748 | |
| 749 | std::string CameraCenterTest::title() const |
| 750 | { |
nothing calls this directly
no test coverage detected