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

Method continueInit

tests/fairygui-tests/Source/GuideScene.cpp:15–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13}
14
15void GuideScene::continueInit()
16{
17 UIPackage::addPackage("UI/Guide");
18
19 _view = UIPackage::createObject("Guide", "Main")->as<GComponent>();
20 _groot->addChild(_view);
21
22 _guideLayer = UIPackage::createObject("Guide", "GuideLayer")->as<GComponent>();
23 _guideLayer->makeFullScreen();
24 _guideLayer->addRelation(_groot, RelationType::Size);
25 _guideLayer->retain();
26
27 GObject* bagBtn = _view->getChild("bagBtn");
28 bagBtn->addClickListener([this](EventContext*)
29 {
30 _guideLayer->removeFromParent();
31 });
32
33 _view->getChild("n2")->addClickListener([this, bagBtn](EventContext*)
34 {
35 _groot->addChild(_guideLayer); //!!Before using TransformRect(or GlobalToLocal), the object must be added first
36 Rect rect = bagBtn->transformRect(Rect(Vec2::ZERO, bagBtn->getSize()), _guideLayer);
37
38 GObject* window = _guideLayer->getChild("window");
39 window->setSize((int)rect.size.width, (int)rect.size.height);
40
41 GTween::to(window->getPosition(), rect.origin, 0.5f)->setTarget(window, TweenPropType::Position);
42 });
43}

Callers

nothing calls this directly

Calls 13

makeFullScreenMethod · 0.80
addRelationMethod · 0.80
addClickListenerMethod · 0.80
transformRectMethod · 0.80
RectClass · 0.50
addChildMethod · 0.45
retainMethod · 0.45
getChildMethod · 0.45
removeFromParentMethod · 0.45
getSizeMethod · 0.45
setSizeMethod · 0.45
setTargetMethod · 0.45

Tested by

no test coverage detected