Grindstone Game Engine v0.2.0
An open source game engine and toolkit.
Loading...
Searching...
No Matches
SceneWriterJson.hpp
1#pragma once
2
3#include <string>
4#include <map>
5#include <entt/entt.hpp>
6
7#include "rapidjson/document.h"
8#include "rapidjson/prettywriter.h"
9
10#include <Common/HashedString.hpp>
11#include "../ECS/Entity.hpp"
12#include "../Reflection/TypeDescriptorStruct.hpp"
13
14namespace Grindstone::SceneManagement {
15 using SceneRapidjsonWriter = rapidjson::PrettyWriter<rapidjson::StringBuffer>;
16 class Scene;
17
18 class SceneWriterJson {
19 public:
20 SceneWriterJson(Scene*, const std::filesystem::path& path);
21 private:
22 void Save(const std::filesystem::path& path);
23 void ProcessMeta();
24 void ProcessEntities();
25 void ProcessEntity(entt::registry& registry, ECS::Entity entity);
26 void ProcessComponent(
27 ECS::Entity entity,
28 Grindstone::HashedString componentTypeName,
29 Grindstone::Reflection::TypeDescriptor_Struct& componentReflectionData,
30 void* outComponent
31 );
32 void SetParameter(Reflection::TypeDescriptor_Struct::Member param, void* componentPtr);
33 void ProcessComponentParameter(
34 ECS::Entity entity,
35 void* componentPtr,
37 const char* parameterKey,
38 rapidjson::Value& parameter
39 );
40 void ParseArray(void* memberPtr, Reflection::TypeDescriptor* member);
41 private:
42 Scene* scene;
43 rapidjson::StringBuffer documentStringBuffer;
44 SceneRapidjsonWriter documentWriter = SceneRapidjsonWriter(documentStringBuffer);
45 std::filesystem::path path;
46 };
47}
Definition Entity.hpp:15
Definition HashedString.hpp:9
Definition Scene.hpp:21
Definition TypeDescriptorStruct.hpp:10
Definition TypeDescriptorStruct.hpp:9
Definition TypeDescriptor.hpp:6