------------------------------------------------------------------ NodeToWorld3D ------------------------------------------------------------------
| 490 | // |
| 491 | //------------------------------------------------------------------ |
| 492 | NodeToWorld3D::NodeToWorld3D() |
| 493 | { |
| 494 | // |
| 495 | // This code tests that nodeToParent works OK: |
| 496 | // - It tests different anchor Points |
| 497 | // - It tests different children anchor points |
| 498 | |
| 499 | Size s = Director::getInstance()->getWinSize(); |
| 500 | auto parent = Node::create(); |
| 501 | parent->setContentSize(s); |
| 502 | parent->setAnchorPoint(Vec2(0.5f, 0.5f)); |
| 503 | parent->setPosition(s.width / 2, s.height / 2); |
| 504 | this->addChild(parent); |
| 505 | |
| 506 | auto back = Sprite::create(s_back3); |
| 507 | parent->addChild(back, -10); |
| 508 | back->setAnchorPoint(Vec2(0.0f, 0.0f)); |
| 509 | auto backSize = back->getContentSize(); |
| 510 | |
| 511 | auto item = MenuItemImage::create(s_PlayNormal, s_PlaySelect); |
| 512 | auto menu = Menu::create(item, nullptr); |
| 513 | menu->alignItemsVertically(); |
| 514 | menu->setPosition(Vec2(backSize.width / 2, backSize.height / 2)); |
| 515 | back->addChild(menu); |
| 516 | |
| 517 | auto rot = RotateBy::create(5, 360); |
| 518 | auto fe = RepeatForever::create(rot); |
| 519 | item->runAction(fe); |
| 520 | |
| 521 | auto move = MoveBy::create(3, Vec2(200.0f, 0.0f)); |
| 522 | auto move_back = move->reverse(); |
| 523 | auto seq = Sequence::create(move, move_back, nullptr); |
| 524 | auto fe2 = RepeatForever::create(seq); |
| 525 | back->runAction(fe2); |
| 526 | |
| 527 | auto orbit = OrbitCamera::create(10, 0, 1, 0, 360, 0, 90); |
| 528 | parent->runAction(orbit); |
| 529 | } |
| 530 | |
| 531 | std::string NodeToWorld3D::subtitle() const |
| 532 | { |
nothing calls this directly
no test coverage detected