axmol/tests/cpp-tests/Classes/testBasic.cpp

53 lines
1.2 KiB
C++
Raw Normal View History

#include "testBasic.h"
#include "controller.h"
#include "extensions/cocos-ext.h"
#include "cocostudio/CocoStudio.h"
2013-11-18 03:43:32 +08:00
TestScene::TestScene(bool bPortrait, bool physics/* = false*/)
{
2013-11-18 03:43:32 +08:00
if (physics)
{
#if CC_USE_PHYSICS
2013-11-18 03:43:32 +08:00
TestScene::initWithPhysics();
#else
Scene::init();
#endif
}
else
{
Scene::init();
}
}
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
}
void TestScene::onEnter()
{
Scene::onEnter();
//add the menu item for back to main menu
//#if (CC_TARGET_PLATFORM == CC_PLATFORM_MARMALADE)
// auto label = LabelBMFont::create("MainMenu", "fonts/arial16.fnt");
//#else
auto label = LabelTTF::create("MainMenu", "Arial", 20);
//#endif
2013-11-23 05:40:32 +08:00
auto menuItem = MenuItemLabel::create(label, testScene_callback );
auto menu = Menu::create(menuItem, NULL);
menu->setPosition( Point::ZERO );
menuItem->setPosition( Point( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) );
addChild(menu, 1);
}