summaryrefslogtreecommitdiffhomepage
path: root/editor/wall-editor.hpp
blob: 063729c73007e4ff425e4c0a0284c28914639c26 (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
#pragma once
#include "editor-enums.hpp"
#include "src/rotation.hpp"
#include "src/global-coords.hpp"
#include "loader/wall-cell.hpp"
#include <map>

namespace floormat {

class world;
class wall_atlas;

class wall_editor
{
    std::map<StringView, wall_cell> _atlases;
    bptr<wall_atlas> _selected_atlas;
    enum rotation _r = rotation::N;

    void load_atlases();

public:
    auto cbegin() const noexcept { return _atlases.cbegin(); }
    auto cend() const noexcept { return _atlases.cend(); }
    auto begin() const noexcept { return _atlases.cbegin(); }
    auto end() const noexcept { return _atlases.cend(); }

    wall_editor();
    StringView name() const;

    enum rotation rotation() const;
    void set_rotation(enum rotation r);
    void toggle_rotation();

    bptr<wall_atlas> get_selected() const;
    void select_atlas(const bptr<wall_atlas>& atlas);
    void clear_selection();
    bool is_atlas_selected(const bptr<wall_atlas>& atlas) const;
    bool is_anything_selected() const;

    void place_tile(world& w, global_coords coords, const bptr<wall_atlas>& atlas);
    editor_snap_mode check_snap(int mods) const;
};

} // namespace floormat