Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

iPhone 4 problem!
Started by Alwayk Jul 05 2010 08:48 PM

- - - - -
98 replies to this topic
[TOPIC CONTROLS]
Page 1 of 4 1 2 3 »
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

Alwayk

[GLOBAL: userInfoPane.html]
Alwayk
  • Enthusiast

  • 71 posts
  • Guests

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
application ={	content =	{		width = 640,		height = 960,		scale = "zoomEven"  -- You can try also with "zoomStretch", it seems to be the same on the simulator.	},}


main.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 320local centerY = display.stageHeight / 2 -- returns 480image.x = centerXimage.y = centerY


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

uid: 7022 topic_id: 1361 reply_id: 301361


[TOPIC: post.html]
#2

Alwayk

[GLOBAL: userInfoPane.html]
Alwayk
  • Enthusiast

  • 71 posts
  • Guests

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!
uid: 7022 topic_id: 1361 reply_id: 3742


[TOPIC: post.html]
#3

OderWat

[GLOBAL: userInfoPane.html]
OderWat
  • Contributor

  • 347 posts
  • Corona SDK

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 ..
uid: 6928 topic_id: 1361 reply_id: 3745


[TOPIC: post.html]
#4

Alwayk

[GLOBAL: userInfoPane.html]
Alwayk
  • Enthusiast

  • 71 posts
  • Guests

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?
uid: 7022 topic_id: 1361 reply_id: 3746


[TOPIC: post.html]
#5

OderWat

[GLOBAL: userInfoPane.html]
OderWat
  • Contributor

  • 347 posts
  • Corona SDK

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 :(
uid: 6928 topic_id: 1361 reply_id: 3747


[TOPIC: post.html]
#6

Alwayk

[GLOBAL: userInfoPane.html]
Alwayk
  • Enthusiast

  • 71 posts
  • Guests

Yes, in fact. ;)

I've sent an email to Evan, let's see what he says.
uid: 7022 topic_id: 1361 reply_id: 3748


[TOPIC: post.html]
#7

MikeHart

[GLOBAL: userInfoPane.html]
MikeHart
  • Corona Geek

  • 1,278 posts
  • Corona SDK

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

uid: 5712 topic_id: 1361 reply_id: 3750


[TOPIC: post.html]
#8

OderWat

[GLOBAL: userInfoPane.html]
OderWat
  • Contributor

  • 347 posts
  • Corona SDK

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.
uid: 6928 topic_id: 1361 reply_id: 3752


[TOPIC: post.html]
#9

traeregan

[GLOBAL: userInfoPane.html]
traeregan
  • Observer

  • 3 posts
  • Guests

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

Any updates on this?

Thanks
uid: 55 topic_id: 1361 reply_id: 3764


[TOPIC: post.html]
#10

Alwayk

[GLOBAL: userInfoPane.html]
Alwayk
  • Enthusiast

  • 71 posts
  • Guests

As soon as Evan answers my email, I let you know. ;)
uid: 7022 topic_id: 1361 reply_id: 3766


[TOPIC: post.html]
#11

chrislott

[GLOBAL: userInfoPane.html]
chrislott
  • Enthusiast

  • 39 posts
  • Corona SDK

any updates to this? its been a few weeks.. :)
uid: 5022 topic_id: 1361 reply_id: 4588


[TOPIC: post.html]
#12

Alwayk

[GLOBAL: userInfoPane.html]
Alwayk
  • Enthusiast

  • 71 posts
  • Guests

I've tried with "zoomEven" and "zoomStretch", and it doesn't work for iPhone 4.
So we have to wait something official from Ansca.
uid: 7022 topic_id: 1361 reply_id: 4589


[TOPIC: post.html]
#13

Tom

[GLOBAL: userInfoPane.html]
Tom
  • Moderator

  • 1,480 posts
  • Corona Staff

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
uid: 7559 topic_id: 1361 reply_id: 5339


[TOPIC: post.html]
#14

dknell

