C++ support for Cocos Creator

C++ support for Cocos Creator
0.0 0

#132

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");
reader->setup();
auto scene = reader->getSceneGraph();
director->runWithScene(scene);

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

add binding codes in c++

#include "reader/CreatorReaderBinding.h"

...

register_all_creator_reader_manual(L);

use in lua

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

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


#133

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

Update:
Working fine on Android.


#134

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.


#135

@zhangxm no, only on mac.

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


#136

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


#137

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


#138

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

Edit: you should sync the repo before trying.


#139

IMPORTANT:

New repository is here:

Moved from my account to the cocos2d organization.


#140

Yes, now its working.

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


#141

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

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

scene->getChildByName("");

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


#142

事例工程编译不过啊,rapidxml_sax3.hpp找不到。


#143

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


#144

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


#145

@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.


#146

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.


#147

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?
#148

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.


#149

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.


#150

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.


#151

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.