Just a friendly heads up on getting OpenFeint’s latest iOS SDK up and running with cocos2d-x.
The default templates for starting a cocos2d-x project have the following code in the AppController.mm file, which starts your EAGLView and tells cocos2d-x to get moving.
- (BOOL)application:(UIApplication )application didFinishLaunchingWithOptions:launchOptions {
// Override point for customization after application launch.
// Add the view controller’s view to the window and display.
window = initWithFrame: bounds]];
EAGLView*glView =
pixelFormat: kEAGLColorFormatRGBA8
depthFormat: GL_DEPTH_COMPONENT16_OES
preserveBackbuffer: NO
sharegroup: nil
multiSampling: NO
numberOfSamples: 0 ];
// Use RootViewController manage EAGLView
viewController = initWithNibName:nil bundle:nil];
viewController.wantsFullScreenLayout = YES;
viewController.view =*glView;
// Set RootViewController to window
[window addSubview: viewController.view];
[window makeKeyAndVisible];
[[UIApplication sharedApplication] setStatusBarHidden: YES];
cocos2d::CCApplication::sharedApplication().run();
return YES;
}
Open Feint doesn’t like window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]];
and won’t show its panels and notifications if you call this line.
Instead, use [self.view bounds] when instantiating the EAGLView.
EAGLView **glView =
pixelFormat: kEAGLColorFormatRGBA8
depthFormat: GL_DEPTH_COMPONENT16_OES
preserveBackbuffer: NO
sharegroup: nil
multiSampling: NO
numberOfSamples: 0 ];
self.view =*glView;
self.navigationController.navigationBarHidden = YES;
cocos2d::CCApplication::sharedApplication().run();
Seems to work for me in early testing. Post a response if I’m missing something here.
P.S. - pardon my formatting