cocos2d-x CCTextFiledTTF , CCEditBox

前端之家收集整理的这篇文章主要介绍了cocos2d-x CCTextFiledTTF , CCEditBox前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

显示输入框字体;

<span style="white-space:pre">	</span> CCSize winSize =CCDirector::sharedDirector()->getWinSize();
         CCTextFieldTTF* text = CCTextFieldTTF::textFieldWithPlaceHolder("hello","courier new",80);
         addChild(text);
         text->setPosition(ccp(winSize.width/2,winSize.height/2));

输入框:

         CCEditBox* edit =CCEditBox::create(CCSize(200,40),CCScale9Sprite::create("scale9.png"));
         addChild(edit);
         edit->setPosition(ccp(winSize.width/2,winSize.height/2));
         edit->setMaxLength(10);
         edit->setPlaceHolder("Please");
         edit->setFont("couriernew",50);
         edit->setFontColor(ccc3(255,255,255));
原文链接:https://www.f2er.com/cocos2dx/345225.html

猜你在找的Cocos2d-x相关文章