From 17ead36d2fbe07f443c732b35d0bab4ce9144c92 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Fri, 22 Jan 2021 22:40:59 -0600 Subject: [PATCH] [nostalgia/scene] Add models for Doc types --- src/nostalgia/scene/scene.hpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/nostalgia/scene/scene.hpp b/src/nostalgia/scene/scene.hpp index 3b7c6469..ecf33de2 100644 --- a/src/nostalgia/scene/scene.hpp +++ b/src/nostalgia/scene/scene.hpp @@ -8,6 +8,7 @@ #pragma once +#include #include #include @@ -25,6 +26,14 @@ struct TileDoc { }; +template +constexpr ox::Error model(T *io, TileDoc *obj) { + io->template setTypeInfo(); + oxReturnError(io->field("sheetIdx", &obj->sheetIdx)); + oxReturnError(io->field("type", &obj->type)); + return OxError(0); +} + struct SceneDoc { using TileMapRow = ox::Vector; @@ -40,6 +49,13 @@ struct SceneDoc { }; +template +constexpr ox::Error model(T *io, SceneDoc *obj) { + io->template setTypeInfo(); + oxReturnError(io->field("tiles", &obj->tiles)); + return OxError(0); +} + struct SceneInstance { uint16_t layers = 0;