Game of Ur 0.3.3
This is a computer adaptation of Game of Ur, written in C++ mainly using SDL and OpenGL.
Loading...
Searching...
No Matches
ecs_world_resource_ext.hpp
Go to the documentation of this file.
1
11
12#ifndef FOOLSENGINE_SIMPLEECSRESOURCECOMPONENTEXT_H
13#define FOOLSENGINE_SIMPLEECSRESOURCECOMPONENTEXT_H
14
15#include <type_traits>
16#include <nlohmann/json.hpp>
17
18#include "ecs_world.hpp"
19#include "resource_database.hpp"
20
21namespace ToyMaker {
22
33 template <typename TResource>
34 struct ComponentFromJSON<std::shared_ptr<TResource>,
35 typename std::enable_if<std::is_base_of<
36 IResource, TResource
37 >::value>::type > {
38
45 static std::shared_ptr<TResource> get(const nlohmann::json& jsonResource) {
47 jsonResource.at("resourceName")
48 );
49 }
50 };
51}
52
53#endif
static std::shared_ptr< TResource > GetRegisteredResource(const std::string &resourceName)
Gets a reference to or constructs a Resource by name whose description has been stored in this Resour...
Definition resource_database.hpp:521
ToyMaker Engine's implementation of an ECS system.
Namespace containing all class definitions and functions related to the ToyMaker engine.
Definition camera_system.hpp:20
STL namespace.
Headers relating to resources and their management for a given project.
static std::shared_ptr< TResource > get(const nlohmann::json &jsonResource)
Helper function which constructs or fetches a reference to a resource defined in the Resource Databas...
Definition ecs_world_resource_ext.hpp:45
A struct that describes how a JSON component description is turned into a component.
Definition ecs_world.hpp:289