First time Cocos user

Hi there, i’ve been looking for c++ 2d game engine for a while now and i stumbled on Cocos creator.
I’ve done some research and found out that it doesn’t support c++ only with a plugin (or this what i think)
I took a look at this http://cocos2d-x.org/docs/cocos2d-x/en/editors_and_tools/creator_to_cocos2dx.html and i kinda find it little ambiguous (not that good at english btw).
So anyone can help me through this, like does this work step by step, like what happen after i press the build button in the plugin window, will that export the current scene to a specific cocos2d-x project? and if yes what should i do next?
And am using vs2015 hopefully to code things with, is there any configuration required for it or something i need to know?
Feel free to point me to related topics/tutorials if what i asked already exist somewhere else.

I use cocos2d-x c++ 3.16 with VS2013 and Creator and it works more or less well.

When you hit ‘build’ it compiles all the creator data into a protobuf format into the resources folder, and you need to use the CreatorReader.cpp files in your project to import them. I can’t remember the actual fileformats to help specify but my workflow is auto-build on save in Creator, and it builds the usable files into the Resources folder of my game and I go.

The instructions are pretty alright, I used them too, just make sure you use the reader/ cpp files in your project and you should be good to go. If you’ve got more specific questions, reply to me here and I’ll do my best to answer.

2 Likes

When exporting to c++ Creator will produce cpp and .h files that you can drop into your Cocos2d-x projects and use. If you think the link is not enough, perhaps we can make it more clear and provide more examples.

1 Like

Ok, that helped a little tbh and thnx
I think i still lack the knowledge of the basic things here, even tho i watched some videos, read some posts and still didn’t figure it out like they are skipping some parts cu’z they think ppl already know them, and in my case i don’t.
I pressed the Build button, now i got some files added to Classes\reader folder leaving this aside for now, let’s say i wonna open the c2dx project with vs, i go to proj.win32 folder and open the .sln file and run it, then i get the hello world default scene/project opened, now the question is like u said, how can i use those generated reader/ cpp files and the others in Resources\creator folder?
And what is this and where should i put it (found it in the plugin’s doc)

reader

The generated reader/ files go into your Classes folder (or anywhere else your include files go), but so long as your target is set up to the root of your project, where mine is roguebreaker/, it should work

I checked Export Resource Only because I modified the source for the reader files, but you wouldn’t need to worry about that.

This is the line I run to import the node into my game

cocos2d::Node* get_prebuilt_node_from_creator(std::string path)
{
	creator::CreatorReader* reader = creator::CreatorReader::createWithFilename(path);
	CCASSERT(reader != NULL, "possibly incorrect node path, maybe you need to remove the scene suffix?");


	cocos2d::Node* node = reader->getSceneGraph();
	return node;
}

where I call it something like

cocos2d::Scene* scene = dynamic_cast<cocos2d::Scene*>(get_prebuilt_node_from_creator("creator/scenes/rogueout/level_editor_scene.ccreator"));

where creator/scenes/[..] is a folder within my Resources/ folder.

I think this kinda of an advance step for my current learning path, guess i need to look up for more beginners contents somewhere else, i know i will be back for this, thnx mate

To add new files to Visual Studio, check this out: https://youtu.be/dn1NzbT1S_Q?t=37

Good luck dude, you’ll get it!