summaryrefslogtreecommitdiffhomepage
path: root/src/scenery.hpp
blob: 04c54c22c7f7c0e9ebc8fae18d3f14a80ee95725 (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
#pragma once
#include "compat/integer-types.hpp"
#include <memory>

namespace floormat {

enum class rotation : std::uint16_t {
    N, NE, E, SE, S, SW, W, NW,
    COUNT,
};

struct scenery final
{
    static constexpr auto NO_FRAME = (1 << 12) - 1;

    using frame_t = std::uint16_t;

    frame_t frame : 12 = NO_FRAME;
    rotation r    : 4  = rotation::N;

    constexpr operator bool() const noexcept;
};

static_assert(sizeof(scenery) == sizeof(std::uint16_t));

constexpr scenery::operator bool() const noexcept
{
    return frame == NO_FRAME;
}

} // namespace floormat