سؤال

I found a issue that i set height and width in config .lua file as 960 * 640. When i run this app on other device which has high resolution that the above said, it got stretched. How can we set height and width in config.lua on the basis of which device it runs?

هل كانت مفيدة؟

المحلول

config.lua:

application = {
    content = {
        width = 640,
        height = 960,
        scale = "letterBox",
        fps = 30,
        imageSuffix = {
            ["-sd"] = 0.5,
            [""] = 1,
            ["-hd"] = 1.4,
            ["-hdpi"] = 0.7
        }
    }
}

From now on your image.png will be displayed on every 640x960 screen. You should also include 3 additional images for other screens:

image-sd.png for screens 50% smaller than 640x960

image-hd.png for screens 140% bigger than 640x960

image-hdpi.png for screens 70% size of 640x960

Keep in mind, that you have to use only image.png in all the code. Suffix is added automatically according to what you set in config.lua

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top