diff options
Diffstat (limited to 'src/components/Render.hpp')
-rw-r--r-- | src/components/Render.hpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/components/Render.hpp b/src/components/Render.hpp index 3f1750f..49a9588 100644 --- a/src/components/Render.hpp +++ b/src/components/Render.hpp @@ -21,7 +21,7 @@ #include "Component.hpp" #include "texture.hpp" -struct Render : Component<Render>, entityx::Component<Render> +struct Render : Component<Render> { public: Texture texture; @@ -41,9 +41,9 @@ public: if (tab["visible"].get_type() == sol::type::boolean) this->visible = tab["visible"]; if (tab["texture"].get_type() == sol::type::string) - this->texture = Texture(static_cast<std::string>(tab["texture"])); + this->texture = Texture(tab.get<std::string>("texture")); if (tab["normal"].get_type() == sol::type::string) - this->normal = Texture(static_cast<std::string>(tab["normal"])); + this->normal = Texture(tab.get<std::string>("normal")); if (tab["flipx"].get_type() == sol::type::boolean) this->flipX = tab["flipx"]; } else { @@ -53,6 +53,14 @@ public: } return *this; } + + void serialize(cereal::JSONOutputArchive& ar) final { + ar(visible, flipX); + } + + void serialize(cereal::JSONInputArchive& ar) final { + ar(visible, flipX); + } }; #endif // COMPONENT_RENDER_HPP_ |