blob: 3e95c8ebcbd83f410457446ea7926ea1f4c68913 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#pragma once
#include <Magnum/Magnum.h>
#include <Magnum/Math/Vector.h>
#include <nlohmann/json.hpp>
namespace nlohmann {
template<std::size_t N, typename T>
struct adl_serializer<Magnum::Math::Vector<N, T>> final {
static void to_json(json& j, const Magnum::Math::Vector2<T>& val)
{
std::array<T, N> array{};
for (std::size_t i; i < std::size(val); i++)
array[i] = val[i];
j = array;
}
static void from_json(const json& j, Magnum::Math::Vector2<T>& val)
{
std::array<T, N> array = j;
for (std::size_t i; i < std::size(val); i++)
val[i] = array[i];
}
};
} // namespace nlohmann
|