当前位置: 首页>>代码示例>>C++>>正文


C++ CCTextFieldTTF类代码示例

本文整理汇总了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();
    }
}
开发者ID:HongXiao,项目名称:Client-source,代码行数:16,代码来源:TextInputTest.cpp

示例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;
	
}
开发者ID:cruisehu,项目名称:PongPongPia,代码行数:16,代码来源:LogIntoLayer.cpp

示例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();
    }
}
开发者ID:crocodev,项目名称:Croco,代码行数:16,代码来源:GroupCustomization.cpp

示例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;
}
开发者ID:caoguoping,项目名称:warCraft,代码行数:16,代码来源:CCTextFieldTTF.cpp

示例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;
}
开发者ID:flywingsky,项目名称:drawstory_client,代码行数:40,代码来源:RegisterLayer.cpp

示例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;
}
开发者ID:HongXiao,项目名称:Client-source,代码行数:22,代码来源:TextInputTest.cpp

示例7: ShowKeyboard

void CPlayerNameSettingLayer::ShowKeyboard( cocos2d::CCIMEKeyboardNotificationInfo & info )
{
	CCTextFieldTTF *textfield = (CCTextFieldTTF*)this->getChildByTag(1);
	textfield->setString("");
}
开发者ID:BlackBags,项目名称:MonsterScramble,代码行数:5,代码来源:PlayerNameSettingLayer.cpp


注:本文中的CCTextFieldTTF类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。