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

40 lines
942 B
C++
Raw Normal View History

#include "testBasic.h"
#include "controller.h"
#include "extensions/cocos-ext.h"
#include "cocostudio/CocoStudio.h"
TestScene::TestScene(bool bPortrait)
{
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
TTFConfig ttfConfig("fonts/arial.ttf", 20);
auto label = Label::createWithTTF(ttfConfig,"MainMenu");
2013-11-23 05:40:32 +08:00
auto menuItem = MenuItemLabel::create(label, testScene_callback );
auto menu = Menu::create(menuItem, NULL);
menu->setPosition( Vector2::ZERO );
menuItem->setPosition( Vector2( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) );
addChild(menu, 1);
}