本文整理汇总了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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}