summaryrefslogtreecommitdiffhomepage
path: root/editor/scenery-editor.cpp
blob: c3b29c9ddb933e0c06d8ef6d741952b7e29ba3d4 (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
#include "scenery-editor.hpp"
#include "src/anim-atlas.hpp"

namespace floormat {

using rotation_ = enum rotation;
using rotation_t = std::underlying_type_t<rotation_>;

scenery_editor::scenery_editor() noexcept
{
}

void scenery_editor::set_rotation(enum rotation r)
{
    _selected.s.r = r;
}

rotation scenery_editor::rotation() const
{
    return _selected.s.r;
}

void scenery_editor::next_rotation()
{
    auto r_1 = (rotation_t)_selected.s.r + 1;
    auto rot = (rotation_)r_1;
    if (rot >= rotation_::COUNT)
        rot = (rotation_)0;
    _selected.s.r = rot;
}

void scenery_editor::prev_rotation()
{
    if (_selected.s.r == (rotation_)0)
        _selected.s.r = (rotation_)((rotation_t)rotation_::COUNT - 1);
    else
        _selected.s.r = (rotation_)((rotation_t)_selected.s.r - 1);
}

} // namespace floormat