| 35 | using namespace ax; |
| 36 | |
| 37 | bool BugChild::init() |
| 38 | { |
| 39 | if (BugsTestBase::init()) |
| 40 | { |
| 41 | auto size = Director::getInstance()->getWinSize(); |
| 42 | |
| 43 | // create and initialize a Label |
| 44 | auto item1 = MenuItemFont::create("Switch Child", AX_CALLBACK_1(BugChild::switchChild, this)); |
| 45 | |
| 46 | menu = Menu::create(item1, nullptr); |
| 47 | |
| 48 | menu->alignItemsVertically(); |
| 49 | menu->setPosition(size.width / 2, 100); |
| 50 | addChild(menu); |
| 51 | |
| 52 | parent1 = Sprite::create("Images/grossini.png"); |
| 53 | parent1->setPosition(size.width / 4, size.height / 2); |
| 54 | addChild(parent1); |
| 55 | |
| 56 | parent2 = Sprite::create("Images/grossinis_sister1.png"); |
| 57 | parent2->setPosition(size.width * 3 / 4, size.height / 2); |
| 58 | addChild(parent2); |
| 59 | |
| 60 | child = Sprite::create("Images/grossinis_sister2.png"); |
| 61 | child->setPosition(20, 20); |
| 62 | child->retain(); |
| 63 | parent1->addChild(child); |
| 64 | return true; |
| 65 | } |
| 66 | |
| 67 | return false; |
| 68 | } |
| 69 | |
| 70 | void BugChild::switchChild(Object* sender) |
| 71 | { |
nothing calls this directly
no test coverage detected