iPad resolution issues with my config.lua file

Hello developers, I’m experiencing an issue with non retina iPad risolutions:

I’ve got “.png” and “@2x.png” images in my project, now retina iPads get the correct images with “@2x” suffix, but now I even want the “normal” iPads to use those images, otherwise the graphics quality in the whole app is very very bad on these devices. Of course I will use if statements to scale down images on non retina iPads (Is there another method?).

My config.lua file looks like this:

local aspectRatio = display.pixelHeight / display.pixelWidth application = { content = { width = aspectRatio \> 1.5 and 400 or math.ceil( 600 / aspectRatio ), height = aspectRatio \< 1.5 and 600 or math.ceil( 400 \* aspectRatio ), scale = "zoomStretch", fps = 60, imageSuffix = { ["@2x"] = 2 }, }, } application = { content = { width = 400, height = 712, --scale = "zoomEven" scale = "zoomStretch", fps = 60, imageSuffix = { ["@2x"] = 2, } } } -- For iPads if system.getInfo("model") == "iPad" or system.getInfo("model") == "iPad Simulator" then application = { content = { width = 384, height = 512, --scale = "zoomEven" scale = "zoomStretch", fps = 60, imageSuffix = { ["@2x"] = 2, } } } end if(aspectRatio\<1.34)then application = { content = { width = 384, height = 512, --scale = "zoomEven" scale = "zoomStretch", fps = 60, imageSuffix = { ["@2x"] = 2, } } } end -- For "tall" sizes (iPhone 5 and new iTouch) if display.pixelHeight \> 960 then application = { content = { width = 400, height = 712, scale = "zoomStretch", audioPlayFrequency="44100", fps = 60, imageSuffix = { ["@2x"] = 2, } } } else -- For traditional sizes (iPhone 4S & below, old iTouch) application = { content = { width = 400, height = 712, scale = "zoomStretch", audioPlayFrequency="44100", fps = 60, imageSuffix = { ["@2x"] = 2, } } } end

Thank you and best regards.

You have two application tables in your config.lua. You can only have one. Please just use:

local aspectRatio = display.pixelHeight / display.pixelWidth application = { content = { width = aspectRatio \> 1.5 and 400 or math.ceil( 600 / aspectRatio ), height = aspectRatio \< 1.5 and 600 or math.ceil( 400 \* aspectRatio ), scale = "zoomStretch", fps = 60, imageSuffix = { ["@2x"] = 2 }, }, }

and see if that makes things better.

Hi Rob, thanks for your answers.

I tried to do what you said, now my config.lua file looks like:

local aspectRatio = display.pixelHeight / display.pixelWidth application = { content = { width = aspectRatio \> 1.5 and 400 or math.ceil( 600 / aspectRatio ), height = aspectRatio \< 1.5 and 600 or math.ceil( 400 \* aspectRatio ), scale = "zoomStretch", fps = 60, imageSuffix = { ["@2x"] = 2 }, }, } -- For iPads if system.getInfo("model") == "iPad" or system.getInfo("model") == "iPad Simulator" then application = { content = { width = 384, height = 512, --scale = "zoomEven" scale = "zoomStretch", fps = 60, imageSuffix = { ["@2x"] = 2, } } } end -- For "tall" sizes (iPhone 5 and new iTouch) if display.pixelHeight \> 960 then application = { content = { width = 400, height = 712, scale = "zoomStretch", audioPlayFrequency="44100", fps = 60, imageSuffix = { ["@2x"] = 2, } } } else -- For traditional sizes (iPhone 4S & below, old iTouch) application = { content = { width = 400, height = 712, scale = "zoomStretch", audioPlayFrequency="44100", fps = 60, imageSuffix = { ["@2x"] = 2, } } } end

but everything looks like before. I did various attempt, including leave only 

local aspectRatio = display.pixelHeight / display.pixelWidth application = { content = { width = aspectRatio \> 1.5 and 400 or math.ceil( 600 / aspectRatio ), height = aspectRatio \< 1.5 and 600 or math.ceil( 400 \* aspectRatio ), scale = "zoomStretch", fps = 60, imageSuffix = { ["@2x"] = 2 }, }, }

But the content is not centered to the screen (only on iPads) and the iPad still using low-def images.

Anyway, I figured out that if I comment the iPhone section from my config.lua file, even the older iPad (iPad Mini 1st gen) uses high-def images, but the content is not centered to the screen.

