本文整理汇总了C++中CCLabelTTF::setPositionWithParent方法的典型用法代码示例。如果您正苦于以下问题:C++ CCLabelTTF::setPositionWithParent方法的具体用法?C++ CCLabelTTF::setPositionWithParent怎么用?C++ CCLabelTTF::setPositionWithParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCLabelTTF
的用法示例。
在下文中一共展示了CCLabelTTF::setPositionWithParent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
KDbool CScrMainMenu::init ( KDvoid )
{
// 레이어를 초기화 한다.
if ( !CCLayer::initWithVisibleViewport ( ) )
{
return KD_FALSE;
}
// 현재 레이어 사이즈를 가져온다.
CCSize tLyrSize = this->getContentSize ( );
CCSize tSize = ccsz;
// 디버그용 배경
// this->addChild ( CCLayerColor::create ( ccc4 ( 255, 0, 0, 128 ), tLyrSize ) );
// 우상단 종료 버튼
CCMenuItemImage* pClose = CCMenuItemImage::create
(
"Images/CloseNormal.png",
"Images/CloseSelected.png",
this, menu_selector ( CScrMainMenu::onExit )
);
this->addChild ( CCMenu::createWithItem ( pClose ), 1 );
tSize = pClose->getContentSize ( );
pClose->setPosition ( this, kCCAlignmentTopRight, ccp ( 20, 20 ) );
// pClose->setPosition ( ccp ( tLyrSize.cx - tSize.cx / 2 - 20, tLyrSize.cy - tSize.cx / 2 - 20 ) );
// 타이틀 레이블 생성
CCLabelTTF* pTitle = CCLabelTTF::create ( GSTAT->getText ( eTxtTitle ), "Font/NanumGothicBold.ttf", 40 );
this->addChild ( pTitle );
pTitle->setColor ( ccYELLOW );
pTitle->setPositionWithParent ( kCCAlignmentTop, ccp ( 0, 50 ) );
// 설명 Label 생성
CCLabelTTF* pDesc = CCLabelTTF::create( "Press the airplane !!!!", "Font/NanumGothicBold.ttf", 25 );
this->addChild( pDesc );
pDesc->setPosition ( ccpMid ( tLyrSize ) );
// 설명 Label이 계속해서 깜빡거리도록 설정
pDesc->runAction ( CCRepeatForever::create ( CCBlink::create ( 1.0f, 1 ) ) );
// 비행기 묶음 텍스쳐 생성
CCTexture2D* pTexture = CCTextureCache::sharedTextureCache ( )->addImage ( "Images/galagasheet.png" );
// 하단에 비행기 생성
CCSprite* pAirPlane = CCSprite::createWithTexture ( pTexture, ccr ( 184, 55, 15, 17 ) );
this->addChild ( pAirPlane );
pAirPlane->setScale ( 2 );
pAirPlane->setPositionWithParent ( kCCAlignmentBottom, ccp ( 0, 50 ) );
m_pAirPlane = pAirPlane;
// 레이어 터치 모드 켜기
this->setTouchEnabled ( KD_TRUE );
return KD_TRUE;
}