Centering iPad background on iPhone

Hello everyone,

I have a probably simple issue that I can’t figure out. I have an iPad sized background at 1024x768 in size. The background will obviously fit an iPad screen perfectly, but when you put it on an iPhone proportionally the image is too tall to fit on the iPhone screen. I wanted to to find a way to center the background on the iPhone so that the top and bottoms of the background are off the screen, but when run on the iPad it will fill the entire screen. Is there a way to do this?

If I use this:

[lua]background.x = background.contentWidth/2
background.y = background.contentHeight/2[/lua]

What it does is align the background to the top of the iPhone screen but all the trimming is done at the bottom of the image. I was hoping to trim an equal amount on both the top and the bottom. Any ideas? [import]uid: 31262 topic_id: 22690 reply_id: 322690[/import]

You must be using the letterbox scale mode. It’s because Corona treats your 1024x768 image as 960x720 or 480x360 for placement purposes. Play with the different scale modes in config.lua or dynamic scaling with newImageRect. Alternately, you can crop your image yourself and load the one appropriate to a system.getInfo(“model”) result. [import]uid: 44647 topic_id: 22690 reply_id: 90498[/import]

Ahh ok this right?

http://developer.anscamobile.com/node/2766

I think that can work. I’ll check for iPad and display that background and put the iPhone background in the else clause. Thanks! [import]uid: 31262 topic_id: 22690 reply_id: 90518[/import]