8#include "galaxy/core/ServiceLocator.hpp"
9#include "galaxy/core/ServiceLocator.hpp"
13#include "galaxy/meta/EntityMeta.hpp"
18#ifdef GALAXY_WIN_PLATFORM
48 this->
m_json = std::move(p.m_json);
65 this->
m_json = std::move(p.m_json);
77 auto& fs = core::ServiceLocator<fs::VirtualFileSystem>::ref();
79 const auto data = fs.read(file);
85 from_json(nlohmann::json::parse(decompressed));
97 auto& em = ServiceLocator<meta::EntityMeta>::ref();
99 if (registry.valid(entity))
101 m_json = em.serialize_entity(entity, registry);
107 if (json.contains(
"components"))
115 auto& em = ServiceLocator<meta::EntityMeta>::ref();
116 return em.deserialize_entity(
m_json, registry);
126#ifdef GALAXY_WIN_PLATFORM
#define GALAXY_LOG(level, msg,...)
#define GALAXY_DISABLE_WARNING_POP
#define GALAXY_DISABLE_WARNING(x)
#define GALAXY_DISABLE_WARNING_PUSH
Pragma.hpp galaxy.
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.
std::string decode_base64(const std::string &input)
Decompresses string into Base64.
std::string decode_zlib(const std::string &input)
Decompresses string into ZLib.