2012-04-19 14:35:52 +08:00
|
|
|
#include "testBasic.h"
|
|
|
|
#include "controller.h"
|
2013-10-16 16:48:39 +08:00
|
|
|
#include "extensions/cocos-ext.h"
|
2013-10-16 11:19:01 +08:00
|
|
|
#include "cocostudio/CocoStudio.h"
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-11-18 03:43:32 +08:00
|
|
|
TestScene::TestScene(bool bPortrait, bool physics/* = false*/)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-11-18 03:43:32 +08:00
|
|
|
if (physics)
|
|
|
|
{
|
2013-12-26 23:55:05 +08:00
|
|
|
#if CC_USE_PHYSICS
|
2013-11-18 03:43:32 +08:00
|
|
|
TestScene::initWithPhysics();
|
|
|
|
#else
|
|
|
|
Scene::init();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Scene::init();
|
|
|
|
}
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2014-02-20 10:53:49 +08:00
|
|
|
void testScene_callback(Ref *sender )
|
2013-11-23 05:40:32 +08:00
|
|
|
{
|
|
|
|
auto scene = Scene::create();
|
|
|
|
|
|
|
|
auto layer = new TestController();
|
|
|
|
scene->addChild(layer);
|
|
|
|
layer->release();
|
|
|
|
|
|
|
|
Director::getInstance()->replaceScene(scene);
|
|
|
|
|
2013-12-27 20:54:05 +08:00
|
|
|
cocostudio::ArmatureDataManager::destroyInstance();
|
2013-11-23 05:40:32 +08:00
|
|
|
}
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
void TestScene::onEnter()
|
|
|
|
{
|
2013-06-20 14:17:10 +08:00
|
|
|
Scene::onEnter();
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
//add the menu item for back to main menu
|
|
|
|
//#if (CC_TARGET_PLATFORM == CC_PLATFORM_MARMALADE)
|
2013-08-16 16:05:27 +08:00
|
|
|
// auto label = LabelBMFont::create("MainMenu", "fonts/arial16.fnt");
|
2012-04-19 14:35:52 +08:00
|
|
|
//#else
|
2013-08-16 16:05:27 +08:00
|
|
|
auto label = LabelTTF::create("MainMenu", "Arial", 20);
|
2012-04-19 14:35:52 +08:00
|
|
|
//#endif
|
2013-11-23 05:40:32 +08:00
|
|
|
auto menuItem = MenuItemLabel::create(label, testScene_callback );
|
|
|
|
auto menu = Menu::create(menuItem, NULL);
|
2012-10-23 17:48:50 +08:00
|
|
|
|
2013-07-24 06:20:22 +08:00
|
|
|
menu->setPosition( Point::ZERO );
|
|
|
|
menuItem->setPosition( Point( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) );
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-07-24 06:20:22 +08:00
|
|
|
addChild(menu, 1);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|