diff options
author | clyne <clyne@bitgloo.com> | 2019-09-03 18:17:51 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-03 18:17:51 -0400 |
commit | ec1d57aeadbd0f34616eeec8f1a922ca61b90085 (patch) | |
tree | 9d2233f2437b8e85d151f9610b1a147310b9c13e /src/components/Velocity.hpp | |
parent | 0b3d24c4295bb89eb4ce3f91163cabd64d0ca6e2 (diff) | |
parent | 95cc88ad5f6c2abb4890d00a57ae4ad0db030e9b (diff) |
Merge pull request #1 from tcsullivan/save-load
Save load looks good
Diffstat (limited to 'src/components/Velocity.hpp')
-rw-r--r-- | src/components/Velocity.hpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/components/Velocity.hpp b/src/components/Velocity.hpp index 29c0e5c..776c1dd 100644 --- a/src/components/Velocity.hpp +++ b/src/components/Velocity.hpp @@ -22,7 +22,7 @@ #include "Component.hpp" -struct Velocity : Component<Velocity>, entityx::Component<Velocity> +struct Velocity : Component<Velocity> { public: double x, y; @@ -43,6 +43,18 @@ public: } return *this; } + + void serialize(cereal::JSONOutputArchive& ar) final { + ar(CEREAL_NVP(x), CEREAL_NVP(y)); + } + + void serialize(cereal::JSONInputArchive& ar) final { + ar(CEREAL_NVP(x), CEREAL_NVP(y)); + } + + std::string serializeName(void) const final { + return "Velocity"; + } }; #endif // COMPONENT_VELOCITY_HPP_ |