template<typename TResource, typename TResourceFactoryMethod>
class ToyMaker::ResourceConstructor< TResource, TResourceFactoryMethod >
An object representing one method for creating a resource of a given kind.
A single resource may be created in multiple ways. A texture resource, for example, may be loaded from an image file, or procedurally generated, or simply allocated.
Each method that results in a Texture implements ResourceConstructor, and is recorded in the Resource's ResourceFactory, which is in turn used by a ResourceDatabase.
Usage
An example of a ResourceConstructor definition is given below:
public:
inline static std::string getResourceConstructorName() { return "fromDescription"; }
private:
std::shared_ptr<ToyMaker::IResource> createResource(const nlohmann::json& methodParameters) override;
};
Resource constructor for creating new NineSlicePanel resources from their descriptions in JSON.
Definition nine_slice_panel.hpp:156
Resource responsible for resizing a texture using the 9-slice technique, for use in UI elements.
Definition nine_slice_panel.hpp:38
An object representing one method for creating a resource of a given kind.
Definition resource_database.hpp:474
ResourceConstructor(int explicitlyInitializeMe)
Construct a new ResourceConstructor object.
Definition resource_database.hpp:491
Namespace containing all class definitions and functions related to the ToyMaker engine.
Definition camera_system.hpp:20
- Template Parameters
-
TResource | The type of resource this constructor creates. |
TResourceFactoryMethod | The derived class, the resource constructor itself. |
- See also
- Resource
-
ResourceFactory
-
ResourceDatabase