求助,关于vs2015和cocoStudio3.1的问题

qwerobyr 2016-08-18 04:56:22
小白一枚,按照教程在CocoStudio上制作了一个游戏的初始场景,然后在VS2015的项目上修改了代码,想要替换HelloWorld的画面,也就是在vs上导入.csb文件,修改代码后,程序可运行,但是是黑屏的,画面并不能正常显示。找了很多办法,始终没有解决,请大神指点一下,告诉一下解决方法吧,谢谢!




这是代码
h文件

#pragma once
#ifndef __Login_SCENE_H__
#define __Login_SCENE_H__

#include "cocos2d.h"

class Login : public cocos2d::Layer
{
public:
static cocos2d::Scene* createScene();

virtual bool init();

// a selector callback
void menuCloseCallback(cocos2d::Ref* pSender);

};
CREATE_FUNC(Login);

#endif // __Login_SCENE_H__



cpp文件

#include "LoginScene.h"
#include "SimpleAudioEngine.h"
#include "cocostudio/CocoStudio.h"
#include "ui/CocosGUI.h"

USING_NS_CC;

using namespace cocostudio::timeline;

Scene* Login::createScene()
{
// 'scene' is an autorelease object
auto scene = Scene::create();

// 'layer' is an autorelease object
auto layer = Login::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 Login::init()
{
//////////////////////////////
// 1. super init first
if (!Layer::init())
{
return false;
}

auto pNode = CSLoader::createNode("MainScene.csb");
auto rootNode = CSLoader::createNode("LoginScene.csb");
this->addChild(pNode);
this->addChild(rootNode);

return true;
}


void Login::menuCloseCallback(Ref* pSender)
{
//Close the cocos2d-x game scene and quit the application
Director::getInstance()->end();

#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
exit(0);
#endif

/*To navigate back to native iOS screen(if present) without quitting the application ,do not use Director::getInstance()->end() and exit(0) as given above,instead trigger a custom event created in RootViewController.mm as below*/

//EventCustom customEndEvent("game_scene_close_event");
//_eventDispatcher->dispatchEvent(&customEndEvent);


}


...全文
704 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复

721

社区成员

发帖
与我相关
我的任务
社区描述
Cocos2d-x相关内容讨论专区
社区管理员
  • Cocos2d-x
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