Is there anything else I could try to do? 

Thanks for your help and best regards.

I would not use the long one you posted above but the short one. Can you provide some screen shots?  Maybe some code where the objects you expect to be centered are not centered?

What simulator devices are you testing on?

What real devices are you testing on?

Rob

Hi Rob thanks again.

I’m not at home right now, BTW I will post the screen shots within the next 12 hours.

I’m experiencing this problem on iPad Mini 1st gen (real device) and on iPad Mini 1st gen (simulator device).

Anyway I’m testing the whole app on an iPhone 6 Plus, Galaxy Note 3, iPhone 5s, iPad Mini 1st gen.

Best regards

Hello Rob, sorry for the little delay, the screen shots below show how my game looks like with the “long” config.lua file:

Non retina iPads

http://oi62.tinypic.com/jq2sub.jpg

Retina iPads

http://oi58.tinypic.com/2h2jk21.jpg

I want just to improve the image quality of the non retina iPad, keeping the current config.lua (the long one)

Best regards.

You have two application tables in your config.lua. You can only have one. Please just use:

local aspectRatio = display.pixelHeight / display.pixelWidth application = { content = { width = aspectRatio \> 1.5 and 400 or math.ceil( 600 / aspectRatio ), height = aspectRatio \< 1.5 and 600 or math.ceil( 400 \* aspectRatio ), scale = "zoomStretch", fps = 60, imageSuffix = { ["@2x"] = 2 }, }, }

and see if that makes things better.

Hi Rob, thanks for your answers.

I tried to do what you said, now my config.lua file looks like:

local aspectRatio = display.pixelHeight / display.pixelWidth application = { content = { width = aspectRatio \> 1.5 and 400 or math.ceil( 600 / aspectRatio ), height = aspectRatio \< 1.5 and 600 or math.ceil( 400 \* aspectRatio ), scale = "zoomStretch", fps = 60, imageSuffix = { ["@2x"] = 2 }, }, } -- For iPads if system.getInfo("model") == "iPad" or system.getInfo("model") == "iPad Simulator" then application = { content = { width = 384, height = 512, --scale = "zoomEven" scale = "zoomStretch", fps = 60, imageSuffix = { ["@2x"] = 2, } } } end -- For "tall" sizes (iPhone 5 and new iTouch) if display.pixelHeight \> 960 then application = { content = { width = 400, height = 712, scale = "zoomStretch", audioPlayFrequency="44100", fps = 60, imageSuffix = { ["@2x"] = 2, } } } else -- For traditional sizes (iPhone 4S & below, old iTouch) application = { content = { width = 400, height = 712, scale = "zoomStretch", audioPlayFrequency="44100", fps = 60, imageSuffix = { ["@2x"] = 2, } } } end

but everything looks like before. I did various attempt, including leave only 

local aspectRatio = display.pixelHeight / display.pixelWidth application = { content = { width = aspectRatio \> 1.5 and 400 or math.ceil( 600 / aspectRatio ), height = aspectRatio \< 1.5 and 600 or math.ceil( 400 \* aspectRatio ), scale = "zoomStretch", fps = 60, imageSuffix = { ["@2x"] = 2 }, }, }

But the content is not centered to the screen (only on iPads) and the iPad still using low-def images.

Anyway, I figured out that if I comment the iPhone section from my config.lua file, even the older iPad (iPad Mini 1st gen) uses high-def images, but the content is not centered to the screen.

Is there anything else I could try to do? 

Thanks for your help and best regards.

I would not use the long one you posted above but the short one. Can you provide some screen shots?  Maybe some code where the objects you expect to be centered are not centered?

What simulator devices are you testing on?

What real devices are you testing on?

Rob

Hi Rob thanks again.

I’m not at home right now, BTW I will post the screen shots within the next 12 hours.

I’m experiencing this problem on iPad Mini 1st gen (real device) and on iPad Mini 1st gen (simulator device).

Anyway I’m testing the whole app on an iPhone 6 Plus, Galaxy Note 3, iPhone 5s, iPad Mini 1st gen.

Best regards

Hello Rob, sorry for the little delay, the screen shots below show how my game looks like with the “long” config.lua file:

Non retina iPads

http://oi62.tinypic.com/jq2sub.jpg

Retina iPads

http://oi58.tinypic.com/2h2jk21.jpg

I want just to improve the image quality of the non retina iPad, keeping the current config.lua (the long one)

Best regards.