本文整理汇总了C++中CCTextFieldTTF类的典型用法代码示例。如果您正苦于以下问题:C++ CCTextFieldTTF类的具体用法?C++ CCTextFieldTTF怎么用?C++ CCTextFieldTTF使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CCTextFieldTTF类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CCLOG
void TextFieldTTFDefaultTest::onClickTrackNode(bool bClicked)
{
CCTextFieldTTF * pTextField = (CCTextFieldTTF*)m_pTrackNode;
if (bClicked)
{
// TextFieldTTFTest be clicked
CCLOG("TextFieldTTFDefaultTest:CCTextFieldTTF attachWithIME");
pTextField->attachWithIME();
}
else
{
// TextFieldTTFTest not be clicked
CCLOG("TextFieldTTFDefaultTest:CCTextFieldTTF detachWithIME");
pTextField->detachWithIME();
}
}
示例2: CCPointMake
void LogIntoLayer::creatUsernameText()
{
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
CCPoint pos = CCPointMake(winSize.width*220/500,winSize.height*318/500);
CCTextFieldTTF* text = CCTextFieldTTF::textFieldWithPlaceHolder(
"Input Your Name...","Arial",20);
text->setColor(ccc3(INPUT_R,INPUT_G,INPUT_B));
text->setPosition(pos);
this->addChild(text,20);
text->setDelegate(this);
text->retain();
usernameText = text;
}
示例3: CCLOG
void CurrentGroupLayer::onClickTrackNode(bool bClicked)
{
CCTextFieldTTF * pTextField = (CCTextFieldTTF*)m_pTrackNode;
if (bClicked)
{
// TextFieldTTFTest be clicked
CCLOG("TextFieldTTFActionTest:CCTextFieldTTF attachWithIME");
pTextField->attachWithIME();
}
else
{
// TextFieldTTFTest not be clicked
CCLOG("TextFieldTTFActionTest:CCTextFieldTTF detachWithIME");
pTextField->detachWithIME();
}
}
示例4: CCTextFieldTTF
CCTextFieldTTF * CCTextFieldTTF::textFieldWithPlaceHolder(const char *placeholder, const char *fontName, float fontSize)
{
CCTextFieldTTF *pRet = new CCTextFieldTTF();
if(pRet && pRet->initWithString("", fontName, fontSize))
{
pRet->autorelease();
if (placeholder)
{
pRet->setPlaceHolder(placeholder);
}
return pRet;
}
CC_SAFE_DELETE(pRet);
return NULL;
}
示例5: CC_BREAK_IF
bool RegisterLayer::init()
{
bool result = false;
do {
CC_BREAK_IF(!TextInputDelegate::init());
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
// add background
CCSprite* background = CCSprite::spriteWithSpriteFrameName("email_background");
background->setPosition(CCPointMake(winSize.width * 0.5f, winSize.height * 0.5f));
CC_ASSERT(background);
addChild(background);
CCPoint emailTextFieldPos = CCPointMake(158.0f, 308.0f);
CCSprite* emailbg = CCSprite::spriteWithSpriteFrameName("textfield");
emailbg->setPosition(emailTextFieldPos);
addChild(emailbg,kZUILabel,kTagEmailBG);
CCTextFieldTTF* field = addTextField(emailTextFieldPos, kZUITextField,kTagEmail, "输入邮件地址登陆", "Thonburi", 14);
field->setColor(ccBLUE);
CCPoint nameTextFieldPos = CCPointMake(158.0f,221.0f);
CCSprite* namebg = CCSprite::spriteWithSpriteFrameName("textfield");
namebg->setPosition(nameTextFieldPos);
addChild(namebg,kZUILabel,kTagUsernameBG);
field = addTextField(nameTextFieldPos, kZUITextField, kTagUsername, "输入用户名(推荐)", "Thonburi", 14);
field->setColor(ccBLACK);
CCSprite* startbutton = CCSprite::spriteWithSpriteFrameName("email_start");
startbutton->setPosition(CCPointMake(160.0f, 180.0f));
addChild(startbutton,kZUILabel,kTagStartButton);
result = true;
} while (0);
return result;
}
示例6: addChild
void TextFieldTTFDefaultTest::onEnter()
{
KeyboardNotificationLayer::onEnter();
// add CCTextFieldTTF
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCTextFieldTTF * pTextField = CCTextFieldTTF::textFieldWithPlaceHolder("<click here for input>",
FONT_NAME,
FONT_SIZE);
addChild(pTextField);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// on ANDROID, CCTextFieldTTF cannot auto adjust its position when soft-keyboard pop up
// so we had to set a higher position to make it visable
pTextField->setPosition(ccp(s.width / 2, s.height/2 + 50));
#else
pTextField->setPosition(ccp(s.width / 2, s.height / 2));
#endif
m_pTrackNode = pTextField;
}
示例7: ShowKeyboard
void CPlayerNameSettingLayer::ShowKeyboard( cocos2d::CCIMEKeyboardNotificationInfo & info )
{
CCTextFieldTTF *textfield = (CCTextFieldTTF*)this->getChildByTag(1);
textfield->setString("");
}