From 9fa9dda6052d584326a68ed69fa8e8619f13b99b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 8 Jun 2022 21:17:51 +0200 Subject: update --- crop-tool/serialize.hpp | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 crop-tool/serialize.hpp (limited to 'crop-tool/serialize.hpp') diff --git a/crop-tool/serialize.hpp b/crop-tool/serialize.hpp new file mode 100644 index 00000000..e93cf6f4 --- /dev/null +++ b/crop-tool/serialize.hpp @@ -0,0 +1,40 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +struct anim_frame +{ + Magnum::Vector2i ground = {}; +}; + +enum class anim_direction : unsigned char +{ + Invalid, + N, NE, E, SE, S, SW, W, NW, + MIN = N, MAX = NW, +}; + +struct anim_direction_group +{ + static const char* anim_direction_string(anim_direction group); + anim_direction group; + std::vector frames; + + Magnum::Vector2i ground = {}; +}; + +struct anim +{ + std::string name; + std::array directions; + int nframes = 0, actionframe = 0, fps = default_fps; + + static std::optional from_json(const std::filesystem::path& pathname); + + static constexpr int default_fps = 24; +}; -- cgit v1.2.3