blob: dcf3dbdb5c38193570f731a6d268867d50058af6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
|