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

Method init

tests/cpp-tests/Source/BugsTest/Bug-1159.cpp:29–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27using namespace ax;
28
29bool Bug1159Layer::init()
30{
31 if (BugsTestBase::init())
32 {
33 auto s = Director::getInstance()->getWinSize();
34
35 auto background = LayerColor::create(Color4B(255, 0, 255, 255));
36 addChild(background);
37
38 auto sprite_a = LayerColor::create(Color4B(255, 0, 0, 255), 700, 700);
39 sprite_a->setAnchorPoint(Vec2(0.5f, 0.5f));
40 sprite_a->setIgnoreAnchorPointForPosition(false);
41 sprite_a->setPosition(0.0f, s.height / 2);
42 addChild(sprite_a);
43
44 sprite_a->runAction(RepeatForever::create(Sequence::create(MoveTo::create(1.0f, Vec2(1024.0f, 384.0f)),
45 MoveTo::create(1.0f, Vec2(0.0f, 384.0f)), nullptr)));
46
47 auto sprite_b = LayerColor::create(Color4B(0, 0, 255, 255), 400, 400);
48 sprite_b->setAnchorPoint(Vec2(0.5f, 0.5f));
49 sprite_b->setIgnoreAnchorPointForPosition(false);
50 sprite_b->setPosition(s.width / 2, s.height / 2);
51 addChild(sprite_b);
52
53 auto label = MenuItemLabel::create(Label::createWithSystemFont("Flip Me", "Helvetica", 24),
54 AX_CALLBACK_1(Bug1159Layer::callBack, this));
55 auto menu = Menu::create(label, nullptr);
56 menu->setPosition(s.width - 200.0f, 50.0f);
57 addChild(menu);
58
59 return true;
60 }
61
62 return false;
63}
64
65void Bug1159Layer::callBack(Object* sender)
66{

Callers

nothing calls this directly

Calls 9

getInstanceFunction · 0.85
createFunction · 0.85
Color4BFunction · 0.85
initFunction · 0.50
Vec2Function · 0.50
setAnchorPointMethod · 0.45
setPositionMethod · 0.45
runActionMethod · 0.45

Tested by

no test coverage detected