O'Reilly logo

Cocos2d for iPhone 0.99 Beginner's Guide by Pablo Ruiz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - displaying the OpenFeint dashboard

  1. First of all, before showing anything, we have to initialize OpenFeint. You can do that in the title screen of your game. Since our game has just one screen, I'll do that in there. Open the GameScene.h file.
  2. At the top of the file, import the OpenFeint headers:
    #import "Openfeint.h"
    
  3. Now we have to add the method that initializes OpenFeint and call it when our game loads. Add the following method to the GameLayer class:
    - (void)initializeOpenfeint { NSDictionary* settings = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:UIInterfaceOrientationPortrait], OpenFeintSettingDashboardOrientation, @"Totem", OpenFeintSettingShortDisplayName, [NSNumber numberWithBool:YES], OpenFeintSettingEnablePushNotifications, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required