diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-07 11:00:05 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-07 11:00:05 +0200 |
commit | 49d18e6b8a95f6ae4755cacd958248ffbdbf59ff (patch) | |
tree | 910f1c47b71bbd14595750185bffac15a4fdfe48 /serialize/anim.cpp | |
parent | 7740c71ecedd90f9b465dc35994e64915dbda826 (diff) |
a
Diffstat (limited to 'serialize/anim.cpp')
-rw-r--r-- | serialize/anim.cpp | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/serialize/anim.cpp b/serialize/anim.cpp index dffe2449..42ad1de2 100644 --- a/serialize/anim.cpp +++ b/serialize/anim.cpp @@ -1,5 +1,4 @@ #include "serialize/magnum-vector2i.hpp" -#include "serialize/json-helper.hpp" #include "serialize/anim.hpp" #include <tuple> @@ -9,28 +8,23 @@ namespace Magnum::Examples::Serialize { -#if defined __clang__ || defined __CLION_IDE__ -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wweak-vtables" -# pragma clang diagnostic ignored "-Wcovered-switch-default" -#endif - NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(anim_frame, ground, offset, size) NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(anim_group, name, frames, ground) NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(anim, name, nframes, actionframe, fps, groups, width, height) -#if defined __clang__ || defined __CLION_IDE__ -# pragma clang diagnostic pop -#endif +} // namespace Magnum::Examples::Serialize -std::tuple<anim, bool> anim::from_json(const std::filesystem::path& pathname) -{ - return json_helper::from_json<anim>(pathname); -} +using namespace Magnum::Examples::Serialize; -bool anim::to_json(const std::filesystem::path& pathname) const -{ - return json_helper::to_json(*this, pathname); -} +namespace nlohmann { -} // namespace Magnum::Examples::Serialize +void adl_serializer<anim_frame>::to_json(json& j, const anim_frame& val) { using nlohmann::to_json; to_json(j, val); } +void adl_serializer<anim_frame>::from_json(const json& j, anim_frame& val) { using nlohmann::from_json; from_json(j, val); } + +void adl_serializer<anim_group>::to_json(json& j, const anim_group& val) { using nlohmann::to_json; to_json(j, val); } +void adl_serializer<anim_group>::from_json(const json& j, anim_group& val) { using nlohmann::from_json; from_json(j, val); } + +void adl_serializer<anim>::to_json(json& j, const anim& val) { using nlohmann::to_json; to_json(j, val); } +void adl_serializer<anim>::from_json(const json& j, anim& val) { using nlohmann::from_json; from_json(j, val); } + +} // namespace nlohmann |