How to get the right display size?

Is it possible to build a universal app with graphics for iPhone4, iPhone5, iPad2 and iPad3(Retina) and checking in the code, which device is running, so the right images can be loaded?

For example with

system.getInfo

we can get back the model, but NOT the exact model, like iPad2 or iPad3(Retina). Is this somehow possible, so I can load 1024px images for iPad2 or 2048px images if the device is an iPad3?

Thank you!

Daniela

Hi Daniela,

Are you referring to the built-in dynamic image selection in Corona using “newImageRect()” instead of “newImage()”? I can point you to the correct guides on that if you need help.

Brent

I know about the usage of the @2x and normal size images, but I can’t find anything which is covering ALL devices like iPad2, iPad3(Retina), iPhone4 and the iPhone5. Can this be done with the built-in dynamic image selection, or is this kind of selection only for selecting iPhone 3 from iPhone4  … and iPad 2 from iPad3(Retina)?

Thank you!

Hi Daniela,

Dynamic image selection is completely flexible, and you’re not locked into just 2 “sets” of images, nor do you need to begin with 320x480 and work up from there. You can even start at a high target resolution and work down to lower resolutions. It’s just a matter of setting up the proper image suffixes in your config.lua, and working out the proper range calculations for them. You can definitely add a @4x bracket if you want; just calculate the range value depending on your configuration and you’ll be all set!

Take care,

Brent

Hi Daniela,

Are you referring to the built-in dynamic image selection in Corona using “newImageRect()” instead of “newImage()”? I can point you to the correct guides on that if you need help.

Brent

I know about the usage of the @2x and normal size images, but I can’t find anything which is covering ALL devices like iPad2, iPad3(Retina), iPhone4 and the iPhone5. Can this be done with the built-in dynamic image selection, or is this kind of selection only for selecting iPhone 3 from iPhone4  … and iPad 2 from iPad3(Retina)?

Thank you!

Hi Daniela,

Dynamic image selection is completely flexible, and you’re not locked into just 2 “sets” of images, nor do you need to begin with 320x480 and work up from there. You can even start at a high target resolution and work down to lower resolutions. It’s just a matter of setting up the proper image suffixes in your config.lua, and working out the proper range calculations for them. You can definitely add a @4x bracket if you want; just calculate the range value depending on your configuration and you’ll be all set!

Take care,

Brent