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; }