I have following config
local aspectRatio = display.pixelHeight / display.pixelWidth application = { content = { fps = 60, -- width = 320, -- height = 480, width = aspectRatio \> 1.5 and 320 or math.ceil( 480 / aspectRatio ), height = aspectRatio \< 1.5 and 480 or math.ceil( 320 \* aspectRatio ), scale = "letterbox", xAlign = "center", yAlign = "center", imageSuffix = { ["@2x"] = 1.5, ["@4x"] = 3.000 } } }
then, for buttons I have function:
local function getImagePath(path) local suf = display.imageSuffix if(suf ~= nil) then return path..suf..".png" else return path..".png" end end
and for example for iphone 6 (750 x 1334) it selects me file@2x.png, which is fine, but it should be scalled down and it’s not. button is too wide for screen size.
when I add:
width=width/1.5
height=height/1.5
it displays nice, as intented
so I assume I should get value of application.content.imageSuffix[display.imageSuffix] and recalculate width and height. how can I do that?
I’d like to avoid copying @2x = 1.5, @4x = 3.0 table to other file