There are a couple of different schools of thought and Corona helps in either case. The first school of thought is to build resolution specific graphics and let Corona pick the art based on the device in use. For instance, you build a 320x480 background called background.png, a 640x960 background called background@2x.png and a 1280x1920 one called background@4x.png (I’m not dealing with the different screen shapes yet, just talking about how Corona can pick the art for you.)
Now you position all your buttons, graphics, etc. based on a screen that’s 320x480 in size and Corona through some additional magic will pick up the right sized graphic for the device and your iPad4 will use the highest resolution image, your iPhone4, 4S and 5 and iPad2 will use the medium sized one while an older 3Gs will use the lower resolution graphics. Your app size will be bigger because you’re including extra images, but your lower powered devices will appreciate using the smaller images.
The next school of thought is to use medium sized graphics only and let Corona automatically scale up or down based on the devices capacity. This takes more CPU and in the case of lower memory devices like the 3Gs more memory, but your app size is considerably smoother. On the other size, when Corona scales images up, they won’t be quite as sharp, but the retina iPads do a really good job of making these lower resolution images look good. If you don’t care about the 3Gs (and perhaps we are to a point of saying its time to cut them free), then you could do a system where your basic graphics are medium sized and you use a grid of 640x960 to position everything and provide @2x images for the retina devices.
Now for managing the different shapes, there are different strategies there too. One is to make all devices use 320x480 (or 640x960) and take that out of the middle of each devices screen. On the iPhone 4’s this will fit perfectly. On the iPhone 5 there will be 44px at the top and bottom that are outside those bounderies (vertical, or left and right horizontally). In other words the screen coordinates for a horizontal iPhone 5 game using a fixed 320x480 screen size would actually be
-44,0 -------------------------524,0
| |
| |
-44,320-----------------------524,320
The iPad has the opposite problem as your extra space is on top and bottom for a landscape game.
Your background has to be bigger than the 320x480 so that it will bleed out on all devices (570x360 is the magic size).
The other way to address this is to use a flexible scaling where 0,0 is always the top left corner and display.contentWidth/display.contentHeight is the bottom right corner. This fills the screen exactly but you have to position things relativly based on distance from the edges or distance from the center. In other words elements will move in or out/ up or down based on the shape of the device. We blogged about this here:
http://www.coronalabs.com/blog/2012/12/04/the-ultimate-config-lua-file/
Any way, that blog post covers how to make backgrounds that work on all devices and covers how to do the @2x and @4x graphics relative to how you build your config.lua.
[import]uid: 199310 topic_id: 34212 reply_id: 136068[/import]