#include "serialize/magnum-vector.hpp" #include "serialize/magnum-vector2i.hpp" #include "serialize/corrade-string.hpp" #include "serialize/anim.hpp" namespace floormat { NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(anim_frame, ground, offset, size) NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(anim_group, name, frames, ground, offset) NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(anim_def, object_name, anim_name, pixel_size, nframes, actionframe, fps, groups, width, height) } // namespace floormat::Serialize using namespace floormat; namespace nlohmann { void adl_serializer::to_json(json& j, const anim_frame& val) { using nlohmann::to_json; to_json(j, val); } void adl_serializer::from_json(const json& j, anim_frame& val) { using nlohmann::from_json; from_json(j, val); } void adl_serializer::to_json(json& j, const anim_group& val) { using nlohmann::to_json; if (!val.mirror_from.isEmpty()) { j["name"] = val.name; j["mirror-from"] = val.mirror_from; j["offset"] = val.offset; } else to_json(j, val); } void adl_serializer::from_json(const json& j, anim_group& val) { using nlohmann::from_json; if (j.contains("mirror-from")) { val.name = j["name"]; val.mirror_from = j["mirror-from"]; val.offset = j["offset"]; } else from_json(j, val); } void adl_serializer::to_json(json& j, const anim_def& val) { using nlohmann::to_json; to_json(j, val); } void adl_serializer::from_json(const json& j, anim_def& val) { using nlohmann::from_json; from_json(j, val); } } // namespace nlohmann