Game Development Reference
In-Depth Information
AssetManager 4.0
We have now added new resources to our manager several times. For shaders, the structure
does not change much, with the exception that a shader program is defined by two file-
names (
vertex
and
fragment
), rather than one (a texture for example).
First of all, we add our map and the
AssetManager::GetShader()
method:
Note that for the
AssetManager::GetShader()
we return a pointer to the shader,
rather than a reference. This is for convenience, since SFML requires a pointer when we
want to use it. We don't store
Shader
instances as a value, but we actually use a smart
pointer. The reason for this that
Shader
instances cannot be copied (which is necessary
for the map container). This is what the method's implementation looks like: