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


C++ CCTextFieldTTF::setPosition方法代码示例

本文整理汇总了C++中CCTextFieldTTF::setPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ CCTextFieldTTF::setPosition方法的具体用法?C++ CCTextFieldTTF::setPosition怎么用?C++ CCTextFieldTTF::setPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCTextFieldTTF的用法示例。


在下文中一共展示了CCTextFieldTTF::setPosition方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: init

// 조심해!! 이 레이어가 제대로 작동하는지 알아보려면 Win32 키보드를 지원하지 않아서 iOS에서 돌려봐야해!!
// Win32 하드웨어 키보드는 아직 지원하지 않는다고 ㅠㅠ
bool CPlayerNameSettingLayer::init()
{
	if ( !CCLayer::init() )
	{
		return false;
	}

	// Get Window Size
	CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize(); 

	// touch enable == true for iPad keyboard input
	this->setTouchEnabled(true);

	CCTextFieldTTF *textfield = CCTextFieldTTF::textFieldWithPlaceHolder("NameInputPage", CCSize(480,30), kCCTextAlignmentCenter, "Arial", 20);
	// textfield tag == 1;
	textfield->setTag(1);
	// set position
	textfield->setPosition(ccp(visibleSize.width/2, visibleSize.height/2 + 100));
	this->addChild(textfield);

	CCLabelTTF *label = CCLabelTTF::create("NAME : ", "", 50);
	// label tag = 2;
	label->setTag(2);
	// set position
	label->setPosition(ccp(visibleSize.width/2, visibleSize.height/2 - 100));
	this->addChild(label);
}
开发者ID:BlackBags,项目名称:MonsterScramble,代码行数:29,代码来源:PlayerNameSettingLayer.cpp

示例2: onEnter

void TextInput::onEnter()
{
	CCLayer::onEnter();
	
	setTouchEnabled(true);

	CCSize s = CCDirector::sharedDirector()->getWinSize();

	CCTextFieldTTF * pTextField = CCTextFieldTTF::textFieldWithPlaceHolder("<click here for input>","Arial",24);
	addChild(pTextField);
	pTextField->setPosition(ccp(s.width / 2, s.height / 2));

	m_pTrackNode = pTextField;

	CCMenuItemImage *pCloseItem = CCMenuItemImage::create(
		"CloseNormal.png",
		"CloseSelected.png",
		this,
		menu_selector(TextInput::menuCloseCallback));

	// Place the menu item bottom-right conner.
	pCloseItem->setPosition(ccp(CCDirector::sharedDirector()->getWinSize().width - 20, 20));

	// Create a menu with the "close" menu item, it's an auto release object.
	CCMenu* pMenu = CCMenu::create(pCloseItem, NULL);
	pMenu->setPosition(CCPointZero);
	addChild(pMenu);
}
开发者ID:yasu1,项目名称:cocos2d-x,代码行数:28,代码来源:HelloWorldScene.cpp

示例3: onEnter

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

示例4: creatPasswordText

void LogIntoLayer::creatPasswordText()
{
	CCSize winSize = CCDirector::sharedDirector()->getWinSize();
	CCPoint pos = CCPointMake(winSize.width*220/500,winSize.height*22/50);

	CCTextFieldTTF* text = CCTextFieldTTF::textFieldWithPlaceHolder(
		"Input Your Password...","Arial",20);
	text->setColor(ccc3(INPUT_R,INPUT_G,INPUT_B));
	text->setPosition(pos);
	this->addChild(text,20);
	text->setDelegate(this);
	text->retain();
	passwordText = text;
}
开发者ID:cruisehu,项目名称:PongPongPia,代码行数:14,代码来源:LogIntoLayer.cpp

示例5: creatUsernameText

void RegisterLayer::creatUsernameText()
{
	CCSize winSize = CCDirector::sharedDirector()->getWinSize();
	CCPoint pos = CCPointMake(winSize.width*250/500,winSize.height*35/50);

	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,代码来源:RegisterLayer.cpp


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