7#include <djson/json.hpp>
10template <
typename Type>
22inline constexpr auto json_type_name_v<anim::Timeline<Transform>> = std::string_view{
"anim::Timeline<Transform>"};
24inline constexpr auto json_type_name_v<anim::Timeline<TileId>> = std::string_view{
"anim::Timeline<TileId>"};
26inline constexpr auto json_type_name_v<anim::Animation<Transform>> = std::string_view{
"anim::Animation<Transform>"};
28inline constexpr auto json_type_name_v<anim::Animation<TileId>> = std::string_view{
"anim::Animation<TileId>"};
34template <
typename Type>
39template <
typename Type>
44template <
typename Type>
49template <
typename Type>
54template <
typename Type, glm::length_t Length>
55void from_json(dj::Json
const& json, glm::vec<Length, Type>& vec) {
56 if (!json.is_array()) {
return; }
58 if constexpr (Length > 1) {
from_json(json[1], vec.y); }
59 if constexpr (Length > 2) {
from_json(json[2], vec.z); }
62template <
typename Type, glm::length_t Length>
63void to_json(dj::Json& json, glm::vec<Length, Type>
const& vec) {
65 if constexpr (Length > 1) {
to_json(json[1], vec.y); }
66 if constexpr (Length > 2) {
to_json(json[2], vec.z); }
69template <
typename Type>
70void from_json(dj::Json
const& json, kvf::Rect<Type>& rect) {
75template <
typename Type>
76void to_json(dj::Json& json, kvf::Rect<Type>
const& rect) {
84void from_json(dj::Json
const& json, kvf::Seconds& seconds);
85void to_json(dj::Json& json, kvf::Seconds
const& seconds);
Sorted set of Tiles.
Definition tile_set.hpp:9
Class template for Animation types.
Definition animation.hpp:12
Definition animation.hpp:8
void set_json_type(dj::Json &json, Type const &)
Definition json_io.hpp:45
auto json_type_name_match(dj::Json const &json, std::string_view type_name) -> bool
constexpr auto json_type_name_v
Definition json_io.hpp:11
constexpr auto json_type_name_v< ITileSheet >
Definition json_io.hpp:20
void from_json(dj::Json const &json, glm::vec< Length, Type > &vec)
Definition json_io.hpp:55
void set_json_type_name(dj::Json &json, std::string_view type_name)
auto get_json_type_name(dj::Json const &json) -> std::string_view
auto is_json_type(dj::Json const &json, Type const &) -> bool
Definition json_io.hpp:35
constexpr auto json_type_name_v< IShader >
Definition json_io.hpp:14
void to_json(dj::Json &json, glm::vec< Length, Type > const &vec)
Definition json_io.hpp:63
constexpr auto json_type_name_v< TileSet >
Definition json_io.hpp:16
TileId
Unique identifier for a Tile.
Definition tile_id.hpp:6
constexpr auto json_type_name_v< ITexture >
Definition json_io.hpp:18
Tile in a sprite sheet.
Definition tile.hpp:7
Class template for an animation keyframe.
Definition keyframe.hpp:7
Class template for a list of animation keyframes.
Definition timeline.hpp:8