The memory problem and the BitmapStore
In all the projects since we introduced the Bitmap
class back in Chapter 13 the class representing the object in the game also held a copy of the Bitmap
. It is slightly different in the previous project because each GameObject
instance had a graphics-related component class of some type which held the Bitmap
. It still amounts to the same thing because each game object still has/needed a copy of the appropriate Bitmap
.
When we have just a few of each alien type as we did in the previous project this is not a problem but, in this project, we will have more than a hundred of some of the Bitmaps representing the tiles that make the platforms. At best this is inefficient and will waste memory, device power and ...
Get Learning Java by Building Android Games - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.