Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 1st, 2012  |  syntax: None  |  size: 1.09 KB  |  hits: 23  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How can I change the view from portrait to landscape mode?
  2. //
  3. //  GameConfig.h
  4. //  Cocos2DSimpleGame
  5. //
  6. //  Created by Ray Wenderlich on 11/21/10.
  7. //  Copyright Ray Wenderlich 2010. All rights reserved.
  8. //
  9.  
  10. #ifndef __GAME_CONFIG_H
  11. #define __GAME_CONFIG_H
  12.  
  13. //
  14. // Supported Autorotations:
  15. //      None,
  16. //      UIViewController,
  17. //      CCDirector
  18. //
  19. #define kGameAutorotationNone 0
  20. #define kGameAutorotationCCDirector 1
  21. #define kGameAutorotationUIViewController 2  //2
  22. //
  23. // Define here the type of autorotation that you want for your game
  24. //
  25. #define GAME_AUTOROTATION kGameAutorotationUIViewController
  26.  
  27.  
  28. #endif // __GAME_CONFIG_H
  29.  
  30.  
  31. and in my appDelegate file is:
  32. #if GAME_AUTOROTATION == kGameAutorotationUIViewController
  33.     [director setDeviceOrientation:kCCDeviceOrientationPortrait];
  34. #else
  35.     [director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft];
  36.  
  37.     //[director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft];
  38. //  [director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft];
  39. #endif
  40.        
  41. [[CCDirector sharedDirector]setDeviceOrientation:kCCDeviceOrientationLandscapeLeft];