-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
73 lines (50 loc) · 1.06 KB
/
Copy pathmain.cpp
File metadata and controls
73 lines (50 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include "scene_graph.h"
#include <iostream>
#include <fstream>
#ifdef USE_CEREAL
#include <cereal\cereal.hpp>
#include <cereal\archives\json.hpp>
#endif
#ifdef USE_CEREAL
//
// Test Cereal 1 color
//
template<class Archive>
void serialize(Archive &ar, Color &c)
{
ar(cereal::make_nvp("r", c.r),
cereal::make_nvp("g", c.g),
cereal::make_nvp("b", c.b));
}
void test1_cereal()
{
std::ofstream os("test1.json");
cereal::JSONOutputArchive ar(os);
Color color;
ar(cereal::make_nvp("color", color));
}
//
// Test 2 World
//
std::unique_ptr<World> CreateTestWorld()
{
std::unique_ptr<World> world = std::unique_ptr<World>(new World("teszt_vilag"));
world->m_actors.insert(std::make_shared<Actor>("actor1"));
world->m_actors.insert(std::make_shared<Actor>("actor2"));
return world;
}
void test2_cereal()
{
std::ofstream os("test2.json");
cereal::JSONOutputArchive ar(os);
auto world = CreateTestWorld();
ar(cereal::make_nvp("world", *world));
}
#endif
int main(int /*argc*/, char** /*argv*/)
{
#ifdef USE_CEREAL
test1_cereal();
test2_cereal();
#endif
}