summaryrefslogtreecommitdiffhomepage
path: root/serialize/anim.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'serialize/anim.cpp')
-rw-r--r--serialize/anim.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/serialize/anim.cpp b/serialize/anim.cpp
new file mode 100644
index 00000000..c65c24a6
--- /dev/null
+++ b/serialize/anim.cpp
@@ -0,0 +1,36 @@
+#include "serialize/vector.hpp"
+#include "serialize/helper.hpp"
+#include "serialize/anim.hpp"
+
+#include <tuple>
+#include <filesystem>
+#include <Corrade/Utility/Debug.h>
+#include <Corrade/Utility/DebugStl.h>
+
+namespace Magnum::Examples::Serialize {
+
+#if defined __clang__ || defined __CLION_IDE__
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wweak-vtables"
+# pragma clang diagnostic ignored "-Wcovered-switch-default"
+#endif
+
+NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(anim_frame, ground, offset, size)
+NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(anim_group, name, frames, ground)
+NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(anim, name, nframes, actionframe, fps, groups, width, height)
+
+#if defined __clang__ || defined __CLION_IDE__
+# pragma clang diagnostic pop
+#endif
+
+std::tuple<anim, bool> anim::from_json(const std::filesystem::path& pathname) noexcept
+{
+ return json_helper<anim>::from_json(pathname);
+}
+
+bool anim::to_json(const std::filesystem::path& pathname) const noexcept
+{
+ return json_helper<anim>::to_json(*this, pathname);
+}
+
+} // namespace Magnum::Examples::Serialize