Ultimate “config.lua” File

Hi,

I just read through Rob’s Tutorial: the Ultimate “config.lua” File tutorial.  A little bit confused.

I am trying to get a config file that would fit into Iphone 3, 4 and 5, plus the Ipad 1, 2 and 3.

According to Rob I should have assets at 1440×2280 for the IPad 3.  But isn’t the IPad 3 1536 x 2048?

What am I missing here? 

Look at the graphic at the top of the blog post.  It is supposed to show you the different screen sizes overlayed over top of each other.   That config.lua makes a few assumptions:

  1. You are going to use a 320px wide device as our base starting point and that the iPhone 3 family at 320x480 will be the main device to build around.  The config.lua is just defining the content area you want your app to use.  You could make it 703 x 1055 if you wanted.  In fact, Brent and I have been talking and we think its time to seriouslly consider forgetting about the older devices and start using an 800x1200 as the base size to start using.  Even numbers, easier to do math with, etc.  but that’s a sidebar for another day.    The Ultimate config.lua is based on 320x480.

2.  we need to support devices wider than 320 and taller than 480…  Lets start with the tall devices, like the iPhone 5 and most many android 16:9 devices.  The iPhone 5 is 640 x 1136.  When scaled to 320, that makes it 320 x 568.   Therefore our backgrounds need to be at least 568px high.  For some android devices that actually works out to 320 x 570.   Now for the iPad which is a wider device, to keep it scaled right, we need to keep it’s height at 480 to match the base.  That makes it 360 wide a that point 1024/768 = 1.25  (2048/1536 = 1.25) = 480/360 = 1.25.  So we need our background to be 360 px wide to fit that screen.  This makes our base image 360x570.  On the iPad, the top and bottom  (assuming portrait) will bleed off the screen.  On the  320px wide devices, the sides are going to bleed off a little.  The base 320x480 is going to bleed on all four edges (assuming you’re centering the background).

360x570 as a 2x image would be 720x1140.  A 4x version would be 1440x2280.   Corona will stretch the image on the iPad 3 and 4 to 1536x2432.  For the other devices it will scale up or down as necessary to make it fit. 

Some people have argued that this isn’t a good use of texture memory because our sizes are little bigger than the power of 2 sizes.  But if we went with smaller images then they would get stretched a bit too much, IMHO.  

Rob,

Thanks for that.  But when the image is stretched on the IPad 3 or 4 doesn’t that degrade the 1440 x 2280 image? as in does it look ok? or does it look stretched out?

Thanks

Vik

It will be scaled in proportion and it shouldn’t degrade very much.  If you’re concerned, you could base your information on a 1536 wide image (1536x2726) as the @4x, 768x1364 for the @2x and 384x682 for the base image.  But you would need to calculate out a different set of width’s and height’s to conform to those numbers.

Look at the graphic at the top of the blog post.  It is supposed to show you the different screen sizes overlayed over top of each other.   That config.lua makes a few assumptions:

  1. You are going to use a 320px wide device as our base starting point and that the iPhone 3 family at 320x480 will be the main device to build around.  The config.lua is just defining the content area you want your app to use.  You could make it 703 x 1055 if you wanted.  In fact, Brent and I have been talking and we think its time to seriouslly consider forgetting about the older devices and start using an 800x1200 as the base size to start using.  Even numbers, easier to do math with, etc.  but that’s a sidebar for another day.    The Ultimate config.lua is based on 320x480.

2.  we need to support devices wider than 320 and taller than 480…  Lets start with the tall devices, like the iPhone 5 and most many android 16:9 devices.  The iPhone 5 is 640 x 1136.  When scaled to 320, that makes it 320 x 568.   Therefore our backgrounds need to be at least 568px high.  For some android devices that actually works out to 320 x 570.   Now for the iPad which is a wider device, to keep it scaled right, we need to keep it’s height at 480 to match the base.  That makes it 360 wide a that point 1024/768 = 1.25  (2048/1536 = 1.25) = 480/360 = 1.25.  So we need our background to be 360 px wide to fit that screen.  This makes our base image 360x570.  On the iPad, the top and bottom  (assuming portrait) will bleed off the screen.  On the  320px wide devices, the sides are going to bleed off a little.  The base 320x480 is going to bleed on all four edges (assuming you’re centering the background).

360x570 as a 2x image would be 720x1140.  A 4x version would be 1440x2280.   Corona will stretch the image on the iPad 3 and 4 to 1536x2432.  For the other devices it will scale up or down as necessary to make it fit. 

Some people have argued that this isn’t a good use of texture memory because our sizes are little bigger than the power of 2 sizes.  But if we went with smaller images then they would get stretched a bit too much, IMHO.  

Rob,

Thanks for that.  But when the image is stretched on the IPad 3 or 4 doesn’t that degrade the 1440 x 2280 image? as in does it look ok? or does it look stretched out?

Thanks

Vik

It will be scaled in proportion and it shouldn’t degrade very much.  If you’re concerned, you could base your information on a 1536 wide image (1536x2726) as the @4x, 768x1364 for the @2x and 384x682 for the base image.  But you would need to calculate out a different set of width’s and height’s to conform to those numbers.