problems getting retina device dimensions right

I am making a game that I (for my own sanity as scaling and such currently seems too complex - I will get into that at a later stage) target to IPhone retina devices (= 4 and 4s).

  1. I am not sure how to tell when building which minimum requirements, the app I get thinks it is for all iPhones from iOS 3.2 upwards, which is not what I want.

  2. I set the dimensions to 960 and 640 in landscape mode in the config.lua and on the device I get this:

The actual game play unfolds correctly on the whole screen, however the graphics are scaled down by factor 0.5 and centered in the middle.

How to get that right? Currently I have no further ideas what I did wrong and advice is appreciated. [import]uid: 109677 topic_id: 22613 reply_id: 322613[/import]

Scaling for different devices is actually very easy and I’d get that right first instead of worrying about it at the end.

[lua]application =
{
content =
{
width = 320,
height = 480,
scale = “letterbox”, – or “zoomEven”

imageSuffix =
{
["@2x"] = 2,

},
},
}[/lua]

Save your graphics for retina and other hi-res devices with the @2x suffix, and low-res graphics as normal.

i.e you would have a 960 x 640 background graphic at 320 dpi called ‘background@2x.png’, and a 480 x 320 graphic at 150 dpi called ‘background.png’.

To load this in Corona, you’d use:

[lua]background = display.newImageRect(“background.png”,480,320)
background.x = 240; background.y = 160[/lua]

This will place the background in the right place with the appropriate image resolution whatever device it is run on. On android devices or the iPad this may give you black borders, but you can fill these by making the background image bigger than the standard iPhone size:

“background@2x.png” (1024 x 768)
“background.png” (512 x 384)

[lua]background = display.newImageRect(“background.png”,512,384)
background.x = 240; background.y = 160[/lua]

This will fill the whole screen on an iPad or iPhone, with some bits round the edge cut off on iPhone.

Alternatively, if you are not bothered about a little bit of distortion of the aspect ratio, use ‘zoomStretch’ and everything will be stretched to fit whatever screen size the device has. [import]uid: 93133 topic_id: 22613 reply_id: 90175[/import]

Hello, thanks, I am not sure about the dpi values you give and why these would matter. The current resolution of my images is 960 x 640 pixels, where and why does this dpi come in?

Also, why does the Corona simulator show something different than the device? I have set it to view iPhone4 and everything looked perfect and I coded the whole thing so it would fit with what I saw in the simulator.

I tried an easy fix with scaleEven in the hope it would just scale my images correctly on iPhone corresponding to 1x actual pixel resolution but it does not do the trick, still 0.5 x size displayed on retina device.

Looks it will be quite some work to fix that now. [import]uid: 109677 topic_id: 22613 reply_id: 90208[/import]

I’ve just read a number of conflicting messages about DPI, and have come to the conclusion that on iOS at least, it is irrelevant.

However, you should still set up your project as 480 x 320 - this is the number of ‘reference points’ on a retina screen, irrespective of the resolution. On a retina display, 4 pixels will be crammed into the one point.

If you set up your project as 480 x 320, and load your images as 480 x 320, when it’s run on a retina display corona will automatically pick up the 960 x 640 image with the @2x suffix.

[import]uid: 93133 topic_id: 22613 reply_id: 90214[/import]

ok, thanks again.

Do you happen to know what the current wisdom is concerning sprite sheets?
Will it work just the same, a 1x version for 3g and a @2 version for 4?

And the physics shapes? I am using PhysicsEditor and I guess here I will have trouble big time. What can I do? I have *lots of* custom shapes and they are essential for the game (I really would love to just have my retina version and that´s it, I doubt it will run well on 3g anyways, but I do not get it to work with high res graphics and correct scaling without all that hassle about old devices.)

ALL text btw. is totally off as well and here I see no scaling option at all.

That is why I wanted to keep some sanity as a beginner and only have retina size, now I am half way done with background scaling and lost totally. Nothing works anymore, the whole setup is absolutely broken and I really do not want iPad, old devices or Android sizes, there should be a simple option to just have retina iPhone size, but HOW?? [import]uid: 109677 topic_id: 22613 reply_id: 90332[/import]

eventually I got using zoomEven to make it resemble on device what I see in simulator and I will not get into scaling for a long while but would still be very interested in hearing how others handle scaling with text, sprite sheets and custom physics shapes in an efficient way. [import]uid: 109677 topic_id: 22613 reply_id: 90353[/import]