axmol/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/CustomTest/CustomImageTest/CustomImageTest.cpp

48 lines
1.0 KiB
C++
Raw Normal View History

2014-03-04 16:51:35 +08:00
#include "CustomImageTest.h"
2014-03-05 21:18:51 +08:00
#include "../../CustomGUIScene.h"
2014-03-04 16:51:35 +08:00
#include "../../CustomWidget/CustomImageView.h"
#include "../../CustomWidget/CustomImageViewReader.h"
#include "../../CustomWidget/CustomReader.h"
#include "cocostudio/CCSGUIReader.h"
2014-03-07 15:36:45 +08:00
USING_NS_CC;
USING_NS_CC_EXT;
2014-03-04 16:51:35 +08:00
2014-03-26 14:54:50 +08:00
// CustomImageLayer
bool CustomImageLayer::init()
2014-03-04 16:51:35 +08:00
{
if (Layer::init())
{
GUIReader* guiReader = GUIReader::getInstance();
guiReader->registerTypeAndCallBack("CustomImageView",
&CustomImageView::createInstance,
CustomImageViewReader::getInstance(),
parseselector(CustomImageViewReader::setProperties));
Layout* layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/CustomImageViewTest/NewProject_2_1.ExportJson"));
addChild(layout);
return true;
}
2014-03-04 16:51:35 +08:00
return false;
2014-03-04 16:51:35 +08:00
}
2014-03-26 14:54:50 +08:00
// CustomImageScene
2014-03-04 16:51:35 +08:00
bool CustomImageScene::init()
2014-03-04 16:51:35 +08:00
{
if (TestCase::init())
{
addChild(CustomImageLayer::create());
2014-03-04 16:51:35 +08:00
return true;
}
2014-03-04 16:51:35 +08:00
return false;
2014-03-04 16:51:35 +08:00
}