C++ and Lua support for creator alpha1 released

C++ and Lua support for creator alpha1 released
0.0 0


Hi @zhangxm, I have encountered issues with the positions when loading the ui in cocos2dx from the exported files.
Some of the positions look desirable, while some do not.

fire_-2017-08-28 10_33_46
How it looks like in Cocos Creator.

GameCloud-2017-08-28 10_35_10
How it looks like in Cocos2dx


Will you please send me the creator project to reproduce it?


@zhangxm ok have sent you the link~


@Darren_86 i sent the PR to fix it: https://github.com/cocos2d/creator_to_cocos2dx/pull/92. I met problem when parsing your scene, back ground image missed in EditBox, it is needed in cocos2d-x. I think you can use an transparent image to fix it.

And i find your project doesn’t have design resolution setting, i suggest adding a Canvas node as the root of Scene.


@zhangxm thank you for the fix!
ah yes i have missed out sending to you the back ground image and also for the EditBox i’ve modified the parser to allow no image and i create it in the reader code instead.

Indeed after i’ve added the Canvas node, the positions of all the items now look exactly like it is in the Creator. Except for the labels in the icons at the right hand side - their positions appear to be lower than how it is in Creator.


Did you modify engine too? Or could you please share me how you make it work?

Maybe it is something with the PR i sent? I tested in other scenes, haven’t found it. Could you please share a creator project too? Thanks.


Basically in CreatorReader::createEditBox i just hard-coded the sprite to be used for the EditBox creation.

cocos2d::ui::Scale9Sprite* sprite = cocos2d::ui::Scale9Sprite::create(“UI/ui_retangle_cruved_transparent.png”);
auto editBox = ui::EditBox::create(cocos2d::Size(contentSize->w(), contentSize->h()), sprite);

And i’ve just sent you the project now with the canvas.


Got it. You can set the background in plugin, it is more convenient. I have to handle v3.16 releasing these days, so i will look at the issue later.


Something’s wrong with design resolution…
I’ve created an empty project with default Canvas settings (960x640 design resolution, Fit Height) and then I’ve added a simple background (1136x768) inside it.
In editor it looks like this:

Now, in settings I’ve set Simulator Resolution to iPhone 5 (1136x640) and they ran it:

Looking fine, we can see centered image and extended viewport on both sides, because iPhone5 (1136x640) is wider than design resolution (960x640).

Now, I’m trying to run the same thing from cocos2d-x project. I’ve removed all default design resolution code.

Scene* HelloWorld::createScene()
    creator::CreatorReader* reader = creator::CreatorReader::createWithFilename("creator/scene1.ccreator");
    // will create the needed spritesheets + design resolution
    // get the scene graph
    Scene* scene = reader->getSceneGraph();
    return scene;

That gave me this result on iPhone 5 simulator:

I’ve even tried replacing setup() code with this:

void CreatorReader::setup()
    auto director = cocos2d::Director::getInstance();
    auto glview = director->getOpenGLView();
    glview->setDesignResolutionSize(960, 640, ResolutionPolicy::FIXED_HEIGHT);


and got this result:

What’s wrong?


@zhangxm can you take a look?


@piotrros sorry, i can not see the picture, it seems there is an issue of the forum. I have reported the issue to forum maintainer.
@slackmoehrle do you know the reason?


@piotrros i tried to update a picture, there is not problem, i can see it. Could you please send me the picture you uploaded? We are curious if it is something related with the picture.


Here you go:


I will look at why.


@piotrros what format were your images in?


It’s a JPEG 1136x768 pixels.


@piotrros i can see this file, but i can not see it in your above post, it is strange, could you please modify your above post to upload the pictures again? Thanks.


I’ve edited my post, please take a look.


@piotrros thanks.


@piotrros could you please provide a creator project to reproduce it?