Thursday, November 05, 2015

CodeGenerator for CocosBuilder

If you have used cocosbuilder editor for animating / creating scenes in cocos2d-x you would have realised that there is a lot of boilerplate code, the code that is pretty much always copy paste from something you have done before.

1) Initialising the member variables
2) Adding the member functions
3) Binding the member variables
4) Binding the methods to callbacks.
5) Loading the ccb file.

All this is pretty much the same for all the classes  you write for using cocosbuilder ui. I've done a bunch of work before parsing the ccb files but never occurred to me that i could write a script to generate the code.

That is exactly what happened when one of my colleagues exclaimed.. this is pretty much same code for every class why dont' we write a script for it..

Well that is exactly what i did and here is the git repo for it..

https://github.com/vkbsb/ccbClassGen

The usage is simple and will mostly work. I do believe this can still be improved and would like people to be able to use it.

Post a Comment