add code to debug collision rectangles
[supertux.git] / src / object / anchor_point.hpp
1 #ifndef __ANCHOR_POINT_HPP__
2 #define __ANCHOR_POINT_HPP__
3
4 #include <string>
5 #include "math/vector.hpp"
6
7 class Rect;
8
9 enum AnchorPoint {
10   ANCHOR_H_MASK = 0x00f0,
11   ANCHOR_TOP    = 0x0010,
12   ANCHOR_BOTTOM = 0x0020,
13   ANCHOR_V_MASK = 0x000f,
14   ANCHOR_LEFT   = 0x0001,
15   ANCHOR_RIGHT  = 0x0002,
16   ANCHOR_MIDDLE = 0x0000,
17   
18   ANCHOR_TOP_LEFT = ANCHOR_TOP | ANCHOR_LEFT,
19   ANCHOR_TOP_RIGHT = ANCHOR_TOP | ANCHOR_RIGHT,
20   ANCHOR_BOTTOM_LEFT = ANCHOR_BOTTOM | ANCHOR_LEFT,
21   ANCHOR_BOTTOM_RIGHT = ANCHOR_BOTTOM | ANCHOR_RIGHT,
22 };
23
24 std::string anchor_point_to_string(AnchorPoint point);
25 AnchorPoint string_to_anchor_point(const std::string& str);
26 Vector get_anchor_pos(const Rect& rect, AnchorPoint point);
27 Vector get_anchor_pos(const Rect& destrect, float width, float height,
28                       AnchorPoint point);
29
30 #endif
31