2 // Copyright (C) 2006 Matthias Braun <matze@braunis.de>
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #ifndef HEADER_SUPERTUX_OBJECT_ANCHOR_POINT_HPP
18 #define HEADER_SUPERTUX_OBJECT_ANCHOR_POINT_HPP
22 #include "math/vector.hpp"
27 ANCHOR_H_MASK = 0x00f0,
29 ANCHOR_BOTTOM = 0x0020,
30 ANCHOR_V_MASK = 0x000f,
32 ANCHOR_RIGHT = 0x0002,
33 ANCHOR_MIDDLE = 0x0000,
35 ANCHOR_TOP_LEFT = ANCHOR_TOP | ANCHOR_LEFT,
36 ANCHOR_TOP_RIGHT = ANCHOR_TOP | ANCHOR_RIGHT,
37 ANCHOR_BOTTOM_LEFT = ANCHOR_BOTTOM | ANCHOR_LEFT,
38 ANCHOR_BOTTOM_RIGHT = ANCHOR_BOTTOM | ANCHOR_RIGHT
41 std::string anchor_point_to_string(AnchorPoint point);
42 AnchorPoint string_to_anchor_point(const std::string& str);
43 Vector get_anchor_pos(const Rectf& rect, AnchorPoint point);
44 Vector get_anchor_pos(const Rectf& destrect, float width, float height,