summaryrefslogtreecommitdiffhomepage
path: root/serialize/anim.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'serialize/anim.hpp')
-rw-r--r--serialize/anim.hpp56
1 files changed, 10 insertions, 46 deletions
diff --git a/serialize/anim.hpp b/serialize/anim.hpp
index 9d6db66c..48d97451 100644
--- a/serialize/anim.hpp
+++ b/serialize/anim.hpp
@@ -1,62 +1,26 @@
#pragma once
-#include <vector>
-#include <Corrade/Containers/String.h>
-#include <Magnum/Magnum.h>
-#include <Magnum/Math/Vector2.h>
+#include "src/anim.hpp"
#include <nlohmann/json_fwd.hpp>
-namespace floormat::Serialize {
-
-struct anim_frame final
-{
- Vector2i ground;
- Vector2ui 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<anim_frame> frames;
- Vector2ui ground;
-};
-
-struct anim final
-{
- static constexpr int default_fps = 24;
-
- String object_name, anim_name;
- std::vector<anim_group> 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<floormat::Serialize::anim_frame> {
- static void to_json(json& j, const floormat::Serialize::anim_frame& val);
- static void from_json(const json& j, floormat::Serialize::anim_frame& val);
+struct adl_serializer<floormat::anim_frame> {
+ static void to_json(json& j, const floormat::anim_frame& val);
+ static void from_json(const json& j, floormat::anim_frame& val);
};
template<>
-struct adl_serializer<floormat::Serialize::anim_group> {
- static void to_json(json& j, const floormat::Serialize::anim_group& val);
- static void from_json(const json& j, floormat::Serialize::anim_group& val);
+struct adl_serializer<floormat::anim_group> {
+ static void to_json(json& j, const floormat::anim_group& val);
+ static void from_json(const json& j, floormat::anim_group& val);
};
template<>
-struct adl_serializer<floormat::Serialize::anim> {
- static void to_json(json& j, const floormat::Serialize::anim& val);
- static void from_json(const json& j, floormat::Serialize::anim& val);
+struct adl_serializer<floormat::anim_def> {
+ static void to_json(json& j, const floormat::anim_def& val);
+ static void from_json(const json& j, floormat::anim_def& val);
};
} // namespace nlohmann