Ever wanted rounded rectangles using cocos2d? I know I have, and after searching the web tirelessly for an implementation, I came up short. Many people solved the problem by using images, but images wouldn’t look good scaled and you would need an image for every different rectangle dimension (or suffer corner skewing). We needed rounded rects for our menus, but had no code for it.
Alas, it was time to write some drawing methods based on how cocos2d was doing some of their drawing. Cocos2d has methods to draw curves and lines as well as a method to draw a filled in polygon, but no filled in rounded rectangle. I took bits and pieces from these methods and hooked them up to make a rounded rectangle drawing method. I plan on making a subclass of CCLayer to make this simpler for the consumer, but overriding draw isn’t too hard for now. Check out the source at http://github.com/austinborden/cocos2d-extensions.