cocos2dの画面を縦向きに固定する
cocos2dのゲームの画面を縦向きに固定する必要があったので、メモ
AppDelegateクラスのapplicationDidFinishLaunchingメソッドの下記該当箇所を変更します。
#if GAME_AUTOROTATION == kGameAutorotationUIViewController [director setDeviceOrientation:kCCDeviceOrientationPortrait]; #else //[director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft]; //上記を以下のように変更。 [director setDeviceOrientation:kCCDeviceOrientationPortrait]; #endif [director setAnimationInterval:1.0/60]; [director setDisplayFPS:YES];
また、GameConfig.hの下記の部分も、「kGameAutorotationNone」に変更しておきます。
// // Define here the type of autorotation that you want for your game // // 3rd generation and newer devices: Rotate using UIViewController. Rotation should be supported on iPad apps. // TIP: // To improve the performance, you should set this value to "kGameAutorotationNone" or "kGameAutorotationCCDirector" #if defined(__ARM_NEON__) || TARGET_IPHONE_SIMULATOR //#define GAME_AUTOROTATION kGameAutorotationUIViewController //上記を以下のように変更。 #define GAME_AUTOROTATION kGameAutorotationNone // ARMv6 (1st and 2nd generation devices): Don't rotate. It is very expensive #elif __arm__ #define GAME_AUTOROTATION kGameAutorotationNone
上記の設定で、ゲーム中に画面がオートローテートすることがなくなります。
あわせて読みたい関連記事
- cocos2dで、TableViewを実現する方法(CCUIViewWrapper編) ・・・(または、cocos2dでUIViewを使う方法)
- iPhoneアプリからTwitter連携を行う方法①(OAuth認証編)
- TestFlightを利用して、遠隔で、iPhoneアプリをテストしてもらう(アプリ導入編)
- iPhoneアプリ内でアプリケーションスコープのデータを保持する方法①(UserDefaultsに保持する)
- cocos2dで、TableViewを実現する方法(CCTableView編)
タグ
cocos2d、iphone2011年10月3日 | コメント/トラックバック(1)|
カテゴリー:iPhone&iPad
トラックバック&コメント
この投稿のトラックバックURL:
トラックバック
コメント
[...] cocos2dの画面を縦向きに固定する | Pa-kun plus idea Written on 2月 29, 2012 by miccyome del.icio.us design float digg facebook mixx reddit stumbleupon technorati [...]