quick 中的 create_project 工具在创建项目时,可以用 -o 参数指定屏幕方向。但如果要修改已有项目的屏幕方向,就要按如下步骤进行。
对于 iOS 项目 设置工程可用的屏幕方向:
找到 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}按照 Apple 文档要求,制作不同屏幕方向需要的启动画面文件 (Default.png)。文档地址:iOS Human Interface Guidelines – Launch Images
对于 AndroID 项目
修改 AndroIDManifest.xml 文件中的 androID:screenorIEntation 属性:
landscape 横屏 portrait 竖屏修改 config.lua 配置
如果需要横屏:
-- design resolutionCONfig_SCREEN_WIDTH = @H_404_73@960CONfig_SCREEN_HEIGHT = @H_404_73@640CONfig_SCREEN_ORIENTATION = "landscape"-- auto scale modeCONfig_SCREEN_autoSCALE = "FIXED_HEIGHT"
如果需要竖屏:
640CONfig_SCREEN_HEIGHT = @H_404_73@960CONfig_SCREEN_ORIENTATION = "portrait""FIXED_WIDTH"总结
以上是内存溢出为你收集整理的quick-cocos2d-x 如何设置游戏的屏幕方向全部内容,希望文章能够帮你解决quick-cocos2d-x 如何设置游戏的屏幕方向所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)