summaryrefslogtreecommitdiffhomepage
path: root/src/tile-image.cpp
blob: b10effe4c392a5746c8e8e34d812528ff5e61959 (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
#include "tile-image.hpp"

namespace floormat {

bool operator==(const tile_image_proto& a, const tile_image_proto& b) noexcept
{
    return a.atlas == b.atlas && a.variant == b.variant;
}

tile_image_proto::operator bool() const noexcept { return atlas != nullptr; }

tile_image_ref::tile_image_ref(std::shared_ptr<tile_atlas>& atlas, variant_t& variant) noexcept :
    atlas{atlas}, variant{variant}
{
}

tile_image_ref& tile_image_ref::operator=(const tile_image_proto& proto) noexcept
{
    atlas = proto.atlas;
    variant = proto.variant;
    return *this;
}

tile_image_ref::tile_image_ref(const tile_image_ref&) noexcept = default;

tile_image_ref::operator tile_image_proto() const noexcept
{
    return { atlas, variant };
}

tile_image_ref::operator bool() const noexcept { return atlas != nullptr; }

} // namespace floormat