diff options
Diffstat (limited to 'loader')
| -rw-r--r-- | loader/json.cpp | 17 | ||||
| -rw-r--r-- | loader/loader.hpp | 4 |
2 files changed, 21 insertions, 0 deletions
diff --git a/loader/json.cpp b/loader/json.cpp index 1a30a66b..7ee661f7 100644 --- a/loader/json.cpp +++ b/loader/json.cpp @@ -1,6 +1,9 @@ #include "impl.hpp" #include "serialize/json-helper.hpp" #include "serialize/anim.hpp" +#include "serialize/tile-atlas.hpp" +#include "serialize/scenery.hpp" +#include <Corrade/Utility/Path.h> namespace floormat::loader_detail { @@ -10,3 +13,17 @@ anim_def loader_impl::deserialize_anim(StringView filename) } } // namespace floormat::loader_detail + +namespace floormat { + +std::vector<std::shared_ptr<struct tile_atlas>> loader_::tile_atlases(StringView filename) +{ + return json_helper::from_json<std::vector<std::shared_ptr<struct tile_atlas>>>(Path::join(loader_::IMAGE_PATH, filename)); +} + +std::vector<Serialize::serialized_scenery> loader_::sceneries() +{ + return json_helper::from_json<std::vector<Serialize::serialized_scenery>>(Path::join(ANIM_PATH, "scenery.json")); +} + +} // namespace floormat diff --git a/loader/loader.hpp b/loader/loader.hpp index e3f306ea..1c15ac43 100644 --- a/loader/loader.hpp +++ b/loader/loader.hpp @@ -2,11 +2,13 @@ #include <memory> namespace Magnum { using Vector2ub = Math::Vector2<unsigned char>; } +namespace floormat::Serialize { struct serialized_scenery; } namespace floormat { struct tile_atlas; struct anim_atlas; +struct scenery_proto; struct loader_ { @@ -16,6 +18,8 @@ struct loader_ virtual std::shared_ptr<struct anim_atlas> anim_atlas(StringView name) = 0; static void destroy(); static loader_& default_loader() noexcept; + static std::vector<std::shared_ptr<struct tile_atlas>> tile_atlases(StringView filename); + static std::vector<Serialize::serialized_scenery> sceneries(); loader_(const loader_&) = delete; loader_& operator=(const loader_&) = delete; |
