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

Method init

tests/cpp-tests/Source/SceneTest/SceneTest.cpp:181–210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

179SceneTestLayer3::SceneTestLayer3() {}
180
181bool SceneTestLayer3::init()
182{
183 if (LayerColor::initWithColor(Color4B(0, 0, 255, 255)))
184 {
185 auto s = Director::getInstance()->getWinSize();
186
187 auto item0 =
188 MenuItemFont::create("Touch to pushScene (self)", AX_CALLBACK_1(SceneTestLayer3::item0Clicked, this));
189 auto item1 = MenuItemFont::create("Touch to popScene", AX_CALLBACK_1(SceneTestLayer3::item1Clicked, this));
190 auto item2 =
191 MenuItemFont::create("Touch to popToRootScene", AX_CALLBACK_1(SceneTestLayer3::item2Clicked, this));
192 auto item3 = MenuItemFont::create("Touch to popToSceneStackLevel(2)",
193 AX_CALLBACK_1(SceneTestLayer3::item3Clicked, this));
194
195 auto menu = Menu::create(item0, item1, item2, item3, nullptr);
196 this->addChild(menu);
197 menu->alignItemsVertically();
198
199 this->schedule(AX_SCHEDULE_SELECTOR(SceneTestLayer3::testDealloc));
200
201 auto sprite = Sprite::create(s_pathGrossini);
202 addChild(sprite);
203 sprite->setPosition(Vec2(s.width / 2, 40.0f));
204 auto rotate = RotateBy::create(2, 360);
205 auto repeat = RepeatForever::create(rotate);
206 sprite->runAction(repeat);
207 return true;
208 }
209 return false;
210}
211
212void SceneTestLayer3::testDealloc(float dt)
213{

Callers 1

createMethod · 0.45

Calls 9

Color4BFunction · 0.85
getInstanceFunction · 0.85
createFunction · 0.85
alignItemsVerticallyMethod · 0.80
Vec2Function · 0.50
addChildMethod · 0.45
scheduleMethod · 0.45
setPositionMethod · 0.45
runActionMethod · 0.45

Tested by

no test coverage detected