Tag Archives: CocosBuilder

Cocos Builder generating links to subcomponents

I’ve been playing with CocosBuilder 2.0 and it’s definitely an improvement over hand coding layout for Cocos2D menus.

It does have a bit of a learning curve, especially with the lack of documentation (which will likely linger for a while).

Much of the tool is non-intuitive in the world of wysiwyg, but if you are writing or are maintaining hundreds of lines of code for this regard it’s worth it.  Just like Interface Builder is to Objective-C presentation layers, knowing the object design behind it will help you understand it.

That said, here’s a few gotchas I’ve run into.

If you are trying to connect to a property that you’ve created in the header file and are allowing the new Objective-C to generate the ivar for, beware that the ivar name is preceded with an underscore.

@property (nonatomic, assign) CCLabelTTF *myLabel;

leads to an instance variable named _myLabel unless you provide your own (no longer needed) @synthesis line.

I also noticed after following the code that they’ve provided a nice method that gets invoked after the CCB file is loaded.

- (void)didLoadFromCCB;

I would have preferred they follow Apple’s NeXT’s naming convention. They defined an awakeFromNib method. This one should have been awakeFromCCB.

I definitely would have liked a menu to open files (not just projects).  The only way i’ve found is open the project, find the file in the listing, double click it.  If it’s not listed, finagle the setting to see it.