简体   繁体   English

电晕图像在模拟器中缩放但不在设备上缩放

[英]corona images scaling in simulator but not on device

Whats going wrong here? 怎么了 I test my game on corona simulator and it works great on all devices. 我在电晕模拟器上测试了我的游戏,并且在所有设备上都可以正常运行。 I make a build of the game and play it on iPhone 5 and it doesn't scale. 我制作了游戏并在iPhone 5上玩,但无法缩放。 High res images are swapped being swapped because I made slight changes to each just to be sure, each image was x2. 高分辨率图像被交换了,因为为了确保每个图像都是x2,我对每个图像做了些微更改。

Why is this happening? 为什么会这样呢? why is corona simulator scaling nicely and on device it isn't? 为什么电晕模拟器可以很好地缩放,而在设备上却不能缩放?

My background Image (one of many other images not scaling to full length of iphone5) 我的背景图片(许多未缩放到iphone5全长的图片)

BG = display.newImageRect("images/bgNight.png", 570,360)
BG.anchorX = 0.5;
BG.anchorY = 0.5;
BG.x = display.contentCenterX
BG.y = display.contentCenterY
BG.alpha = 1
group:insert(BG)

Config.lua 配置文件

local aspectRatio = display.pixelHeight / display.pixelWidth

application =
{
   content =
   {
        width = aspectRatio > 1.5 and 320 or math.ceil(480 / aspectRatio),
        height = aspectRatio < 1.5 and 480 or math.ceil(320 * aspectRatio),
        scale = "letterbox",
        fps = 60,
        imageSuffix =
        {
            ["@2x"] = 1.5,
        },
  },
}

build.settings.lua build.settings.lua

settings = {    
    orientation = {
         default = "landscapeRight",
         supported = { "landscapeRight", "landscapeLeft"}
    },
    iphone = {
        plist = {
            UIStatusBarHidden = true,           
            UIAppFonts = { 
                        "Jazz Zebra.ttf",
                         }  
        }
    },
 }

Use this config and try 使用此配置并尝试

application = 
 {
 content = 
  { 
    width = 640 * (display.pixelHeight/display.pixelWidth>1.5 and 1 or  1.5/(display.pixelHeight/display.pixelWidth)),
    height = 960 * (display.pixelHeight/display.pixelWidth<1.5 and 1 or (display.pixelHeight/display.pixelWidth)/1.5),
    scale = "letterbox",
    -- xAlign = "center",
    -- yAlign = "center",
    imageSuffix =
    {
        ["@2x"] = 2,
        ["@4x"] = 3.0,
    },
   },
   }

BG.x = display.contentWidth/2 BG.y = display.contentHeight/2 BG.x = display.contentWidth / 2 BG.y = display.contentHeight / 2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM