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-22 21:08:05 +08:00
|
|
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
|
2014-03-04 16:51:35 +08:00
|
|
|
#pragma mark -
|
|
|
|
#pragma mark CustomImageLayer
|
|
|
|
#pragma mark -
|
2014-03-22 21:08:05 +08:00
|
|
|
#endif
|
2014-03-04 16:51:35 +08:00
|
|
|
|
|
|
|
void CustomImageLayer::onEnter()
|
|
|
|
{
|
|
|
|
Layer::onEnter();
|
|
|
|
|
|
|
|
GUIReader* guiReader = GUIReader::getInstance();
|
|
|
|
guiReader->registerTypeAndCallBack("CustomImageView",
|
|
|
|
&CustomImageView::createInstance,
|
|
|
|
CustomImageViewReader::getInstance(),
|
|
|
|
parseselector(CustomImageViewReader::setProperties));
|
|
|
|
|
2014-03-11 17:13:54 +08:00
|
|
|
Layout* layout = static_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("cocosui/CustomImageViewTest/NewProject_2_1.ExportJson"));
|
2014-03-04 16:51:35 +08:00
|
|
|
addChild(layout);
|
|
|
|
}
|
|
|
|
|
2014-03-22 21:08:05 +08:00
|
|
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
|
2014-03-04 16:51:35 +08:00
|
|
|
#pragma mark -
|
|
|
|
#pragma mark CustomImageScene
|
|
|
|
#pragma mark -
|
2014-03-22 21:08:05 +08:00
|
|
|
#endif
|
2014-03-04 16:51:35 +08:00
|
|
|
|
|
|
|
void CustomImageScene::onEnter()
|
|
|
|
{
|
|
|
|
CCScene::onEnter();
|
|
|
|
|
|
|
|
LabelTTF* label = LabelTTF::create("Back", "Arial", 20);
|
|
|
|
//#endif
|
|
|
|
MenuItemLabel* pMenuItem = MenuItemLabel::create(label, CC_CALLBACK_1(CustomImageScene::BackCallback, this));
|
|
|
|
|
|
|
|
Menu* pMenu = Menu::create(pMenuItem, NULL);
|
|
|
|
|
|
|
|
pMenu->setPosition( Point::ZERO );
|
|
|
|
pMenuItem->setPosition( Point( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) );
|
|
|
|
|
|
|
|
addChild(pMenu, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CustomImageScene::runThisTest()
|
|
|
|
{
|
|
|
|
Layer* pLayer = new CustomImageLayer();
|
|
|
|
addChild(pLayer);
|
|
|
|
pLayer->release();
|
|
|
|
|
|
|
|
CCDirector::getInstance()->replaceScene(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CustomImageScene::BackCallback(Ref* pSender)
|
|
|
|
{
|
|
|
|
CustomGUITestScene* pScene = new CustomGUITestScene();
|
|
|
|
pScene->runThisTest();
|
|
|
|
pScene->release();
|
|
|
|
}
|