Game Development Reference
In-Depth Information
Note that this function is a static one, which means that we have to get the map from the
instance through the static instance pointer, sInstance . After that, we will check
whether the requested texture was already loaded by calling map<>::find() . The
function returns an iterator pointing at the pair found. If no pair is found, it points to
map<>::end() . If the filename is found, we will return the texture object in the pair
(the second element). If the filename is not found, we will create a slot in the map for that
texture and load the texture from the filename argument.
This is pretty much everything that AssetManager does; it just holds a map of textures
and has an interface to access them. As we go on further in this topic, we will add more
assets in the manager, such as fonts, shaders, music, and sounds.
And finally, here is how we can initialize and use AssetManager :
Search WWH ::




Custom Search