MCPcopy Create free account
hub / github.com/axmolengine/axmol / NodeToWorld3D

Method NodeToWorld3D

tests/cpp-tests/Source/NodeTest/NodeTest.cpp:492–529  ·  view source on GitHub ↗

------------------------------------------------------------------ NodeToWorld3D ------------------------------------------------------------------

Source from the content-addressed store, hash-verified

490//
491//------------------------------------------------------------------
492NodeToWorld3D::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
531std::string NodeToWorld3D::subtitle() const
532{

Callers

nothing calls this directly

Calls 11

getInstanceFunction · 0.85
createFunction · 0.85
alignItemsVerticallyMethod · 0.80
Vec2Function · 0.50
setContentSizeMethod · 0.45
setAnchorPointMethod · 0.45
setPositionMethod · 0.45
addChildMethod · 0.45
getContentSizeMethod · 0.45
runActionMethod · 0.45
reverseMethod · 0.45

Tested by

no test coverage detected