Book Image

Corona SDK Mobile Game Development: Beginner's Guide

By : Michelle M Fernandez
Book Image

Corona SDK Mobile Game Development: Beginner's Guide

By: Michelle M Fernandez

Overview of this book

Table of Contents (19 chapters)
Corona SDK Mobile Game Development Beginner's Guide Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Images


Many art assets are used in Corona applications images. You will notice that bitmap image objects are a type of display objects.

Loading an image

Using display.newImage(filename [, baseDirectory] [, left, top]), an image object is returned. The image data is loaded from a filename you specified for your image and looks in system.ResourceDirectory for that file. The acceptable types of image files that are supported are .png (PNG-24 or higher only) and .jpg files. Avoid high .jpg compression as it may take longer to load on a device. The.png files have better quality than the .jpg files and are used to display transparent images. The .jpg files do not save transparent images.

Image autoscaling

The default behavior of display.newImage() is to autoscale large images. This is to conserve texture memory. However, there are times when you do not want to have images autoscaled, and there is an optional Boolean flag in the parameter list to control this manually.

To override autoscaling and show...