My SimpleButton Cocos2D class

July 31st, 2012

Cocos2D for iPhone sadly does not have a class for a button that lets you customize it with different text, text color, and background color. After some research, I decided the easiest way to do this on my own would be to create a button from a blank sprite, set a color for that sprite, and attach the text to that sprite. So I created a class that did just that. This weekend, I upgraded the class a bit to support a border and simple drop-shadow (really just a slightly displaced block of color). It’s still acting a little weird, but I put some hours into it, so I’ll post the code here for those who may want to see what I did.

Search

About Me

I'm Jeff Fal, and I'm an information architect and front-end developer working in Denver. I have been working on the Web since 1998 and am interested in learning at least a little about most Web technologies. I'm most experienced with HTML, CSS, JavaScript, and Flex. Soft Werewolf is my place to play.