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

Method init

tests/cpp-tests/Source/BugsTest/Bug-458/Bug-458.cpp:35–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33using namespace ax;
34
35bool Bug458Layer::init()
36{
37 if (BugsTestBase::init())
38 {
39 // ask director the the window size
40 auto size = Director::getInstance()->getWinSize();
41
42 auto question = new QuestionContainerSprite();
43 auto question2 = new QuestionContainerSprite();
44 question->init();
45 question2->init();
46
47 // [question setContentSize:CGSizeMake(50,50)];
48 // [question2 setContentSize:CGSizeMake(50,50)];
49
50 auto sprite = MenuItemSprite::create(question2, question, AX_CALLBACK_1(Bug458Layer::selectAnswer, this));
51 auto layer = LayerColor::create(Color4B(0, 0, 255, 255), 100, 100);
52 question->release();
53 question2->release();
54
55 auto layer2 = LayerColor::create(Color4B(255, 0, 0, 255), 100, 100);
56 auto sprite2 = MenuItemSprite::create(layer, layer2, AX_CALLBACK_1(Bug458Layer::selectAnswer, this));
57 auto menu = Menu::create(sprite, sprite2, nullptr);
58 menu->alignItemsVerticallyWithPadding(100);
59 menu->setPosition(size.width / 2, size.height / 2);
60
61 // add the label as a child to this Layer
62 addChild(menu);
63
64 return true;
65 }
66 return false;
67}
68
69void Bug458Layer::selectAnswer(Object* sender)
70{

Callers

nothing calls this directly

Calls 7

getInstanceFunction · 0.85
createFunction · 0.85
Color4BFunction · 0.85
initFunction · 0.50
releaseMethod · 0.45
setPositionMethod · 0.45

Tested by

no test coverage detected