axmol/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScene_Editor.cpp

65 lines
1.2 KiB
C++
Raw Normal View History

2014-03-04 16:51:35 +08:00
#include "UIScene_Editor.h"
#include "GUIEditorTest.h"
2014-03-11 17:13:54 +08:00
#include "ui/CocosGUI.h"
2014-03-04 16:51:35 +08:00
#include "UISceneManager_Editor.h"
UIScene_Editor::UIScene_Editor()
: _touchGroup(nullptr)
, _layout(nullptr)
, _sceneTitle(nullptr)
2014-03-04 16:51:35 +08:00
{
}
UIScene_Editor::~UIScene_Editor()
{
}
bool UIScene_Editor::init()
{
if (TestCase::init())
2014-03-04 16:51:35 +08:00
{
_touchGroup = Layer::create();
addChild(_touchGroup);
2014-07-01 14:21:27 +08:00
2014-03-04 16:51:35 +08:00
return true;
}
return false;
}
void UIScene_Editor::onEnter()
2014-07-01 14:21:27 +08:00
{
TestCase::onEnter();
2014-07-01 14:21:27 +08:00
if (_sceneTitle)
2014-03-04 16:51:35 +08:00
{
_sceneTitle->setString(getTestCaseName());
2014-03-04 16:51:35 +08:00
}
}
void UIScene_Editor::onExit()
2014-03-04 16:51:35 +08:00
{
cocostudio::destroyCocosStudio();
TestCase::onExit();
2014-03-04 16:51:35 +08:00
}
void UIScene_Editor::configureGUIScene()
2014-03-04 16:51:35 +08:00
{
if (_touchGroup)
2014-03-04 16:51:35 +08:00
{
Size screenSize = CCDirector::getInstance()->getWinSize();
Size rootSize = _layout->getContentSize();
_touchGroup->setPosition(Vec2((screenSize.width - rootSize.width) / 2,
(screenSize.height - rootSize.height) / 2));
2014-03-04 16:51:35 +08:00
}
if (_layout)
{
Layout* root = static_cast<Layout*>(_layout->getChildByName("root_Panel"));
_sceneTitle = static_cast<Text*>(Helper::seekWidgetByName(root, "UItest"));
}
}