summaryrefslogtreecommitdiffhomepage
path: root/src/tile-image.cpp
blob: 20ab4098f9cf0517aaa1585df3d53fbcd6ccbb72 (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
45
#include "tile-image.hpp"
#include "compat/borrowed-ptr.inl"

namespace floormat {

template<typename Atlas> bool image_proto_<Atlas>::operator==(const image_proto_<Atlas>& b) const noexcept = default;
template<typename Atlas> image_proto_<Atlas>::operator bool() const noexcept { return atlas != nullptr; }

template<typename Atlas, typename Proto>
image_ref_<Atlas, Proto>::operator bool() const noexcept
{
    return atlas != nullptr;
}

template<typename Atlas, typename Proto>
image_ref_<Atlas, Proto>::image_ref_(const image_ref_<Atlas, Proto>& o) noexcept
    : atlas{o.atlas}, variant{o.variant}
{}

template<typename Atlas, typename Proto>
image_ref_<Atlas, Proto>::image_ref_(bptr<Atlas>& atlas, variant_t& variant) noexcept
    : atlas{atlas}, variant{variant}
{}

template<typename Atlas, typename Proto>
image_ref_<Atlas, Proto>::operator Proto() const noexcept
{
    return { atlas, variant };
}

template<typename Atlas, typename Proto>
image_ref_<Atlas, Proto>& image_ref_<Atlas, Proto>::operator=(const Proto& proto) noexcept
{
    atlas = proto.atlas;
    variant = proto.variant;
    return *this;
}

template struct image_proto_<ground_atlas>;
template struct image_ref_<ground_atlas, tile_image_proto>;

template struct image_proto_<wall_atlas>;
template struct image_ref_<wall_atlas, wall_image_proto>;

} // namespace floormat