#pragma once #include "SH_API.h" #include #include #include namespace YAML { class Emitter; class Node; } namespace SHADE { class SHSceneNode; constexpr const char* ComponentsNode = "Components"; constexpr const char* EntityNameNode = "Name"; constexpr const char* EIDNode = "EID"; constexpr const char* IsActiveNode = "IsActive"; constexpr const char* NumberOfChildrenNode = "NumberOfChildren"; constexpr const char* ScriptsNode = "Scripts"; struct SH_API SHSerialization { //TODO: change paths to resource ID static void SerializeSceneToFile(std::filesystem::path const& path); static std::string SerializeSceneToString(); static void SerializeSceneToEmitter(YAML::Emitter& out); static void DeserializeSceneFromFile(std::filesystem::path const& path); static void EmitEntity(SHSceneNode* entityNode, YAML::Emitter& out); static std::string SerializeEntitiesToString(std::vector const& entities) noexcept; static void SerializeEntityToFile(std::filesystem::path const& path); static YAML::Node SerializeEntityToNode(SHSceneNode* sceneNode); static EntityID DeserializeEntitiesFromString(std::string const& data, EntityID const& parentEID = MAX_EID) noexcept; static std::vector GetComponentIDList(YAML::Node const& componentsNode); private: static void InitializeEntity(YAML::Node const& entityNode, EntityID const& eid); }; }