.h:
void Play(Ref *pSender);
void Highscore(Ref *pSender);
void Settings(Ref *pSender);
.cpp
// Menu
auto menu_item_1 = MenuItemFont::create("Play",CC_CALLBACK_1(HelloWorld::Play,this));
auto menu_item_2 = MenuItemFont::create("Highscore",CC_CALLBACK_1(HelloWorld::Highscore,this));
auto menu_item_3 = MenuItemFont::create("Settings",CC_CALLBACK_1(HelloWorld::Settings,this));
menu_item_1->setPosition(Point(visibleSize.width/2,(visibleSize.height/4)*3));
menu_item_2->setPosition(Point(visibleSize.width/2,(visibleSize.height/4)*2));
menu_item_3->setPosition(Point(visibleSize.width/2,(visibleSize.height/4)*1));
auto *menu = Menu::create(menu_item_1,menu_item_2,menu_item_3,NULL);
menu->setPosition(Point(origin.x,origin.y));
this->addChild(menu);
void HelloWorld::Play(Ref *pSender)
{
CCLOG("Play");
}
void HelloWorld::Highscore(Ref *pSender)
{
CCLOG("Highscore");
}
void HelloWorld::Settings(Ref *pSender)
{
CCLOG("Settings");
}
Inga kommentarer:
Skicka en kommentar