Subscribe to web2feel.com
Subscribe to web2feel.com

Welcome to My Website

ShaTechs... Technology at your reach...

Making Portrait mode application in Cocos2d 0.99.5 and higher

Posted by shajir Thursday, June 16, 2011

Follow steps below
1) In GameConfig.h
       change to  
       #define GAME_AUTOROTATION kGameAutorotationNone

2) InRootViewController.m commenting the following lines as
/*
#elif GAME_AUTOROTATION==kGameAutorotationCCDirector
    //
    // EAGLView will be rotated by cocos2d
    //
    // Sample: Autorotate only in landscape mode
    //
    if( interfaceOrientation == UIInterfaceOrientationLandscapeLeft ) {
        [[CCDirector sharedDirector] setDeviceOrientation: kCCDeviceOrientationLandscapeRight];
    } else if( interfaceOrientation == UIInterfaceOrientationLandscapeRight) {
        [[CCDirector sharedDirector] setDeviceOrientation: kCCDeviceOrientationLandscapeLeft];
    }
   
    // Since this method should return YES in at least 1 orientation,
    // we return YES only in the Portrait orientation
    return ( interfaceOrientation == UIInterfaceOrientationPortrait );
*/
3) In AppDelegate.m commenting these lines 
/*
#if GAME_AUTOROTATION == kGameAutorotationUIViewController
    [director setDeviceOrientation:kCCDeviceOrientationPortrait];
#else
    [director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft];
#endif
*/
and add the following line of code
  [director setDeviceOrientation:kCCDeviceOrientationPortrait];
Done!!!! Now your app is on portrait mode..

0 comments

Post a Comment

Search This Blog