diff options
Diffstat (limited to 'loader/atlas.cpp')
-rw-r--r-- | loader/atlas.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/loader/atlas.cpp b/loader/atlas.cpp index f285d3b1..1354e922 100644 --- a/loader/atlas.cpp +++ b/loader/atlas.cpp @@ -14,15 +14,25 @@ namespace floormat::loader_detail { -std::shared_ptr<tile_atlas> loader_impl::tile_atlas(StringView name, Vector2ub size) noexcept(false) +std::shared_ptr<tile_atlas> loader_impl::tile_atlas(StringView name, Vector2ub size, Optional<pass_mode> pass) noexcept(false) { fm_soft_assert(check_atlas_name(name)); - const emplacer e{[&] { return std::make_shared<struct tile_atlas>(name, texture(IMAGE_PATH, name), size); }}; + const emplacer e{[&] { return std::make_shared<struct tile_atlas>(name, texture(IMAGE_PATH, name), size, pass); }}; auto atlas = tile_atlas_map.try_emplace(name, e).first->second; + fm_soft_assert(!pass || pass == atlas->pass_mode()); return atlas; } +std::shared_ptr<struct tile_atlas> loader_impl::tile_atlas(StringView filename) noexcept(false) +{ + fm_assert(!tile_atlas_map.empty()); + auto it = tile_atlas_map.find(filename); + if (it == tile_atlas_map.end()) + fm_throw("no such tile atlas '{}'"_cf, filename.data()); + return it->second; +} + ArrayView<String> loader_impl::anim_atlas_list() { if (anim_atlases.empty()) |