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

Time for action – adding build.settings file

Build-time properties can be provided in an optional build.settings file, which uses Lua syntax. The build.settings file is used to set application orientation and auto-rotation behavior, along with a variety of platform-specific build parameters.

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

What just happened?

The default orientation setting determines the initial launch orientation on the device, and also 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, supporting 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 aren't set before launching the application, it will go to the default portrait mode.

Runtime configuration

Currently our project is not scaled to display evenly for cross-platform development. The contents will still display on the device, but most likely not in the correct aspect ratio.

For example, iPhone projects are designed for a 320 pixel wide screen and can be up scaled to the 480 pixel wide screen for Android devices. This makes porting easier, since the code and art assets do not need to be revised.

Corona can target builds made for iPhone 4 and other current iOS devices that display double resolution art assets while remaining iOS 3.0-compatible. This means that pre-iPhone 4 content will no longer upscale automatically to the larger iPhone 4 screen resolution. As iOS development progresses, content scaling will generally be required in new iPhone apps to be compatible with devices such as the iPhone 3GS and lower.

主站蜘蛛池模板: 麻城市| 松江区| 博罗县| 滦南县| 绥滨县| 濮阳市| 海阳市| 卢龙县| 成都市| 洛宁县| 永定县| 应城市| 阳江市| 焦作市| 淮阳县| 游戏| 三门峡市| 平谷区| 临清市| 崇左市| 鸡泽县| 错那县| 西乌| 玛沁县| 南木林县| 确山县| 即墨市| 信阳市| 榆树市| 吴江市| 易门县| 雷州市| 栾川县| 雷州市| 金湖县| 斗六市| 韶山市| 高阳县| 田东县| 岑巩县| 海阳市|