iPad @2x Image Support

I figure this deserves its own post, I recently asked the question to peach but the thread was regarding something else and I tried searching on the forums for this answer but did not came across any clarification. As peach said on my other post (ill post link below) iPad/iPad2 are not Retina Display but I tried display.newImageRect with double size image @2x.png and the graphics look A LOT sharper and better then display.newImage. Am I missing something here? I thought newImageRect was only for iPhone4 and iPhone4S because of Retina Display?

PS: I started this thread to clarify this topic incase others like myself have this question or in the future. Did not intended to spam forums because the link ill post below was intended for another question.

Link: https://developer.anscamobile.com/forum/2012/02/14/ipad-only-build

Thanks in advance,
Chris L. [import]uid: 30314 topic_id: 21846 reply_id: 321846[/import]

Corona supports dynamic image resolutions to any screen size.

Here’s what you might do in your config.lua:

[code]application = {
content = {
width = 320,
height = 480,
scale = “letterbox”,

imageSuffix = {
["@15x"] = 1.3,
["@2x"] = 1.8
}
}
}[/code]

Now, any screen resolution that is over 1.3 times the default 320x480 will automatically use the higher res 1.5x image (or whatever suffix you want to use, useful for Android). But any screen over 1.8x will now use the full-on 2x resolution images. Note that we say “= 1.8” so that devices close to 2x will also get picked up.

This saves texture memory on smaller screens when it can, and automatically selects the best available resolution image for all screen sizes. You can also have as many custom suffixes as you want!

To your original question, the iPad picks up ["@2x"] = 2.0, and grabs the higher resolution just like the iPhone 4.

Full details: http://developer.anscamobile.com/content/configuring-projects#Dynamic_Image_Resolution [import]uid: 87138 topic_id: 21846 reply_id: 86816[/import]

@ Revaerie

Thank You very much for the detailed explanation and code snippet. [import]uid: 30314 topic_id: 21846 reply_id: 86819[/import]

this is my setup

local mm = system.getInfo( "model" )  
  
if mm == "iPhone" or mm == "iPhone Simulator" then  
  
 application =  
 {  
 content =  
 {  
 width = 320,  
 height = 480,  
 scale = "letterbox",  
 fps = 60,  
 antialias = false,  
 xalign = "center",  
 yalign = "center",  
  
 imageSuffix =  
 {  
 ["@2x"] = 2,  
 },  
 },  
 }  
  
end  
  
if mm == "iPad" or mm == "iPad Simulator" then  
  
 application =  
 {  
 content =  
 {  
 width = 384,  
 height = 512,  
 scale = "letterbox",  
 fps = 60,  
 antialias = false,  
 xalign = "center",  
 yalign = "center",  
  
 imageSuffix =  
 {  
 ["-Portrait"] = 2,  
 ["@2x"] = 2,  
 },  
 },  
  
 }  
  
end  
  

iPad is using graphics for iphone4 with few background made specific for its resolution with -Portrait suffix. So in total there are three Default files / menu background / game background, but other files are just @2x.

Default-Portrait.png 768x1024
Default@2x.png 640x960
Default.png 320x480

Order is important.

All game mechanics are designed for in game resolution 320x480.
Probably when iPad 3 will came then it will just to add proper suffix for it in the iPad part of the config file.

  
 imageSuffix =  
 {  
 ["-Portrait2x"] = 4,   
 ["-Portrait"] = 2,  
 ["@2x"] = 2,  
 },  

Regards
Tom [import]uid: 111283 topic_id: 21846 reply_id: 86852[/import]

@ Bladko

Thanks for Sharing that looks pretty well organized , is there a reason for your iPad to have this numbers? I would had though you needed to put 1024, 768 or this like “magic” numbers to work with?

width = 384,
height = 512, [import]uid: 30314 topic_id: 21846 reply_id: 86894[/import]

reason is simple. Game mechanics are designed for 320x480 :slight_smile: [import]uid: 111283 topic_id: 21846 reply_id: 86903[/import]