PixelBullet  0.0.1
A C++ game engine
Loading...
Searching...
No Matches
checkpoint_component.h
1#pragma once
2
3#include "pixelbullet/serialization/node.h"
4
5namespace pixelbullet
6{
8{
9 bool enabled = true;
10 bool primary = false;
11
12 [[nodiscard]] bool operator==(const CheckpointComponent&) const noexcept = default;
13};
14
15inline Node& operator<<(Node& node, const CheckpointComponent& component)
16{
17 node["enabled"] << component.enabled;
18 node["primary"] << component.primary;
19 return node;
20}
21
22inline const Node& operator>>(const Node& node, CheckpointComponent& component)
23{
24 if (node.HasProperty("enabled"))
25 {
26 node["enabled"] >> component.enabled;
27 }
28 else
29 {
30 component.enabled = true;
31 }
32
33 if (node.HasProperty("primary"))
34 {
35 node["primary"] >> component.primary;
36 }
37 else
38 {
39 component.primary = false;
40 }
41
42 return node;
43}
44} // namespace pixelbullet
Represents a hierarchical node capable of storing various data types and supporting YAML serializatio...
Definition node.h:45
Definition checkpoint_component.h:8