Class ResourceManager

Class Documentation

class ResourceManager

Singleton for handling the loading of resources from a game bundle.

Public Functions

template<typename T>
inline exathread::Future<std::shared_ptr<T>> Load(const std::string &address)

Load a resource by address.

Parameters:

address – The resource address to load from

Throws:
  • BadValueException – If the the address string is malformed

  • BadTypeException – If the template type does not match the loaded type of the resource

  • BadStateException – If no ResourceLoader has been configured

  • NonexistentValueException – If there is no resource at the provided address

Returns:

A future that will return a handle to the resource when completed

template<typename T, typename ...Types>
inline void ConfigureResourceLoader(T &&loader)

Set the resource loader for a given set of types.

Warning

This function may only be called once per type. This is usually performed by the runtime.

Parameters:

loader – The resource loader to use

Throws:

BadStateException – If a loader has already been configured

Public Static Functions

static ResourceManager &Get()

Get the instance and create one if there isn’t one.

Returns:

The instance