#include “HelloWorldScene.h”
#include “CocoStudio.h”
USING_NS_CC;
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;
}
return true;
}
void HelloWorld::menuCloseCallback(Ref* pSender)
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
MessageBox(“You pressed the close button. Windows Store Apps do not implement a close button.”,“Alert”);
return;
#endif
Director::getInstance()->end();
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
exit(0);
#endif
}
void HelloWorld::onEnter()
{
CCNode *pGameScene = cocostudio::SceneReader::getInstance()->createNodeWithSceneFile(CCString::create(“FishJoy2.JSON”)->getCString());
//将场景添加到当前场景
this->addChild(pGameScene);
}
FishJoy2.JSON 是cocos2dx 3.2 自带的,我拿来用了。 运行时候报出 Expression: act !=nullptr
怎么回事啊? 求大神解答