void PersonalityQuiz::createnamecap(){ Size visibleSize = Director::getInstance()->getVisibleSize(); Vec2 origin = Director::getInstance()->getVisibleOrigin(); std::string abc("ENTER YOUR NAME!"); ui::Text* EnterNameText = ui::Text::create(abc, "Arial", 30); EnterNameText->setColor(Color3B::BLACK); EnterNameText->setPosition(Point(visibleSize.width/2 + 150, visibleSize.height/2 - 100)); EnterNameText->setName("ResultDesc"); EnterNameText->setTextAreaSize(Size(600,200)); EnterNameText->setVisible(true); this->addChild(EnterNameText,2); EditBox *EnterName = EditBox::create(Size(350,50), Scale9Sprite::create("New-Game-textbox.png")); EnterName->setPosition(Vec2(visibleSize.width / 2, + visibleSize.height / 2 - 130)); EnterName->setInputMode(cocos2d::extension::EditBox::InputMode::SINGLE_LINE); EnterName->setMaxLength(20); EnterName->setFontColor(Color3B::BLACK); EnterName->setPlaceHolder(" "); EnterName->setReturnType(EditBox::KeyboardReturnType::DONE); EnterName->setName("NameBox"); this->addChild(EnterName,3); }
EditBox* TuiManager::createEditBox(float tag, const char* file, int inputMode, int inputFlag, float x, float y, float w, float h, float rotation){ EditBox *pEditBox = NULL; if(m_isUseSpriteFrame){ pEditBox = EditBox::create(Size(w,h),Scale9Sprite::createWithSpriteFrameName(file)); }else{ pEditBox = EditBox::create(Size(w,h),Scale9Sprite::create(file)); } pEditBox->setInputMode((EditBox::InputMode)inputMode); pEditBox->setInputFlag((EditBox::InputFlag)inputFlag); pEditBox->setRotation(rotation); pEditBox->setPosition(Point(x,-y)); pEditBox->setTag(tag); return pEditBox; }