Game Development Reference
In-Depth Information
Introducing AssetManager 2.0
Our old asset manager loads and holds only textures. We want to improve that by adding
support for
SoundBuffer
objects. Both classes are similar when it comes to loading
them, so our code for
SoundBuffer
looks almost the same as the one for the textures.
This is what our updated
AssetManager.h
file looks like:
We use the audio module to load sound buffers so we need to include the audio module. In
AssetManager
, in addition to the code which handles textures, we can see a map to
store sound buffers and a method to load and retrieve them—exactly the same approach as
for textures.
Let's take a peek at the implementation of
AssetManager::GetSoundBuffer()
: