How to provide same graphics for iPad and Retina?

I have a universal, portrait orientation iOS project and want to provide two sets of graphics:

- @2x for iPad, and iPhone Retina
- normal graphics for all the rest, i.e. 320x480 resolutions (this is the resolution I coded for in my project)

In addition, to avoid edges, I want to provide a single separate background image for the iPad, at 768x1024.

Now, trying to set up my project with different config settings, the background image will not fill the whole. I used different code approaches to no avail so far so I don't have a single "non-working" code snippet. I tried things like if system.getInfo("model") == "iPad" then in the config.lua, providing imageSuffix, checking for system.getInfo('model') etc. I'm currently testing using the Windows simulator.

What's the right way to set this up so that the background will fill the whole screen on the iPad?

Thanks!!

Check out tip #3 found here:

http://www.base2solutions.com/walkabout/Corona%20Tips.html#3

Using those techniques, I was able to get multiple backgrounds loading on specific devices.

Thanks! This interesting guideline pushed me to try again, fail again, then realize the real problem was slightly elsewhere -- I had included walls outside the screen to bounce off things, and I had forgot to set these walls to be invisible (as they are out of screen anyway on 320x480)! Because the walls were now inside the screen on 768x1024, I was effectively doing my own letterbox bars! Removing these walls, I was now able to do it via something like

1
2
3
    if app.device == 'iPad' then imageName = imageName .. '-768x1024' end -- I want to change this later to be a more device neutral check
    local self = spriteModule.spriteClass('rectangle', 'background', nil, imageName, false, app.maxXHalf, app.maxYHalf,
            768 * display.contentScaleX, 1024 * display.contentScaleY)

PS: Worth noting that the linked tutorial's approach to get the actual device resolution doesn't seem to work (at least not anymore). So at the moment I need to do the workaround of first checking for the device (iPad), then setting those values manually.

views:1619 update:2011/10/10 15:46:04
corona forums © 2003-2011