I want to share with you a really cool editor for cocos2d-x.
Probably someone of you have already heard about SpriteBuilder(aka CocosBuilder). It’s an editor initially developed by Viktor Lidholt. Later some companies continued its development and support.
But lets skip all this. I will just say, that final supported version of SpriteBuilder for cocos2d-iphone was abandoned by apportable in 2014.
However it was picked up by newnon · GitHub and I can say “ported” to cocos2d-x. Because SpriteBuilder development based on cocos2d-iphone. Many things was tweaked and modified to support it. That was a really huge task. Many thanks for that.
And so, what we have today is SpriteBuilderX - editor for Cocos2d-X v3.x
Main window
bool HelloWorld::init() {
if ( !Node::init() ) {
return false;
}
CCBX_SIMPLE_MEMBER_VARIABLE(cocosLogoSprite);
CCBX_SIMPLE_MEMBER_VARIABLE(labelHello);
CCBX_SIMPLE_MEMBER_VARIABLE(clickedLabel);
CCBX_SIMPLE_SELECTOR_CLICK(click);
//custom loader
cocos2d::spritebuilder::NodeLoaderLibrary *library = NodeLoaderLibrary::getDefault();
library->registerNodeLoader("CocosLogo", &CocosLogoSpriteLoader::create);
//simple loader, just examlpe, not been used or created in SBX
using LevelNodeLoader = SimpleNodeLoader<LevelNode>;
library->registerNodeLoader("LevelNode", &LevelNodeLoader::create);
CCBXReader *reader = CCBXReader::createFromFile("HelloWorldScene.ccbi");
cocos2d::Node * scene = reader->createNode(this, SceneScaleType::MINSCALE);
this->addChild(scene);
_labelHello->setString(StringUtils::format("Hello\nCocos2d-x v%s",_cocosLogoSprite->version.c_str()));
return true;
}
##Result
Everything is WYSIWYG. You can test your scenes under any resolution you need:
Publish to both platforms iOS & Android with different options:
Supported compression formats:
##How it works with Cocos2d-x v3.x
SpriteBuilderX requires the use of GitHub - newnon/cocos2d-x: cocos2d for iOS, Android, Win32 and OS X. Built using C++ (pease use latest branch from it, currently it’s GitHub - newnon/cocos2d-x at v3.13.1)
This fork includes all up to date modifications from official cocos2d-x repo and also loader for ccbi files created in SpriteBuilderX.
Demo project
Github: GitHub - KAMIKAZEUA/SpriteBuilderX-Demo: Simple demo for SpriteBuilderX
##SpriteBuilderX Github
Repo: GitHub - newnon/SpriteBuilderX
Issues: Issues · newnon/SpriteBuilderX · GitHub
If you want just quickly run latest SpriteBuilderX.app - download it here however, I probably will not publish releases there… so just use github and Xcode to build for yourself
Feel free to contribute.