GigaPasjans
Loading...
Searching...
No Matches
GameSerializer.h
1// Wykonane przez Piotra ChudziƄskiego w dniu 10.04.2025
2#pragma once
3
4#include <iostream>
5#include <nlohmann/json.hpp>
6#include "IGame.h"
7
8namespace Phosphorus
9{
15 {
16 public:
21 static std::pair<String, GameObject *>
22 LoadGameObject(const nlohmann::json &obj, std::map<ParentGameObject *, std::vector<String>> &childrenMap);
23
28 static nlohmann::json SerializeGameObject(const String &name, GameObject *object);
29
34 static void Serialize(std::ostream &stream, IGame *game);
35
40 static void Load(std::istream &stream, IGame *game);
41
46 static nlohmann::json LoadFromFile(const String &filename);
47
52 static void SaveToFile(const String &filename, const nlohmann::json &json);
53 };
54} // namespace Phosphorus
Represents named set of parameters which can be serialized.
Definition GameObject.h:274
Serializer which serializes GameObjectRepository to JSON objects.
Definition GameSerializer.h:15
static nlohmann::json LoadFromFile(const String &filename)
Loads JSON object from file.
Definition GameSerializer.cpp:96
static std::pair< String, GameObject * > LoadGameObject(const nlohmann::json &obj, std::map< ParentGameObject *, std::vector< String > > &childrenMap)
Loads GameObject and children from JSON object.
Definition GameSerializer.cpp:12
static void Load(std::istream &stream, IGame *game)
Loads JSON object from stream and loads GameObject from object.
Definition GameSerializer.cpp:75
static void SaveToFile(const String &filename, const nlohmann::json &json)
Saves JSON object to file.
Definition GameSerializer.cpp:105
static nlohmann::json SerializeGameObject(const String &name, GameObject *object)
Serializes GameObject and children to JSON object.
Definition GameSerializer.cpp:42
static void Serialize(std::ostream &stream, IGame *game)
Serializes GameObject to JSON object and writes JSON string to stream.
Definition GameSerializer.cpp:112
Represents serializable GameObjectRegistry with rendering, asset manager.
Definition IGame.h:42
Represents GameObject with children.
Definition GameObject.h:449
Represents a mutable sequence of characters, providing various member functions for string manipulati...
Definition String.h:16