| 41 | using namespace ax; |
| 42 | |
| 43 | bool 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 | |
| 79 | void Bug14327Layer::update(float dt) |
| 80 | { |
nothing calls this directly
no test coverage detected