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

Method init

tests/cpp-tests/Source/BugsTest/Bug-14327.cpp:43–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41using namespace ax;
42
43bool Bug14327Layer::init()
44{
45 if (BugsTestBase::init())
46 {
47 auto renderView = Director::getInstance()->getRenderView();
48 auto visibleOrigin = renderView->getVisibleOrigin();
49 auto visibleSize = renderView->getVisibleSize();
50
51 auto pBg = Sprite::create("Images/HelloWorld.png");
52 pBg->setPosition(Vec2(visibleOrigin.x + visibleSize.width / 2, visibleOrigin.y + visibleSize.height / 2));
53 addChild(pBg);
54
55 _removeTime = time(nullptr) + 20;
56
57 _TTFShowTime = Label::createWithSystemFont("Edit control will be removed after 00:20!", "Arial", 20);
58 _TTFShowTime->setPosition(
59 Vec2(visibleOrigin.x + visibleSize.width / 2, visibleOrigin.y + visibleSize.height - 60));
60 this->addChild(_TTFShowTime);
61
62 auto editBoxSize = Size(visibleSize.width - 100, visibleSize.height * 0.1);
63
64 std::string pNormalSprite = "extensions/green_edit.png";
65 _edit = ui::EditBox::create(editBoxSize + Size(0, 20), ui::Scale9Sprite::create(pNormalSprite));
66 _edit->setPosition(Vec2(visibleOrigin.x + visibleSize.width / 2, visibleOrigin.y + visibleSize.height / 2));
67 _edit->setFontColor(Color3B::RED);
68 _edit->setReturnType(ui::EditBox::KeyboardReturnType::DONE);
69 _edit->setDelegate(this);
70 this->addChild(_edit);
71
72 this->scheduleUpdate();
73 return true;
74 }
75
76 return false;
77}
78
79void Bug14327Layer::update(float dt)
80{

Callers

nothing calls this directly

Calls 13

getInstanceFunction · 0.85
createFunction · 0.85
scheduleUpdateMethod · 0.80
initFunction · 0.50
Vec2Function · 0.50
SizeFunction · 0.50
getVisibleOriginMethod · 0.45
getVisibleSizeMethod · 0.45
setPositionMethod · 0.45
addChildMethod · 0.45
setFontColorMethod · 0.45
setReturnTypeMethod · 0.45

Tested by

no test coverage detected