iPhone 4 problem!

As you know, iPhone 4 has an awesome 640 x 960 resolution. But how can we handle this resolution to be compatible with previous iPhones and iPod Touches?

I know there’s dynamic content scaling and I’ve wrote this little code to try it with iPhone 4 and previous models but I cannot try it on my iPod Touch since I’m waiting Apple to activate my Developer license.
Could you try this for me? Or have you wrote another solution for this problem?

Here is the code.

config.lua
[lua]application =
{
content =
{
width = 640,
height = 960,
scale = “zoomEven” – You can try also with “zoomStretch”, it seems to be the same on the simulator.
},
}[/lua]

main.lua
[lua]local image = display.newImage ( “Untitled-1.png” ) – I’ve designed a simple image at Photoshop. It’s 640 * 960.

– display.stageWidth is 640 (in simulator)
– display.stageHeight is 960 (in simulator)

local centerX = display.stageWidth / 2 – returns 320
local centerY = display.stageHeight / 2 – returns 480

image.x = centerX
image.y = centerY[/lua]

I tried this code on iPad, even if on simulator, and it seems to work for it.
Thanks,
William.

[import]uid: 7022 topic_id: 1361 reply_id: 301361[/import]

Ansca and all interested people should have a look at this http://globalmoxie.com/blog/designing-for-iphone4-retina-display.shtml

Ansca, does this works also for Corona powered apps/games? I’m talking about the iPhone 4 automatic scaling! [import]uid: 7022 topic_id: 1361 reply_id: 3742[/import]

I believe that article does not apply to Corona as Corona uses OpenGL and will always scale stuff … up AND down as you wish…

I wonder myself if I should create all images double sized and use a “scale” of 0.5 by default to make it look the right size on the iPhone 3G … and wonder if that will look “perfect” on the iPhone 4.

If nobody tests this … I may do that later … [import]uid: 6928 topic_id: 1361 reply_id: 3745[/import]

But I think that if you don’t set anything in the config file about scaling and you place your double-sized images in your app folder, it may work.
Of course this is speculation because I don’t have an iPhone 4.

Is there someone that could test this for us? [import]uid: 7022 topic_id: 1361 reply_id: 3746[/import]

You may need to disable the autoscaling for newImage for some or all images. I do not know when that kicks in… and I have no time atm :frowning: [import]uid: 6928 topic_id: 1361 reply_id: 3747[/import]

Yes, in fact. :wink:

I’ve sent an email to Evan, let’s see what he says. [import]uid: 7022 topic_id: 1361 reply_id: 3748[/import]

You can switch autoscaling for an image off as a parameter of display.newImage .

[import]uid: 5712 topic_id: 1361 reply_id: 3750[/import]

Yeah Mike… just what I said…

The question is what happens to say an 32x32 icon if you scale it to 0.5 … and look at it on 3GS and 4 in comparison…

Theoretically it should have higher resolution on the iPhone 4 … we need 2 Screenshots of this to compare the results. As the retina display has “320x480” points… so the extra pixels should be visible in my theory.

That would make it possible to develop with retina display in mind and still have only one set of images for the app. Depends on how got stuff gets scaled though… esp. regarding to alpha blending. [import]uid: 6928 topic_id: 1361 reply_id: 3752[/import]

Definitely wondering if the “add @2x” to your images will work per the article linked above.

Any updates on this?

Thanks [import]uid: 55 topic_id: 1361 reply_id: 3764[/import]

As soon as Evan answers my email, I let you know. :wink: [import]uid: 7022 topic_id: 1361 reply_id: 3766[/import]

any updates to this? its been a few weeks… :slight_smile: [import]uid: 5022 topic_id: 1361 reply_id: 4588[/import]

I’ve tried with “zoomEven” and “zoomStretch”, and it doesn’t work for iPhone 4.
So we have to wait something official from Ansca. [import]uid: 7022 topic_id: 1361 reply_id: 4589[/import]

Beta 8 now supports ios 4 builds so it supports the iPhone 4 screen resolution. Try and let us know how it works.

You can check out the changes here: https://developer.anscamobile.com/downloads/beta

-Tom [import]uid: 7559 topic_id: 1361 reply_id: 5339[/import]

Even with the beta 8, I’m still having problems with the iPhone 4. I tried using width = 640, height = 960 and scale = “zoomEven” in config.lua (which makes the text and graphics look great on the iPhone 4). The problem is the display.contentWidth and display.contentHeight are set to 640 and 960 respectively and don’t get adjusted to the actual pixel dimensions of the screen size (320 x 480). I can’t find a way to correctly position objects relative to the size of the screen. I hope that makes sense…

I also tried width = 320, height = 480 in config.lua and the text and vector graphics look really bad.

Is there a better way to handle the 640 x 960 resolution? Am I missing something?

Dave [import]uid: 8194 topic_id: 1361 reply_id: 5389[/import]

@dknell,

What exactly are you trying to do? Target a design that runs on the iPhone 4 at 640x960 but also works on the older iPhones?

When you say it looks bad at 320x480 can you provide details and a code sample so we can determine if there’s a problems.

Thanks,
-Tom [import]uid: 7559 topic_id: 1361 reply_id: 5419[/import]

Tom,
I am trying to create an app that works on iPhone 4, 3GS, 3G, and iPod Touch. I did some testing with different settings in config.lua and it seems that the most compatible is (which is what the programming guide suggests):

 width = 320,  
 height = 480,  
 scale = "zoomEven"  

So my question is what is the correct way to setup a project in beta 8 so we can take advantage of the high resolution of the iPhone 4 and also look good on the older phones. I am also curious about what size our graphics should be so they look great on the iPhone 4.

In GameSalad, there is a flag that can be set to enable resolution independence that will automatically scale everything. The graphics are created double the size (so a button that will be displayed as 50x50 will actually be a 100x100 png) and it automatically works on iPhone 4 and 3GS. When viewing on the iPhone 4, it looks really sharp.

What is the equivalent configuration in Corona?

Is there a sample of an app that has graphics that are optimized for the iPhone 4.

Thanks!
[import]uid: 8194 topic_id: 1361 reply_id: 5427[/import]

Perhaps a “retina display” project can be included in the Sample Code of Beta 8 and up, so we can see the config.lua and code for ourselves. [import]uid: 7849 topic_id: 1361 reply_id: 5498[/import]

Any news? [import]uid: 7022 topic_id: 1361 reply_id: 5672[/import]

Still haven’t heard anything on this one. Maybe they’re creating a sample retina display project as Jon suggested… Hopefully soon because I’m paying a graphic artist to create some graphics for a game and I would hate pay a lot of money for graphics that aren’t optimized for the iPhone 4. :frowning:

[import]uid: 8194 topic_id: 1361 reply_id: 5673[/import]

We think we have a solution for using different sets of graphics targeted for different resolution devices. This would allow one set of graphics for iPhone 3 and another for iPhone 4. Evan is in the process of writing up a description of how this is done. Hopefully that will be done soon and we can post some example code.

-Tom [import]uid: 7559 topic_id: 1361 reply_id: 5709[/import]