summaryrefslogtreecommitdiffhomepage
path: root/src/hole.hpp
blob: b7499ced9f82ed08c9dbf70c65798dd5911f1daf (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
#pragma once
#include "object.hpp"
#include <array>

namespace floormat {

struct hole_proto final : object_proto
{
    bool affects_render  : 1 = true;
    bool affects_physics : 1 = false;
};

struct hole : object
{
    bool affects_render  : 1 = true;
    bool affects_physics : 1 = false;

    hole(object_id id, class chunk& c, const hole_proto& proto);
};

struct cut_rectangle_result
{
    struct bbox { Vector2i position; Vector2ub bbox_size; };
    struct rect { Vector2i min, max; };

    uint8_t size = 0;
    std::array<rect, 8> array;

    operator ArrayView<const bbox>() const;
};

cut_rectangle_result cut_rectangle(cut_rectangle_result::bbox input, cut_rectangle_result::bbox hole);

} // namespace floormat