Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon


11. April 2017

 

Cocos Creator is a full game engine and editor powered by JavaScript created by the team behind the Cocos2d-x project.  If you want to learn more about the Cocos Creator project be sure to check out our hands on video.  Today Cocos Creator learned a new trick in the form of C++ and Lua support for creator alpha zero.  This doesn’t actually add C++ or Lua language support to Cocos Creator editor.  Instead it’s a pair of new features.  First Cocos Creator is now capable of exporting projects in .ccreator file format.  Second they have provided a reader enabling Lua and C++ Cocos2d-x projects to read and use ccreator files.  Essentially this enables Cocos Creator to be an editor for your C++/Lua Cocos games.  Loading the scene in C++ is simple as illustrated by this code:

#include "reader/CreatorReader.h"

void some_function()
{
    creator::CreatorReader* reader = creator::CreatorReader::createWithFilename("creator/CreatorSprites.ccreator");

    // will create the needed spritesheets + design resolution
    reader->setup();

    // get the scene graph
    Scene* scene = reader->getSceneGraph();

    // ...and use it
    Director::getInstance()->replaceScene(scene);
}

 

Details from the Cocos Creator forum:

What's C++ and lua support for creator

It includes two parts:

  • First, it is a Cocos Creator plugin that can export scenes generated by Cocos Creator into .ccreator files.
  • Second, it has a reader that can parse .ccreator files. The reader can be used in cocos2d-x c++/lua project.

Download

There are two ways to get the plugin

GameDev News

blog comments powered by Disqus

Month List

Popular Comments