diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-13 12:31:59 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-13 12:31:59 +0100 |
commit | c58fbbefd5a426c38b1182e9e760f149f0091670 (patch) | |
tree | cc512d4cf90addfd7bca66c0407afdaabff8d0a5 /src/crepe/Resource.h | |
parent | 827f09031e2d3cc15e956b242774a4566e1403c1 (diff) |
move some files from `loek/tests` to `loek/audio`
Diffstat (limited to 'src/crepe/Resource.h')
-rw-r--r-- | src/crepe/Resource.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/crepe/Resource.h b/src/crepe/Resource.h new file mode 100644 index 0000000..dcf3dbd --- /dev/null +++ b/src/crepe/Resource.h @@ -0,0 +1,33 @@ +#pragma once + +#include <memory> + +namespace crepe { + +class ResourceManager; +class Asset; + +/** + * Resource is an interface class used to represent a (deserialized) game + * resource (e.g. textures, sounds). + */ +class Resource { +private: + /** + * \brief Prototype pattern clone function. + * + * \param src Source file of new resource (abstraction for file saved on + * disk) + * + * \returns New instance of concrete resource + */ + virtual std::unique_ptr<Resource> clone(const Asset & src) const = 0; + /** + * The resource manager uses \c clone to create new instances of the concrete + * resource class. This may be used to inherit references to classes that + * would otherwise need to be implemented as singletons. + */ + friend class ResourceManager; +}; + +} // namespace crepe |