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

Method init

tests/cpp-tests/Source/BugsTest/Bug-Child.cpp:37–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35using namespace ax;
36
37bool 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
70void BugChild::switchChild(Object* sender)
71{

Callers

nothing calls this directly

Calls 12

getInstanceFunction · 0.85
createFunction · 0.85
alignItemsVerticallyMethod · 0.80
initFunction · 0.50
Vec2Function · 0.50
setPositionMethod · 0.45
retainMethod · 0.45
addChildMethod · 0.45
setCameraMaskMethod · 0.45
runActionMethod · 0.45
reverseMethod · 0.45
setStringMethod · 0.45

Tested by

no test coverage detected