Question

What is the difference between display.newImage() and display.newImageRect()?

Which one is better to use?

Was it helpful?

Solution

The documentation of display.newImage() mentions specifically:

NOTE: display.newImageRect() should be used instead to load images when dynamic content scaling is enabled.

And similarly, on display.newImageRect()

dispaly.newImageRect() automatically substitutes higher-resolution assets on higher-resolution devices. The actual image chosen will depend on the current content scale determined by Corona, which is the ratio between the current screen and the base content dimensions defined in config.lua.

Based on this scale, Corona uses the imageSuffix table (also defined in config.lua), which lists the suffixes for the same family of images, to find the best match from the image choices available.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top