8#ifndef GALAXY_CORE_PREFAB_HPP_
9#define GALAXY_CORE_PREFAB_HPP_
11#include <entt/fwd.hpp>
12#include <nlohmann/json.hpp>
35 Prefab(entt::entity entity, entt::registry& registry);
42 Prefab(
const nlohmann::json& json);
75 bool load(
const std::string& file);
83 void from_entity(entt::entity entity, entt::registry& registry);
90 void from_json(
const nlohmann::json& json);
100 entt::entity
to_entity(entt::registry& registry)
const;
108 const nlohmann::json&
to_json()
const;
Preconstructed entity definition that can be loaded at any time.
entt::entity to_entity(entt::registry ®istry) const
Creates an entity from this prefab.
const nlohmann::json & to_json() const
Gets the json representation of this prefab.
nlohmann::json m_json
Prefab as json data.
bool load(const std::string &file)
Loads from a json file on disk.
void from_json(const nlohmann::json &json)
Creates the prefab from a json object.
Prefab & operator=(const Prefab &)
Copy assignment operator.
void from_entity(entt::entity entity, entt::registry ®istry)
Creates the prefab from an entity.