summaryrefslogtreecommitdiffhomepage
path: root/loader
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-11-27 21:39:41 +0100
committerStanislaw Halik <sthalik@misaki.pl>2022-11-27 21:39:41 +0100
commitefecf0ab20304b5d76b3072a66b36b50d8522082 (patch)
tree5afa6fb96ee863864c52c1a52ede96649c71278a /loader
parentbeb6685f605b89ce4b2dd99f87b9319e4f7f4d94 (diff)
scenery wip
Diffstat (limited to 'loader')
-rw-r--r--loader/json.cpp17
-rw-r--r--loader/loader.hpp4
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;