summaryrefslogtreecommitdiffhomepage
path: root/src/tile-image.hpp
blob: 06d0cb411a6e301972fc7bb7ffc1ec93fe57fc48 (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
#pragma once
#include "compat/integer-types.hpp"
#include <compare>
#include <memory>

namespace floormat {

struct tile_atlas;

struct tile_image final
{
    std::shared_ptr<tile_atlas> atlas;
    std::uint16_t variant = (std::uint16_t)-1;

    explicit operator bool() const noexcept { return !!atlas; }

    std::strong_ordering operator<=>(const tile_image& o) const noexcept
    {
        const auto ret = atlas.get() <=> o.atlas.get();
        return ret != std::strong_ordering::equal ? ret : variant <=> o.variant;
    }
};

} // namespace floormat