Cocostudio::SceneReader Loading Resources to Visual studio

Hello,

I am trying to load resources generated from cocostudio to visual studio project. My cocos2d version is 3.2rc0
Auto generated project file (via “cocos new” command) (proj.win32) for visual studio orginaly contains mygame, libAudio, libchipmunk, libcocos2d so I added libCocosStudio project aswell. Without it there were include problems. Classes were not found problems.

Than I use http://upyun.cocimg.com/CocoStudio/helpdoc/v1.0.0.0/en/index.html this link and code block at the end of the page to load resources. When I try to compile project I got these errrors.

Warning	1	warning C4996: 'cocos2d::GL::deleteTextureN': was declared deprecated	c:\flashy\flashy\cocos2d\cocos\deprecated\ccdeprecated.h	1023
Error	2	error C2061: syntax error : identifier 'CocoLoader'	c:\flashy\flashy\cocos2d\cocos\editor-support\cocostudio\ccsscenereader.h	80
Error	3	error C2061: syntax error : identifier 'CocoLoader'	c:\flashy\flashy\cocos2d\cocos\editor-support\cocostudio\ccsscenereader.h	81
Warning	4	warning C4996: 'cocos2d::CCScene': was declared deprecated	c:\flashy\flashy\classes\helloworldscene.cpp	38
Warning	5	warning C4996: 'cocos2d::CCNode': was declared deprecated	c:\flashy\flashy\classes\helloworldscene.cpp	40
Error	6	error C1903: unable to recover from previous error(s); stopping compilation	C:\flashy\flashy\proj.win32\c1xx

here is my code block

bool HelloWorld::init()

{
//////////////////////////////
// 1. super init first
if ( !Layer::init() )
{
return false;
}

//cocostudio::SceneReader readme;

//Creat new scene
CCScene * newscene  = CCScene::create(); 
//Creat root node frome export file by scene editor.
CCNode *pNode = cocostudio::SceneReader::getInstance()->createNodeWithSceneFile("publish/FishJoy2.json");

//Get a audio component by name
cocostudio::ComAudio *pAudio = (cocostudio::ComAudio*)(pNode->getComponent("Audio")); 
//paly audio
pAudio->playBackgroundMusic(pAudio->getFile(), pAudio->isLoop()); 
//Get a ComRender component by tag
cocostudio::ComRender *pFishRender = (cocostudio::ComRender*)(pNode->getChildByTag(10010)->getComponent( "butterFlyFish")); 
//convert to armature
cocostudio::CCArmature *pButterFlyFish= (cocostudio::CCArmature *)(pFishRender->getNode()); 
pButterFlyFish->getAnimation()->playByIndex(0); 
//add the node to new scene
newscene->addChild(pNode, 0, 1); 
//replace scene
CCDirector::sharedDirector()->replaceScene(newscene); 

return true;

}

The help on the page you mentioned is a bit outdated. Try this Where is UIHelper?

I sloved errors above by adding CocoLoader.h However now I got some other errors. (Missing libraries etc… I added some of the errors belove.)

My problem is actually very simple. I want to use exported resources from Cocostudio. What must be the solution configuration ? which projects to add, which libraries to add. ect …
Actually it could be very nice if these settings can be done during project creating at console, such as “cocos new -libs cocostudio cocogui” etc…

1>libCocosStudio.lib(CCSGUIReader.obj) : error LNK2019: unresolved external symbol “public: void __thiscall cocos2d::ui::Widget::setPositionPercent(class cocos2d::Vec2 const &)”

Try to add libGUI and libExtension. Also add build dependencies on vs to libGUI and libExtension. Maybe you also need to add some include-paths.

$(EngineRoot)cocos\editor-support

Thanks, by adding each required library and include paths I’ve managed to compile project. However nothing is rendered on the window. Only background music is playing. I am using fishjoy2 sample project.

Here are codes.

CCScene * newscene = CCScene::create();
CCNode *pNode = cocostudio::SceneReader::getInstance()->createNodeWithSceneFile(“publish/FishJoy2.json”);
newscene->addChild(pNode, 0, 1);
CCDirector::sharedDirector()->runWithScene(newscene);

Try it like this:

auto scene = cocostudio::SceneReader::getInstance()->createNodeWithSceneFile("publish/FishJoy2.json");
this->addChild(scene);

This needs to be in a init() method of a new Scene (for example the HelloWorldScene.cpp)