采用cocos2d 1.1版本若是要实现屏幕为竖屏显示怎样修改
来源:互联网 发布:小米商城抢购软件 编辑:程序博客网 时间:2024/05/02 02:13
采用cocos2d 1.1版本若是要实现屏幕为竖屏显示怎样修改
有时候,就那么喜欢另类。偏偏不要cocos2d默认的横屏显示,那我们具体要如何定义修改成竖屏呢?
首先,采用cocos2d创建一个默认项目,在applicationDidFinishLaunching里对于屏幕的设置代码如下:
#if GAME_AUTOROTATION == kGameAutorotationUIViewController
[director setDeviceOrientation:kCCDeviceOrientationPortrait];
#else
[director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft];
#endif
现在直接修改成[director setDeviceOrientation:kCCDeviceOrientationPortrait];已经无法实现竖屏显示了。经摸索找到以下方法:
方法一:修改GameConfig.h文件
#define kGameAutorotationNone 0
#define kGameAutorotationCCDirector 1
#define kGameAutorotationUIViewController 2
我的版本是修改为:
#define kGameAutorotationNone 0
#define kGameAutorotationCCDirector 1
#define kGameAutorotationUIViewController 0
才能最终实现竖屏显示。
方法二:修改RootViewController.m文件的shouldAutorotateToInterfaceOrientation:方法
// 清除有关旋转方向判断的语句,只有return NO
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Shold not happen
return NO;
}
或者将elif GAME_AUTOROTATION == kGameAutorotationUIViewController宏定义代码下的默认代码:
return (UIInterfaceOrientationIsLandscape(interfaceOrientation));
修改为以下竖屏代码:
return (UIInterfaceOrientationIsPortrait(interfaceOrientation));
- 采用cocos2d 1.1版本若是要实现屏幕为竖屏显示怎样修改
- 采用cocos2d 1.1版本若是要实现屏幕为竖屏显示怎样修改
- cocos2d 0.99.5版本屏幕默认是横屏,怎么修改为竖屏
- cocos2d 屏幕默认是横屏,修改为竖屏 的方法
- cocos2d-x程序移植android时修改屏幕显示方向
- cocos2d中设置初始化显示为竖屏
- cocos2d-x中将游戏设置为竖屏显示
- Android怎样判断当前屏幕是否为横屏状态
- cocos2d-JS 实现 横 竖 屏 显示提示图片效果 !!!!!
- cocos2d-x 修改安卓屏幕方向
- 怎样使层相对于屏幕居中显示
- 修改系统默认屏幕显示方向横屏或竖屏
- windows server 2003中使用cocos2d-x,提示OpenGL版本为1.1,要更新驱动,解决方法
- cocos2d移植安卓时 修改是否为横 竖
- cocos2d中如何判断iphone屏幕是否为retina屏幕
- 苹果新专利显示iPhone未来或采用弧度屏幕
- 屏幕适配采用px为单位的缩放。
- 安卓修改上层UI界面默认显示为竖屏显示(基于tiny4412开发板)
- JNI中的数据类型
- sqlserver 中select in的排序问题
- C3p0使用时出现的异常及解决方案
- iOS NSUserDefaults使用方法
- RTFSC (Read the fucking source code )
- 采用cocos2d 1.1版本若是要实现屏幕为竖屏显示怎样修改
- 移动网络名词理解(5)---APN、wap、net
- uva 156 - Ananagrams
- 浅谈数据库连接
- 简单教你配置高性能的vi编辑器(ctags+vim+cscope)
- 笔试中遇到的问题总结(一)
- 笔试中遇到的问题总结(一)
- 黑马程序员学习笔记六——java.IO小细节或许影响全局。
- 动画学习1 Animating Views with Blocks