C++ support for Cocos Creator

C++ support for Cocos Creator
0.0 0


I am working on the creator plugin. Currently i finished most things. The steps to use the plugin is:

You you find all needed source codes are copied to NATIVE_PROJECT_ROOT/Classes/reader(it is NATIVE_PROJECT_ROOT/frameworks/runtime-src/Classes in lua), and all resources are copied to NATIVE_PROJECT_ROOT/Resources/creator(it is NATIVE_PROJECT_ROOT/res/creator in lua).

You can just use the readers and resources in your project to have a test. If using c++, then you need to add these codes

#include "reader/CreatorReader.h"

auto reader = creator::CreatorReader::createWithFilename("creator/CreatorSprites.ccreator");
auto scene = reader->getSceneGraph();

If using lua, then you need to add these codes in c++ and lua.

add binding codes in c++

#include "reader/CreatorReaderBinding.h"



use in lua

local creatorReader = cc.CreatorReader:createWithFilename('creator/CreatorSprites.ccreator')
local scene = creatorReader:getSceneGraph()

Please let me know if you meet any problem. Thanks.


Thanks for sharing details.
So i tried all steps.
I have problem with loading CreatorReader.

This line gives me 62 errors.
I am testing on cocos2d-x 3.14.1 C++ VS-2013

Working fine on Android.


It seems it is the error of reader, not in plugin. @ricardo did you try the reader in windows? I haven’t tried it on windows, i will have a try.


@zhangxm no, only on mac.

@smitpatel88 could you try it with vs-2015? thanks.


@ricardo i tested in VS2015, the same issue. I will try to fix it if possible.


@zhangxm I guess it is fixed. I made the changes that you suggested:


@ricardo yep, it is fixed.
@smitpatel88 could you please try again.

Edit: you should sync the repo before trying.



New repository is here:

Moved from my account to the cocos2d organization.


Yes, now its working.

Tried with this new repository.
Can you tell me how we can fetch the individual elements from creator scene?
Also how to give callback funct to buttons, etc?


@smitpatel88 i think you can use scene node to get other child by name, such as

auto reader = creator::createWithFilename(...);
auto scene = reader->getSceneGraph();


It is just my guess. Let’s wait @ricardo’s answer.




yes, as @zhangxm said.
just get the node by name, and the add the callback manually.


:heart: GREAT work!!! @ricardo very impressive, especially how persistent you are!


@ricardo Finally c++ thing inside creator 1.4. very soon I am about to implement. I am excited to work with it my first own game to develop with creator 1.4. Thanks a lot.


I’d be a little wary still. I’m reluctantly using it because some of my team members work better with GUIs than code, but it’s closed source and feels very much like beta quality software still, so if stuff breaks, you’re at the mercy of the Cocos developers and their release cycles, bureaucracy, etc. Scary enough for me not to try my luck betting a production game on it yet.


well, thanks for your info. If this is what happen, its better to try develop project in cocos studio with cocos2dx-3.10 because studio file is possible to import in creator now. still i have 1 month before to start coding for my project, so lets see if any update comes in between.

Cocos Creator for c++, how much time?

You can use cocos2d-x 3.14 with cocos studio no problem. You just need to copy cocos studio files from old cocos2d-x 3.10 project.


can you explain how to make it work with 3.14 because i don’t see any libraries of cocos studio in 3.14. that will be great help for me because between 3.10 to 3.14 lots of changes while my target platform is Android for the project.


cocos/editor-support/cocostudio - runtimes are here untouched. The different is with project template, in 3.14 you don’t have cocosstudio directory + ccs/cfg/udf files.


HI @ricardo i built successfully the c++ creator but when i try to create my own scene and complie it, i dont see any ‘myscene.ccreator’ in the resource folder.

Edit: i solved the issues. The reason i used drag and drop texture directly to the scene editor instead of using node library and put texture into it. When compile it, the console log just got some errors while parsing data. Dont know why.