mirror of https://github.com/axmolengine/axmol.git
39 lines
1.1 KiB
C++
39 lines
1.1 KiB
C++
#include "testBasic.h"
|
|
#include "controller.h"
|
|
|
|
TestScene::TestScene(bool bPortrait)
|
|
{
|
|
|
|
CCScene::init();
|
|
}
|
|
|
|
void TestScene::onEnter()
|
|
{
|
|
CCScene::onEnter();
|
|
|
|
//add the menu item for back to main menu
|
|
//#if (CC_TARGET_PLATFORM == CC_PLATFORM_MARMALADE)
|
|
// CCLabelBMFont* label = CCLabelBMFont::labelWithString("MainMenu", "fonts/arial16.fnt");
|
|
//#else
|
|
CCLabelTTF* label = CCLabelTTF::labelWithString("MainMenu", "Arial", 20);
|
|
//#endif
|
|
CCMenuItemLabel* pMenuItem = CCMenuItemLabel::itemWithLabel(label, this, menu_selector(TestScene::MainMenuCallback));
|
|
|
|
CCMenu* pMenu =CCMenu::menuWithItems(pMenuItem, NULL);
|
|
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
|
pMenu->setPosition( CCPointZero );
|
|
pMenuItem->setPosition( CCPointMake( s.width - 50, 25) );
|
|
|
|
addChild(pMenu, 1);
|
|
}
|
|
|
|
void TestScene::MainMenuCallback(CCObject* pSender)
|
|
{
|
|
CCScene* pScene = CCScene::node();
|
|
CCLayer* pLayer = new TestController();
|
|
pLayer->autorelease();
|
|
|
|
pScene->addChild(pLayer);
|
|
CCDirector::sharedDirector()->replaceScene(pScene);
|
|
}
|