2012-04-19 14:35:52 +08:00
|
|
|
#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)
|
2012-06-14 15:13:16 +08:00
|
|
|
// CCLabelBMFont* label = CCLabelBMFont::create("MainMenu", "fonts/arial16.fnt");
|
2012-04-19 14:35:52 +08:00
|
|
|
//#else
|
2012-06-14 15:13:16 +08:00
|
|
|
CCLabelTTF* label = CCLabelTTF::create("MainMenu", "Arial", 20);
|
2012-04-19 14:35:52 +08:00
|
|
|
//#endif
|
2012-06-14 15:13:16 +08:00
|
|
|
CCMenuItemLabel* pMenuItem = CCMenuItemLabel::create(label, this, menu_selector(TestScene::MainMenuCallback));
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2012-06-14 15:13:16 +08:00
|
|
|
CCMenu* pMenu =CCMenu::create(pMenuItem, NULL);
|
2012-10-23 17:48:50 +08:00
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
pMenu->setPosition( CCPointZero );
|
2012-10-23 17:48:50 +08:00
|
|
|
pMenuItem->setPosition( ccp( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) );
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
addChild(pMenu, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TestScene::MainMenuCallback(CCObject* pSender)
|
|
|
|
{
|
2012-06-14 15:13:16 +08:00
|
|
|
CCScene* pScene = CCScene::create();
|
2012-04-19 14:35:52 +08:00
|
|
|
CCLayer* pLayer = new TestController();
|
|
|
|
pLayer->autorelease();
|
|
|
|
|
|
|
|
pScene->addChild(pLayer);
|
|
|
|
CCDirector::sharedDirector()->replaceScene(pScene);
|
|
|
|
}
|