cocos2d HelloWorld 项目横竖屏 自动旋转问题

本文介绍了cocos2d游戏中横竖屏自动旋转的配置和控制方法。通过GameConfig.h的宏定义,可以选择禁用旋转、cocos2d内置的旋转机制或iOS SDK自身的旋转控制。cocos2d的旋转直接,而UIViewController有过渡效果但消耗更高。在RootViewController.mm中,依据GAME_AUTOROTATION的设置决定执行竖屏或横屏呈现的代码,影响UI元素的显示方向。
摘要由CSDN通过智能技术生成
               

首先看下 GameConfig.h中的宏定义,配置:

/** * Modified by Bruce Yang on 2012.09.06.13.51~ *//** Supported Autorotations: None, UIViewController, CCDirector */#define kGameAutorotationNone 0#define kGameAutorotationCCDirector 1#define kGameAutorotationUIViewController 2/** 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/** * ARMv6 (1st and 2nd generation devices):  * Don't rotate. It is very expensive */
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值