From 6731ab0243ba437595062558e56b800d5eca9cf5 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 5 Oct 2022 15:47:29 +0200 Subject: a --- serialize/anim.hpp | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 serialize/anim.hpp (limited to 'serialize/anim.hpp') diff --git a/serialize/anim.hpp b/serialize/anim.hpp new file mode 100644 index 00000000..f03e3c8c --- /dev/null +++ b/serialize/anim.hpp @@ -0,0 +1,47 @@ +#pragma once + +#include +#include +#include +#include + +#include +#include + +namespace std::filesystem { class path; } + +namespace Magnum::Examples::Serialize { + +struct anim_frame final +{ + Magnum::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; + Magnum::Vector2i ground; +}; + +struct anim final +{ + static std::tuple from_json(const std::filesystem::path& pathname) noexcept; + [[nodiscard]] bool to_json(const std::filesystem::path& pathname) const noexcept; + static constexpr int default_fps = 24; + + std::string name; + std::array groups; + int nframes = 0; + int width = 0, height = 0; + int actionframe = -1, fps = default_fps; +}; + +} // namespace Magnum::Examples::Serialize + -- cgit v1.2.3