Class ResourceManager

Nested Relationships

Nested Types

Class Documentation

class ResourceManager

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

Warning

This API is still very much under construction and will change as design stuff is worked out! Do not rely on the current version of this API!

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. If the engine is not launched in standalone mode, this will be done automatically, and it will not be possible to change the loader for the default resource types.

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