cocos2dの画面を縦向きに固定する

Bookmark this on Yahoo Bookmark
このエントリーをはてなブックマークに追加
はてなブックマーク - cocos2dの画面を縦向きに固定する
Bookmark this on Livedoor Clip
Bookmark this on BuzzURL

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

上記の設定で、ゲーム中に画面がオートローテートすることがなくなります。

 

あわせて読みたい関連記事

タグ


2011年10月3日 | コメント/トラックバック(1)|

カテゴリー:iPhone&iPad

トラックバック&コメント

この投稿のトラックバックURL:

トラックバック

  1. [...] cocos2dの画面を縦向きに固定する | Pa-kun plus idea Written on 2月 29, 2012 by miccyome del.icio.us design float digg facebook mixx reddit stumbleupon technorati [...]

コメント


コメントをどうぞ

このページの先頭へ

イメージ画像