[GLOBAL: userInfoPane.html]
dknell
  • Contributor

  • 143 posts
  • Corona SDK

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
uid: 8194 topic_id: 1361 reply_id: 5389


[TOPIC: post.html]
#15

Tom

[GLOBAL: userInfoPane.html]
Tom
  • Moderator

  • 1,480 posts
  • Corona Staff

@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
uid: 7559 topic_id: 1361 reply_id: 5419


[TOPIC: post.html]
#16

dknell

[GLOBAL: userInfoPane.html]
dknell
  • Contributor

  • 143 posts
  • Corona SDK

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!
uid: 8194 topic_id: 1361 reply_id: 5427


[TOPIC: post.html]
#17

gabrielmdu

[GLOBAL: userInfoPane.html]
gabrielmdu
  • Observer

  • 2 posts
  • Corona SDK

dknell, I would like to know the answer from your question too.
uid: 8570 topic_id: 1361 reply_id: 5450


[TOPIC: post.html]
#18

jonbeebe

[GLOBAL: userInfoPane.html]
jonbeebe
  • Contributor

  • 511 posts
  • Corona SDK

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.
uid: 7849 topic_id: 1361 reply_id: 5498


[TOPIC: post.html]
#19

Alwayk

[GLOBAL: userInfoPane.html]
Alwayk
  • Enthusiast

  • 71 posts
  • Guests

Any news?
uid: 7022 topic_id: 1361 reply_id: 5672


[TOPIC: post.html]
#20

dknell

[GLOBAL: userInfoPane.html]
dknell
  • Contributor

  • 143 posts
  • Corona SDK

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. :(

uid: 8194 topic_id: 1361 reply_id: 5673


[TOPIC: post.html]
#21

Tom

[GLOBAL: userInfoPane.html]
Tom
  • Moderator

  • 1,480 posts
  • Corona Staff

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
uid: 7559 topic_id: 1361 reply_id: 5709


[TOPIC: post.html]
#22

jonbeebe

[GLOBAL: userInfoPane.html]
jonbeebe
  • Contributor

  • 511 posts
  • Corona SDK

@Tom: That's great news! Looking forward to Evan's description... just in time because I plan on getting a new iTouch 4 soon so I can start taking advantage of the "retina display" in my projects.
uid: 7849 topic_id: 1361 reply_id: 5710


[TOPIC: post.html]
#23

dknell

[GLOBAL: userInfoPane.html]
dknell
  • Contributor

  • 143 posts
  • Corona SDK

Thanks Tom! I'm curious to see what you guys have come up with. My only concern with having 2 copies of every graphic is it will make the binary fairly large. Then what happens when you guys enable universal binaries someday (theoretically) - we would need 3 copies of every graphic file. I know I'm jumping the gun here but would it be a reasonable request to have a "resolution independence" option where Corona assumes ALL images in the project are at least twice as big as they will be displayed? So if I have a 200x80 button, my png will be 400x160.

Just a thought.

Dave
uid: 8194 topic_id: 1361 reply_id: 5712


[TOPIC: post.html]
#24

Magenda

[GLOBAL: userInfoPane.html]
Magenda
  • Contributor

  • 427 posts
  • Corona SDK


I think that downsizing a sprite in real-time is significantly dropping the effective fps because of increased cpu load. So, we either ask for small game footprint or good performance. Since Corona SDK is minimalistic in footprint but struggles to run smoothly on 60hz, personally I would go for the bigger game size. In other words, I would prefer using double images. This is the solution that most Cocos2d developers also prefer, among the two choices.
uid: 7356 topic_id: 1361 reply_id: 5713


[TOPIC: post.html]
#25

Alwayk

[GLOBAL: userInfoPane.html]
Alwayk
  • Enthusiast

  • 71 posts
  • Guests

I agree with Magenda. ;) Can't wait for this!
uid: 7022 topic_id: 1361 reply_id: 5739



[topic_controls]
Page 1 of 4 1 2 3 »
 
[/topic_controls]