How to set individual device orientation for indiv

2019-02-27 02:35发布

问题:

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.

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

回答1:

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.

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.