官术网_书友最值得收藏!

Time for action – adding the build.settings file

The build-time properties can be provided in an optional build.settings file, which uses the Lua syntax. The build.settings file is used to set the application orientation and autorotation behavior along with a variety of platform-specific build parameters. To add the build.settings file in your project folder, perform the following steps:

  1. Create a new project folder called Breakout on your desktop.
  2. In your preferred text editor, create a new file called build.settings and save it in your project folder.
  3. Type in the following lines:
    settings =
    {
      orientation =
      {
        default = "landscapeRight",
        supported = { "landscapeLeft", "landscapeRight" },
      }
    }
  4. Save and close the file. The build.settings file is completed.

What just happened?

The default orientation setting determines the initial launch orientation on the device and the initial orientation of the Corona simulator.

The default orientation doesn't affect Android devices. The orientation is initialized to the actual orientation of the device (unless only one orientation is specified). Also, the only supported orientations are landscapeRight and portrait. On a device, you can flip to either landscapeRight or landscapeLeft, but the operating system only reports one flavor of landscape, and Corona's orientation event chooses landscapeRight.

We have created this application to work with landscape orientations that support landscapeRight. We have set this orientation as its default so it won't switch to landscapeLeft or even any portrait mode. While working on an iOS device, if the build.settings isn't set before launching the application, it will go to the default portrait mode.

Dynamic scaling

Corona can target builds made for multiple devices across iOS and Android, which display various art assets in different resolutions. Corona can scale upward or downward depending on your starting resolution. It can also substitute higher-resolution image files when needed, ensuring that your app appears clear and sharp on all devices.

主站蜘蛛池模板: 开阳县| 五河县| 兰西县| 二连浩特市| 濉溪县| 肃宁县| 舞阳县| 侯马市| 平乐县| 长丰县| 韩城市| 安庆市| 五华县| 二连浩特市| 衡东县| 格尔木市| 安丘市| 新田县| 府谷县| 徐州市| 郧西县| 江门市| 无为县| 丽水市| 新建县| 扎鲁特旗| 南平市| 莱州市| 南华县| 措美县| 屏东县| 西和县| 桐梓县| 淮北市| 宽城| 秦皇岛市| 彩票| 乳山市| 嘉荫县| 沿河| 麻江县|