#pragma once #include #include #include #include #include namespace floormat::Serialize { struct anim_frame final { Vector2ui ground, offset, size; }; enum class anim_direction : unsigned char { N, NE, E, SE, S, SW, W, NW, COUNT, }; struct anim_group final { String name; std::vector frames; Vector2ui ground; }; struct anim final { static constexpr int default_fps = 24; String object_name, anim_name; std::vector groups; Vector2ui pixel_size; std::size_t nframes = 0, width = 0, height = 0, fps = default_fps, actionframe = 0; }; } // 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