#include "src/tile-atlas.hpp" #include "serialize/tile-atlas.hpp" #include "serialize/magnum-vector2i.hpp" #include "loader.hpp" #include #include using namespace Magnum; using namespace Magnum::Examples; namespace nlohmann { using proxy_atlas = std::tuple; using shared_atlas = std::shared_ptr; void adl_serializer::to_json(json& j, const shared_atlas& x) { if (!x) j = nullptr; else { using nlohmann::to_json; to_json(j, proxy_atlas{x->name(), x->num_tiles()}); } } void adl_serializer::from_json(const json& j, shared_atlas& x) { proxy_atlas proxy = j; const auto& [name, num_tiles] = proxy; x = loader.tile_atlas(name, num_tiles); } } // namespace nlohmann