C++ and Lua support for creator alpha0 released

@kwellman after dig into creator, i found the plugin already supports widgets, but the widget can only AlignOnce. If want to support align in runtime, then

  • plugin should retain the target it aligns to and the node which is will do align
  • when the target or node is deleted by codes, then plugin(reader and other codes) doesn’t know it, so target and node will not been deleted, which is error.

If plugin doesn’t retain them, then they will be wild pointer. So we can only align the Widget once.

If I want to BUILD… I got this error:
I have to buttons in the scene… the state (normal/pressed) is marked with COLOR as transition - not with sprite.

Did you use latest github codes? Could you please provide a creator project to reproduce it? Thanks.

Hi, I’ve desperately trying to run example project, but it just doesn’t work. I’ve added “reader” in my Classes directory (via Xcode), I can include: #include “reader/CreatorReader.h” but when trying to run the app I’m getting tons of linker errors. Can you provide already configured HelloWorld project with creator support? Note that I’m using precompiled cocos2d-x (3.14.1). Should I have to include reader classes inside cocos and recompile library or can they be outside of it?

32

I think you don’t include reader folder correctly, how did you include it? Could you please should me the screenshot of Xcode folder structure? Yep, i will use a branch of my personal cocos2d-x repo to test the plugin in future.

23

Great job!

You should add reader as yellow folder as Classes, not blue folder.

Thanks, now I’m getting:

Is it a lua project? And what’s the plugin version you used?

No, it’s c++ project. I’ve just updated code to the latest version and it’s still the same problem.

Is there a file named config.json in the root of your project? Now the plugin use it to check if it is a lua project or not. CreatorReaderBinding.h/cpp will be copied if it is a lua project.

I don’t have such a file.
I have an existing cocos2d-x project and I wanted to add creator support to it, so I’ve copied all files from packages/creator-luacpp-support/reader.

Removing CreatorReaderBinding.cpp and CreatorReaderBinding.h removed that error.

I just wanted to show simple demo scene in my game like this (in AppDelegate.cpp):

FileUtils::getInstance()->addSearchPath("creator"); //TRIED this but didn't help
creator::CreatorReader* reader = creator::CreatorReader::createWithFilename("creator/CreatorAnim.ccreator");
reader->setup();
Scene* scene = reader->getSceneGraph();
director->runWithScene(scene);

But I’m getting following crash:

I’ve made sure all files are present:

I’ve tried as well moving it into res directory.

Just before crash I’m seeing this in logs:

Adding sprite frame: grossini_dance_08.png

This file is present as you can see on the screenshot above.

Is there a step by step tutorial how to add creator support to an existing cocos2d-x project?

No, you don’t have to copy these files manually, the plugin will copy the files automatically, and the plugin will not copy luabinding related files. I thin you can reader the README.

Ok, I’ve followed this tutorial and the problem is when I’m selecting my cocos2d-x project and using “Build now” from cocos creator it “thinks” it’s a lua project, because it creates frameworks directory.

As i mentioned above, it just check if there is a config.json in root. Does your project include this file?

Yes, there’s config.json now:

{
“init_cfg”: {
“isLandscape”: true,
“width”: 960,
“height”: 640
}
}

It is strange, what’s your engine version? I don’t have config.json in new cpp project. Maybe i should use other way to check project type.

It’s 3.14.1 I believe. I didn’t have config.json either. Cocos creator created it I guess.
Maybe it doesn’t work, because I’m using precompiled libs? (no cocos2d-x directory inside project).

How did you create your project? The plugin is used for cocos2d-x projects, not for Cocos Creator projects.