Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Corona - how to accommodate different device resolutions whilst retaining quality for hi-res devices?

How is it possible to accommodate lower resolutions from Corona but primarily target high resolution devices?

I know you can specifically set content width and height via Corona, and scale the content, but this seems to be for scaling upwards (method detailed here http://blog.anscamobile.com/2011/01/use-dynamic-layouts-in-universal-builds-with-corona-sdk/).

I've been creating an iPad app but I'd not targeted any resolution - my app appears fine on iPad 1 / 2 and on iPhone 4, but not on the original iPhone.

like image 397
BrynJ Avatar asked Jan 22 '26 03:01

BrynJ


1 Answers

There are two terms you need to pay attention to: dynamic content scaling and dynamic image resolution. The former refers to scaling the stage in Corona to fit on different displays, and the latter refers to swapping different versions of images on different displays. Here's documentation about both:

http://blog.anscamobile.com/2010/11/content-scaling-made-easy/#more-3756

http://developer.anscamobile.com/content/configuring-projects#Dynamic_Image_Resolution

First setup dynamic content scaling in config.lua so that the display will scale on different devices.

Then setup dynamic image resolution (also set in config.lua) so that you can swap in higher resolution versions of your graphics on devices with higher resolution. This is done through naming of the image files; basically, when you call newImageRect("image.png") in your code, it'll load image.png on lower resolution devices and [email protected] on higher res devices.

(incidentally, while the dynamic image resolution configuration on the linked page uses the suffix "@2" I would recommend "@2x" because that is the standard suffix Apple uses. That is, in Corona you don't have to use Apple's standard, but it's less confusing if you do.)

like image 56
jhocking Avatar answered Jan 24 '26 20:01

jhocking



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!