blob: 1e69a0c0f947a5f223c15413d6b12b73612762a0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#include "impl.hpp"
#include "ground-cell.hpp"
#include "loader/wall-cell.hpp"
#include "anim-cell.hpp"
#include "scenery-cell.hpp"
namespace floormat {
using loader_detail::loader_impl;
loader_& loader_::default_loader() noexcept
{
static loader_impl loader_singleton{};
return loader_singleton;
}
loader_& loader = loader_::default_loader(); // NOLINT(*-avoid-non-const-global-variables)
loader_::loader_() = default;
loader_::~loader_() noexcept = default;
StringView loader_::strip_prefix(StringView name)
{
if (name.hasPrefix(ANIM_PATH))
return name.exceptPrefix(ANIM_PATH.size());
if (name.hasPrefix(SCENERY_PATH))
return name.exceptPrefix(SCENERY_PATH.size());
if (name.hasPrefix(VOBJ_PATH))
return name.exceptPrefix(VOBJ_PATH.size());
if (name.hasPrefix(GROUND_TILESET_PATH))
return name.exceptPrefix(GROUND_TILESET_PATH.size());
if (name.hasPrefix(WALL_TILESET_PATH))
return name.exceptPrefix(WALL_TILESET_PATH.size());
return name;
}
const StringView loader_::ANIM_PATH = "anim/"_s;
const StringView loader_::SCENERY_PATH = "scenery/"_s;
const StringView loader_::TEMP_PATH = "../../../"_s;
const StringView loader_::VOBJ_PATH = "vobj/"_s;
const StringView loader_::GROUND_TILESET_PATH = "ground/"_s;
const StringView loader_::WALL_TILESET_PATH = "walls/"_s;
} // namespace floormat
|