开发环境 vs2013
#include “HelloWorldScene.h”
#include “cocostudio/CocoStudio.h”
#include “cocos-ext.h”
using namespace cocostudio;
//添加命名空间
USING_NS_CC;
USING_NS_CC_EXT;
Scene* HelloWorld::createScene()
{
// ‘scene’ is an autorelease object
auto scene = Scene::create();
// 'layer' is an autorelease object
auto layer = HelloWorld::create();
// add layer as a child to scene
scene->addChild(layer);
// return the scene
return scene;
}
// on “init” you need to initialize your instance
bool HelloWorld::init()
{
//////////////////////////////
// 1. super init first
if ( !Layer::init() )
{
return false;
}
Size visibleSize = Director::getInstance()->getVisibleSize();
Point origin = Director::getInstance()->getVisibleOrigin();
UILayer * uiLayer = UILayer::create(); //老是说UILayer不存在的类型。
auto myLayout = cocostudio::GUIReader::shareReader()->widgetFromJsonFile("testUI.ExportJson")); //alpha1中使用
uiLayer->addWidget(myLayout);
this->addChild(uiLayer);
return true;
}
void HelloWorld::menuCloseCallback(Object* pSender)
{
Director::getInstance()->end();
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
exit(0);
#endif
}
UILayer * uiLayer = UILayer::create(); //老是说UILayer不存在的类型。