views:

50

answers:

2

I'm trying to implement OpenFeint in my Cocos2D iPhone game, but here's something weird that I didn't find how to solve. Here's how OpenFeint looks like when I initialize it: http://img842.imageshack.us/img842/8564/screenshot20100926at520.png And here's the code of the initialization:

[director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft];
NSDictionary* settings = [NSDictionary dictionaryWithObjectsAndKeys:
                          [NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft], OpenFeintSettingDashboardOrientation,
                          @"NAME", OpenFeintSettingShortDisplayName,
                          [NSNumber numberWithBool:NO], OpenFeintSettingEnablePushNotifications,
                          [NSNumber numberWithBool:YES], OpenFeintSettingAlwaysAskForApprovalInDebug, 
                          [NSNumber numberWithBool:YES], OpenFeintSettingDisableUserGeneratedContent, nil];
[OpenFeint initializeWithProductKey:@"PRODUCTKEY" andSecret:@"SECRET"
                     andDisplayName:@"NAME" andSettings:settings andDelegates: [OFDelegatesContainer containerWithOpenFeintDelegate:self]];
[[CCDirector sharedDirector] runWithScene: [MainMenuScene node]];
A: 

I'm not sure specifically what the problem is, but it looks like OpenFeint is trying to display in landscape but is somehow being rotated as if it was in Portrait mode. Can oyu double check to make sure your orientations are correct for both your app's primary view controller (or however you configure it in Cocos2D). And that OpenFeint is aware of it as well?

Jason
As you can see in the line above, I set the orientation in Cocos2D to Landscape-Left, and then put the same in OpenFeint. I actually tried many variations of orientations, none of them worked, the only one that worked as it should was portrait, but my game is in landscape...
Cokegod
+1  A: 

Hi CokeGod,

I've seen your post in a few places as I was having the same problem as you were. I just figured out a potential solution for you and thought I would reply. It seems that on some occasions OpenFeint is unable to access the keywindow and in that case creates it's own window that may not act as yours has been set up to do. The solution is to let OpenFeint know specifically which window to go after by adding it to the settings. My settings are below and as you can see I added the "OpenFeintSettingPresentationWindow" Setting with my keyed window. After doing this it worked wonderfully. Hope this helps!

NSDictionary* settings = [NSDictionary dictionaryWithObjectsAndKeys:
                            [NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight], OpenFeintSettingDashboardOrientation,
                            window, OpenFeintSettingPresentationWindow,
                            @"ComingSoon", OpenFeintSettingShortDisplayName, 
                            [NSNumber numberWithBool:YES], OpenFeintSettingEnablePushNotifications,
                            nil];
RedBird
This one worked! Thanks!!!
Cokegod