Book Image

Libgdx Cross-platform Game Development Cookbook

Book Image

Libgdx Cross-platform Game Development Cookbook

Overview of this book

Table of Contents (20 chapters)
Libgdx Cross-platform Game Development Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Getting to know AssetManager


One of the main advantages of using AssetManager is that resources will be reference counted. This means that they will be allocated in memory just once; it doesn't matter how many times you use it in code. This also includes safe dependency disposal; for instance, if an asset X depends directly on another asset Y, the latter will not be deleted until the former has been disposed of.

In terms of organization and clarity, it is a good point to gather all resources in the same place, so it is a recommended practice to always include AssetManager.

Obvious, but not less important, is the fact that AssetManager allows us to load resources whenever we need them, neither before nor after. We have to bear in mind that Libgdx's target platform can include mobile devices, not only desktop, so we must be aware of the resources and not deliberately waste them.

Getting ready

The sample projects are required to follow this recipe; make sure you already have them in your Eclipse...