CocosBuilder is an excellent WYSIWYG (What You See Is What You Get) user interface builder developed by Viktor Lidholt here in Zynga.
It’s built around cocos2d-iphone and also uses that for its own live preview rendering. CocosBuilder is heavily plugin based, so that as a developer can add a custom exporter into any format you like (i.e. I created the CCBXAndEngineXML export into a custom “CCBAEX” format). One can also add custom CCNodes that actually render in CocosBuilder itself! These two features alone make it super flexible, with a lot of new stuff to come in the future!
Since cocos2d and AndEngine are similar enough, I could map almost all CCNodes to an AndEngine “Entity” equivalent (or created new nodes, i.e. ClipEntity)
Given that one can write an exporter to a custom format, one can also obviously write an importer for another engine, i.e. AndEngine, all which is what I did a few weeks ago:
- To be able to export from within CocosBuilder into the CCBAEX file format, you have to build CocosBuilder from my branch (I try to keep it up to date!):
- Get familiar with CocosBuilder, create a funky scene and ‘Publish’ it using the CCBXAndEngineXml exporter.
- Grab the AndEngineCocosBuilderExtension:
- Also you have to use the GLES2-AnchorCenter branch of AndEngine (and where available also the GLES2-AnchorCenter branch of its extensions!):
- To get you kickstarted, the example you want to take a look out is this the following one (The AndEngineExamples already contain two already exported CCBAEX files, so you don’t have to build CocosBuilder if you don’t want to build it or cannot built it.):
Having this exporter, one can store almost the whole user interface in data rather than in code making porting incredibly much easier and in general more flexible and maintainable (imagine loading different CocosBuilder exports, depending on the type of the device, etc…)!
I hope this is efforts are useful to some of you. :-)