diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2022-06-08 21:17:51 +0200 |
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-06-08 21:17:51 +0200 |
| commit | 9fa9dda6052d584326a68ed69fa8e8619f13b99b (patch) | |
| tree | ca044644e30d6b9d355f22ecf570020e44b938cf /crop-tool/serialize.hpp | |
| parent | 66968b083c8e2ee12819735f9aa9583192dc8091 (diff) | |
update
Diffstat (limited to 'crop-tool/serialize.hpp')
| -rw-r--r-- | crop-tool/serialize.hpp | 40 |
1 files changed, 40 insertions, 0 deletions
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 <string> +#include <array> +#include <vector> +#include <optional> +#include <filesystem> +#include <Magnum/Trade/ImageData.h> + +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<anim_frame> frames; + + Magnum::Vector2i ground = {}; +}; + +struct anim +{ + std::string name; + std::array<anim_direction_group, (unsigned)anim_direction::MAX> directions; + int nframes = 0, actionframe = 0, fps = default_fps; + + static std::optional<anim> from_json(const std::filesystem::path& pathname); + + static constexpr int default_fps = 24; +}; |
