Home | All Classes | Grouped Classes | Index | Search
The ClanLib resource manager. More...
Derived from:
none
Derived by:
none
Group: Core (Resources)
#include <ClanLib/core.h>
Construction:
Resource Manager constructor. |
Attributes:
Returns true if a resource exists. | |
Returns a pointer to the CL_Resource representing the given resource. | |
Returns a list of all resources available. | |
Returns a list of all resource sections available. | |
Returns a list of the resource sections immediately under the given secion. | |
Returns a list of all resources available matching a given type. | |
Returns a pointer to the input source provider, in which all resources are stored. |
Signals:
Signal invoked when a resource is added during loading of a resource file. |
Operations:
Returns true resource managers handles the same object. | |
Add resources from an other resource manager. | |
Remove resources from an other resource manager. | |
Loads all resources into memory. | |
Unloads all resources from memory. | |
Loads all resources in a given section into memory. | |
Unloads all resources in a given section into memory. |
Detailed description:
!group=Core/Resources! !header=core.h!The resource manager is used to retrieve resources from a given resource source.
This can either be a resource script file (used as input to the datafile compiler), or a datafile with all the resources included into one large gzipped resource file.
To speedup loading of resources in a game, you can load entire sections of resources at once. When a resource in the section is requested, it is returned instantly without having to access the disk. This is especially useful to make sure all the game resources are loaded before the game is started.
Resources are normally not retrieved using the get_resource() function. Instead, you should load the resource using the appropiate resource type class. For instance, a surface is easiest loaded like this:
CL_ResourceManager res_manager("my_datafile.dat", true); CL_Surface my_surface("my_surface", &res_manager);
Getting the same resource twice won't create a new instance of the resource; they are reference counted.