如何为单个页面设置单个设备方向:Corona- SDK [英] How to set individual device orientation for individual pages : Corona- SDK

查看:98
本文介绍了如何为单个页面设置单个设备方向:Corona- SDK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用Corona-SDK开发了一款游戏.它具有2个场景:(1)菜单场景和(2)游戏场景. 我需要两个方向来支持我的应用:"landscapeRight"和"landscapeLeft". 为此,我在build.settings中使用了以下代码行:

I've made a game using Corona-SDK. It has 2 scenes: (1) Menu scene and (2) Game scene. I need my app to be supported with two orientations : 'landscapeRight' and 'landscapeLeft'. For that, I used the following lines of code in build.settings :

 orientation =
 {
    default = "landscapeRight",
    supported =
    {
        "landscapeRight", "landscapeLeft"
    },
 }

不幸的是,这会影响整个应用程序.

Unfortunately, this will affect the whole app.

但是我希望我的游戏场景只支持一个方向(例如:landscapeRight或landscapeLeft或纵向).

But I want my game scene to be supported with only one orientation(eg: landscapeRight or landscapeLeft or in portrait).

推荐答案

对不起,但Corona SDK不具备此功能.

Sorry, but Corona SDK does not have such capability.

您可以做的是将方向锁定为一个方向,并在要支持多个方向的地方固定位置,您可以手动检查加速度计以查看手机是否倒置,然后手动翻转图形.

What you can do is lock into one orientation, and places where you want to support more than one orientation, you can manually check the accelerometer to see if the phone is upside down, and then manually flip your graphics.

翻转图形最简单的方法是将它们全部放在屏幕中央的单个组中,并将该组旋转180度.

The most easy way to flip the graphics is put them all in a single group centered on the screen, and rotate that group 180 degrees.

这篇关于如何为单个页面设置单个设备方向:Corona- SDK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