ToyMaker Game Engine
0.0.2
ToyMaker is a game engine developed and maintained by Zoheb Shujauddin.
Toggle main menu visibility
Loading...
Searching...
No Matches
ecs_world_resource_ext.hpp
Go to the documentation of this file.
1
11
12
#ifndef TOYMAKERENGINE_SIMPLEECSRESOURCECOMPONENTEXT_H
13
#define TOYMAKERENGINE_SIMPLEECSRESOURCECOMPONENTEXT_H
14
15
#include <type_traits>
16
#include <nlohmann/json.hpp>
17
18
#include "
ecs_world.hpp
"
19
#include "
resource_database.hpp
"
20
21
namespace
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) {
46
return
ResourceDatabase::GetRegisteredResource<TResource>
(
47
jsonResource.at(
"resourceName"
)
48
);
49
}
50
};
51
}
52
53
#endif
ToyMaker::ResourceDatabase::GetRegisteredResource
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:518
ecs_world.hpp
ToyMaker Engine's implementation of an ECS system.
ToyMaker
Namespace containing all class definitions and functions related to the ToyMaker engine.
Definition
application.hpp:25
std
STL namespace.
resource_database.hpp
Headers relating to resources and their management for a given project.
ToyMaker::ComponentFromJSON< std::shared_ptr< TResource >, typename std::enable_if< std::is_base_of< IResource, TResource >::value >::type >::get
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
ToyMaker::ComponentFromJSON
A struct that describes how a JSON component description is turned into a component.
Definition
ecs_world.hpp:289
ToyMaker_Main
include
toymaker
engine
core
ecs_world_resource_ext.hpp
Generated on
for ToyMaker Game Engine by
1.17.0