PixelBullet  0.0.1
A C++ game engine
Loading...
Searching...
No Matches
animation_state_component.h
1#pragma once
2
3#include "pixelbullet/serialization/node.h"
4
5#include <string>
6
7namespace pixelbullet
8{
10{
11 bool enabled = true;
12 std::string active_clip;
13};
14
15inline bool operator==(const AnimationStateComponent& lhs, const AnimationStateComponent& rhs)
16{
17 return lhs.enabled == rhs.enabled && lhs.active_clip == rhs.active_clip;
18}
19
20inline bool operator!=(const AnimationStateComponent& lhs, const AnimationStateComponent& rhs)
21{
22 return !(lhs == rhs);
23}
24
25inline Node& operator<<(Node& node, const AnimationStateComponent& component)
26{
27 node["enabled"] << component.enabled;
28 node["activeClip"] << component.active_clip;
29 return node;
30}
31
32inline const Node& operator>>(const Node& node, AnimationStateComponent& component)
33{
34 if (node.HasProperty("enabled"))
35 {
36 node["enabled"] >> component.enabled;
37 }
38 else
39 {
40 component.enabled = true;
41 }
42
43 if (node.HasProperty("activeClip"))
44 {
45 node["activeClip"] >> component.active_clip;
46 }
47 else
48 {
49 component.active_clip.clear();
50 }
51
52 return node;
53}
54} // namespace pixelbullet
Represents a hierarchical node capable of storing various data types and supporting YAML serializatio...
Definition node.h:45
Definition animation_state_component.h:10