#pragma once #include #include #include #include #include #include #include namespace std::filesystem { class path; } namespace floormat::Serialize { struct anim_frame final { Vector2i ground, offset, size; }; enum class anim_direction : unsigned char { N, NE, E, SE, S, SW, W, NW, COUNT, }; struct anim_group final { std::string name; std::vector frames; Vector2i ground; }; struct anim final { static constexpr int default_fps = 24; std::string object_name, anim_name; std::array groups; int nframes = 0; int width = 0, height = 0; int actionframe = -1, fps = default_fps; }; } // namespace floormat::Serialize namespace nlohmann { template<> struct adl_serializer { static void to_json(json& j, const floormat::Serialize::anim_frame& val); static void from_json(const json& j, floormat::Serialize::anim_frame& val); }; template<> struct adl_serializer { static void to_json(json& j, const floormat::Serialize::anim_group& val); static void from_json(const json& j, floormat::Serialize::anim_group& val); }; template<> struct adl_serializer { static void to_json(json& j, const floormat::Serialize::anim& val); static void from_json(const json& j, floormat::Serialize::anim& val); }; } // namespace nlohmann