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

Time for action – adding config.lua file

If no content size is specified, the content width and height returned will be the same as the physical screen width and height of the device. If you specify a different content width and height in config.lua, the content width and height will take on those values.

  1. In your text editor, create a new file called config.lua and save it to your project folder.
  2. Type in the following lines:
    application =
    {
            content =
            {
                width = 320,
            height = 480, 
            scale = "letterbox",
            fps = 60,
        },
    }
  3. Save and close your file.

What just happened?

The content width and height allow you to choose a virtual screen size that is independent of the physical device screen size. We have set the size to target the original iPhone since it displays the smallest dimensions across all the devices on both iOS and Android platforms. The original iPhone has dimensions of 320 x 480. With this configuration, it'll still scale evenly for the iPad, which has dimensions of 768 x 1024.

The scale used for this application is set to letterbox. It will uniformly scale up content as much as possible, while still showing all content on the screen. This will create a widescreen look, which will be compatible with the Droid, which has a longer screen than the iPhone 3GS.

We set fps = 60. By default, the frame rate is 30 fps. In this application, this will make the movement of the ball appear faster and allow us to increase the speed conveniently. We can stretch the frame rate to a maximum of 60 fps that Corona can allow.

主站蜘蛛池模板: 绍兴县| 抚远县| 宁陵县| 夹江县| 浠水县| 绥中县| 疏勒县| 望奎县| 阿拉尔市| 贵州省| 四子王旗| 会宁县| 乐陵市| 城市| 乐至县| 文水县| 陆河县| 犍为县| 普安县| 洮南市| 新津县| 溧水县| 新昌县| 顺昌县| 信阳市| 元谋县| 河曲县| 手游| 云安县| 汶川县| 肃南| 壤塘县| 射阳县| 慈溪市| 习水县| 金堂县| 淳化县| 望谟县| 台安县| 宜兰县| 炉霍县|