Development

76 posts

Constants.h considered harmful

It’s common to use a centralised “Constants” class where you gather together lots of constants for your app. For example, in Objective-C you’ll often have a big file Constants.h full of lines like this.  #define DEBUG_MODE NO#define APP_URL @"http://itunes.com/apps/mycoolapp"#define CHARACTER_ANIMATION_TIME 2.0f#define FOOTER_IMAGE @"mycoolapp-footer.png"#define FONT @"Helvetica-Bold"  Don’t do this. Why? 1. It increases compile times significantly. …

Adding iOS5 native Twitter support to your cocos2d app

In iOS5, Apple introduced native Twitter integration via the “Tweet Sheet” (aka TWTweetComposeViewController), allowing you to easily implement Twitter in your iOS app without worrying about all the heavy lifting. If you tried implementing Twitter support in the past and found yourself lost in a sea of OAuth source files, trying to handle authentication yourself, …