[:ja]【cocos2d-box2d】画面の向きを変更する[:en]【cocos2d-box2d】How to change screen orientation[:]

スポンサードリンク

【cocos2d-box2d】画面の向きを変更する

目次

[1]AppDelegate.mmのapplicationDidFinishLaunchingメソッドを編集

[director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft]
[director setDeviceOrientation:kCCDeviceOrientationPortrait]に変更

[objc]
#if GAME_AUTOROTATION == kGameAutorotationUIViewController
[director setDeviceOrientation:kCCDeviceOrientationPortrait];
#else
//  ↓↓↓↓横画面固定↓↓↓↓
//[director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft];
//  ↓↓↓↓縦画面固定↓↓↓↓
[director setDeviceOrientation:kCCDeviceOrientationPortrait];

#endif

[/objc]

[2]GameConfig.hを編集

GAME_AUTOROTATION kGameAutorotationUIViewController
GAME_AUTOROTATIONkGameAutorotationNoneに変更。
[objc]
#if defined(ARM_NEON) || TARGET_IPHONE_SIMULATOR
//  ↓↓↓↓横画面固定↓↓↓↓
//#define GAME_AUTOROTATION kGameAutorotationUIViewController
//  ↓↓↓↓縦画面固定↓↓↓↓
#define GAME_AUTOROTATION kGameAutorotationNone
[/objc]

■参照URL

cocos2dの画面を縦向きに固定する | Pa-kun plus idea

スポンサードリンク
よかったらシェアしてね!
  • URLをコピーしました!
  • URLをコピーしました!

この記事を書いた人

スマホ大好き人間です。

コメント

コメントする

目次