THIS PAGE REQUIRES UPDATING FOR CLANLIB 3.0
The resource manager in ClanLib allows you to use a central source for all your resources in your application. The system defines a simple XML format describing resources used by ClanLib, and since it is XML it also allows you to use it for your own custom resources.
A resource XML file may look like this:
The class clan::ResourceManager is used to load, manage and save resource files. The syntax for loading resources is fairly straightforward:
Although the above syntax is the common way to load resources, in reality all objects defined in a resource XML are all represented as clan::Resource objects. To illustrate how this object is used, the above clan::Texture constructor used to load a texture may have been implemented like this:
In the same way we might create our own custom resource loader: