bool HelloWorld::init()
{
if( !Layer::init() )
{
returnfalse;
}
SizevisibleSize = Director::getInstance()->getVisibleSize();
Pointorigin = Director::getInstance()->getVisibleOrigin();
autobg = Sprite::create("background.png");
bg->setPosition(Point(visibleSize.width/2,visibleSize.height /2));
this->addChild(bg);
autopItmLabel1 = Label::createWithBMFont("fonts/fnt2.fnt","EaseIn");
autopItmMenu1 = MenuItemLabel::create(pItmLabel1,
CC_CALLBACK_1(HelloWorld::OnClickMenu, this));
pItmMenu1->setTag(kEaseIn);
autopItmLabel2 = Label::createWithBMFont("fonts/fnt2.fnt","EaseOut");
autopItmMenu2 = MenuItemLabel::create(pItmLabel2,
CC_CALLBACK_1(HelloWorld::OnClickMenu,this));
pItmMenu2->setTag(kEaseOut);
autopItmLabel3 = Label::createWithBMFont("fonts/fnt2.fnt","EaseInOut");
autopItmMenu3 = MenuItemLabel::create(pItmLabel3,
CC_CALLBACK_1(HelloWorld::OnClickMenu,this));
pItmMenu3->setTag(kEaseInOut);
autopItmLabel4 = Label::createWithBMFont("fonts/fnt2.fnt","EaseSineIn");
autopItmMenu4 = MenuItemLabel::create(pItmLabel4,
CC_CALLBACK_1(HelloWorld::OnClickMenu,this));
pItmMenu4->setTag(kEaseSineIn);
autopItmLabel5 = Label::createWithBMFont("fonts/fnt2.fnt", "EaseSineOut");
autopItmMenu5 = MenuItemLabel::create(pItmLabel5,
CC_CALLBACK_1(HelloWorld::OnClickMenu,this));
pItmMenu5->setTag(kEaseSineOut);
autopItmLabel6 = Label::createWithBMFont("fonts/fnt2.fnt","EaseSineInOut");
autopItmMenu6 = MenuItemSprite::create(pItmLabel6,
CC_CALLBACK_1(HelloWorld::OnClickMenu,this));
pItmMenu6->setTag(kEaseSineInOut);
autopItmLabel7 = Label::createWithBMFont("fonts/fnt2.fnt","EaseExponentialIn");
autopItmMenu7 = MenuItemSprite::create(pItmLabel7,
CC_CALLBACK_1(HelloWorld::OnClickMenu,this));
pItmMenu7->setTag(kEaseExponentialIn);
autopItmLabel8 = Label::createWithBMFont("fonts/fnt2.fnt","EaseExponentialOut");
autopItmMenu8 = MenuItemLabel::create(pItmLabel8,
CC_CALLBACK_1(HelloWorld::OnClickMenu,this));
pItmMenu8->setTag(kEaseExponentialOut);
autopItmLabel9 = Label::createWithBMFont("fonts/fnt2.fnt","EaseExponentialInOut");
autopItmMenu9 = MenuItemLabel::create(pItmLabel9,
CC_CALLBACK_1(HelloWorld::OnClickMenu,this));
pItmMenu9->setTag(kEaseExponentialInOut);
autopItmLabel10 = Label::createWithBMFont("fonts/fnt2.fnt","Speed");
autopItmMenu10 = MenuItemLabel::create(pItmLabel10,
CC_CALLBACK_1(HelloWorld::OnClickMenu,this));
pItmMenu10->setTag(kSpeed);
automn = Menu::create(pItmMenu1,pItmMenu2,pItmMenu3,pItmMenu4,pItmMenu5,
pItmMenu6,pItmMenu7,pItmMenu8,pItmMenu9,pItmMenu10,NULL);
mn->alignItemsInColumns(2,2, 2, 2, 2, NULL);
this->addChild(mn);
returntrue;
}
void HelloWorld::OnClickMenu(Ref* pSender)
{
MenuItem*nmitem = (MenuItem*)pSender;
auto sc = Scene::create();
auto layer = MyAction::create();
layer->setTag(nmitem->getTag());
sc->addChild(layer);
autoreScene = TransitionSlideInR::create(1.0f, sc);
Director::getInstance()->replaceScene(reScene);
}