- Main Page
- Classes
- Files
- Directories
- Related Pages

- Class List
- Class Hierarchy
- Class Members

# KrResourceVault Class Reference

The vault is a container for resources. More...

`#include <vault.h>`

List of all members.

## Public Member Functions
bool | LoadDatFile (const char *fileName)
| Load in a .dat file from disk.
bool | LoadDatFileFromMemory (void *memory, int size)
| Load in a .dat file from disk.
int | ResourceCount ()
| How many resources are in the vault?
GlSListIterator< KrResource * > | GetResourceIterator ()
| Get an interator that can walk all the resources in this vault.
void | AddResource (KrResource *resource)
| Add user created resources - generally canvases. Will be owned and deleted by the vault.
KrResource * | GetResource (const std::string &type, const std::string &name)
| Return a pointer to a resource. Null if the resource isn't found.
KrResource * | GetResource (U32 type, const std::string &name)
| Return a pointer to a resource. Null if the resource isn't found.
KrResource * | GetResource (U32 type, U32 resourceId)
| Return a pointer to a resource. Null if the resource isn't found.
KrSpriteResource * | GetSpriteResource (const std::string &name)
| Return a pointer to a resource. Null if the resource isn't found.
KrSpriteResource * | GetSpriteResource (U32 resourceId)
| Return a pointer to a resource. Null if the resource isn't found.
KrTileResource * | GetTileResource (const std::string &name)
| Return a pointer to a resource. Null if the resource isn't found.
KrTileResource * | GetTileResource (U32 resourceId)
| Return a pointer to a resource. Null if the resource isn't found.
KrFontResource * | GetFontResource (const std::string &name)
| Return a pointer to a resource. Null if the resource isn't found.
KrFontResource * | GetFontResource (U32 resourceId)
| Return a pointer to a resource. Null if the resource isn't found.
KrTextDataResource * | GetTextDataResource (const std::string &name)
| Return a pointer to a resource. Null if the resource isn't found.
KrTextDataResource * | GetTextDataResource (U32 resourceId)
| Return a pointer to a resource. Null if the resource isn't found.
KrBinaryDataResource * | GetBinaryDataResource (const std::string &name)
| Return a pointer to a resource. Null if the resource isn't found.
KrBinaryDataResource * | GetBinaryDataResource (U32 resourceId)
| Return a pointer to a resource. Null if the resource isn't found.
virtual void | CacheScale (GlFixed xScale, GlFixed yScale)
| For cached scaling, cache all the resources in this vault.
virtual void | FreeScaleCache ()
| For cached scaling, free all the scale caches in this vault.

## Detailed Description

The vault is a container for resources.

The sequence of steps generally followed is:

- A vault is created and resources are read from a stream.
- Nhe engine is created, used, and destroyed.
- The vault is deleted.

It would be bad to delete resources the engine is using.

Note that the engine has a "default vault" Engine()->Vault() that it manages for you. It is usually simpler to use that Vault rather than manage your own.

## Member Function Documentation

GlSListIterator< KrResource* > KrResourceVault::GetResourceIterator | ( |  | ) |

Get an interator that can walk all the resources in this vault.

Useful if you want to list resources, for instance if making an editor or allowing the user to choose between available fonts.

bool KrResourceVault::LoadDatFile | ( | const char * | fileName | ) |

Load in a .dat file from disk.

Only one dat files can be loaded into a vault; but the engine can use multiple vaults.

bool KrResourceVault::LoadDatFileFromMemory | ( | void * | memory,
|  | int | size |
| ) |  |  |

Load in a .dat file from disk.

Only one dat files can be loaded into a vault; but the engine can use multiple vaults.

The documentation for this class was generated from the following file:

- vault.h