大佬教程收集整理的这篇文章主要介绍了quick-cocos2d-x 如何设置游戏的屏幕方向,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
quick 中的 create_project 工具在创建项目时,可以用 -o 参数指定屏幕方向。但如果要修改已有项目的屏幕方向,就要按如下步骤进行。
找到 RootViewController.mm 文件,做如下修改:
如果需要横屏:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}
// For ios6.0 and higher,use supportedInterfaceOrientations & shouldAutorotate instead
- (NSUInteger) supportedInterfaceOrientations
{
#ifdef __IPHONE_6_0
return UIInterfaceOrientationMaskLandscape;
#endif
}
如果需要竖屏:
- (UIInterfaceOrientation)interfaceOrientation
{
return UIInterfaceOrientationIsPorTrait(interfaceOrientation);
}
#ifdef __IPHONE_6_0
return UIInterfaceOrientationMaskPorTrait;
#endif
}
修改 AndroidManifest.xml 文件中的 android:screenOrientation 属性:
修改 config.lua 配置
如果需要横屏:
-- design resolution
CONFIG_SCREEN_WIDTH = 960
CONFIG_SCREEN_HEIGHT = 640
CONFIG_SCREEN_ORIENTATION = "landscape"
-- auto scale mode
CONFIG_SCREEN_AUTOSCALE = "FIXED_HEIGHT"
如果需要竖屏:
640
CONFIG_SCREEN_HEIGHT = 960
CONFIG_SCREEN_ORIENTATION = "porTrait"
"FIXED_WIDTH"
以上是大佬教程为你收集整理的quick-cocos2d-x 如何设置游戏的屏幕方向全部内容,希望文章能够帮你解决quick-cocos2d-x 如何设置游戏的屏幕方向所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。