Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning AndEngine

You're reading from   Learning AndEngine Design and create Android games with the simple but powerful tool AndEngine

Arrow left icon
Product type Paperback
Published in Sep 2014
Publisher
ISBN-13 9781783985968
Length 286 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Martin Varga Martin Varga
Author Profile Icon Martin Varga
Martin Varga
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Managing resources

In many games written in AndEngine, you will see the ResourceManager class. It's one of the established patterns that you should be using as well. ResourceManager is simply a class that takes care of loading and unloading of the resources. Because the memory in Android devices is very limited, it is important to have a centralized point that will ensure each asset is loaded only once and made available throughout the entire game code. When working with limited space, you can also consider unloading resources that are not being currently used.

Note

When you suspend a game by pressing the Home button or when another activity takes over, for example, when receiving a call, resources might be unloaded automatically. AndEngine makes them available again when the control is returned to the game.

The ResourceManager class is usually designed as a singleton. That is another design pattern. It ensures that only one instance of the class is created during the entire run of the...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime