The code above is from this tutorial:
http://coronalabs.com/blog/2013/09/10/modernizing-the-config-lua/
However, before you read that, you should read its predecessor that explains several things:
http://coronalabs.com/blog/2012/12/04/the-ultimate-config-lua-file/
Modernizing works and it works well as long as you a) accept that on some screens some of your app will be off screen and you plan the positioning of things accordingly and b) you use the right method of positioning things. In other words if you want to center something horizontally you do:
obj.x = display.contentCenterX
If you want to position something 50 px from the top regardless of the screen shape, you do:
obj.y = 50
If you want it 50 pixels from the bottom:
obj.y = display.contentHeight - 50
This allows things like scores, titles, buttons, lives left, to stay anchored near an edge or centered. As long as there are not critical art elements in the background then you’re okay. So some care has to go into the background design.
If your app is one where an object needs to be X number of pixels away from another object, this config.lua can create more math than is needed. In that case you would tend to go with a content area that is common to all screens, like the 1.5:1 aspect ratio of the iPhone 4 and have that area centered on the screen. You provide a bigger than the area background that bleeds off on some devices. 0,0 won’t be the top left corner, nor will display.contentWidth, display.contentHeight be the bottom right corner. In this situation (think of a game like angry birds where the slignshot and the building’s are the same distance apart regardless of device) you just use things like
slingshot.x = 10
block.x = 400
But to keep things like scores, lives, etc. relative to the edges, then you have to do more complicated math to position them. It’s a trade off. Based on your screen shot, I would keep you config.lua but do:
menu\_background = display.newImageRect("abstract-rainbow-colors.jpg", 1080, 1920) menu\_background.x=display.contentCenterX menu\_background.y=display.contentCenterY
Now depending on the device some of the top and bottom are going to be cut off a bit on some of the devices, but that’s the nature of the beast. If you plan on supporting the iPad, your background really should be 1215 x 1920, and center it like above.
Rob