00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 #ifndef HEADER_SUPERTUX_OBJECT_ANCHOR_POINT_HPP
00018 #define HEADER_SUPERTUX_OBJECT_ANCHOR_POINT_HPP
00019 
00020 #include <string>
00021 
00022 #include "math/vector.hpp"
00023 
00024 class Rectf;
00025 
00026 enum AnchorPoint {
00027   ANCHOR_H_MASK = 0x00f0,
00028   ANCHOR_TOP    = 0x0010,
00029   ANCHOR_BOTTOM = 0x0020,
00030   ANCHOR_V_MASK = 0x000f,
00031   ANCHOR_LEFT   = 0x0001,
00032   ANCHOR_RIGHT  = 0x0002,
00033   ANCHOR_MIDDLE = 0x0000,
00034 
00035   ANCHOR_TOP_LEFT = ANCHOR_TOP | ANCHOR_LEFT,
00036   ANCHOR_TOP_RIGHT = ANCHOR_TOP | ANCHOR_RIGHT,
00037   ANCHOR_BOTTOM_LEFT = ANCHOR_BOTTOM | ANCHOR_LEFT,
00038   ANCHOR_BOTTOM_RIGHT = ANCHOR_BOTTOM | ANCHOR_RIGHT
00039 };
00040 
00041 std::string anchor_point_to_string(AnchorPoint point);
00042 AnchorPoint string_to_anchor_point(const std::string& str);
00043 Vector get_anchor_pos(const Rectf& rect, AnchorPoint point);
00044 Vector get_anchor_pos(const Rectf& destrect, float width, float height,
00045                       AnchorPoint point);
00046 
00047 #endif
00048 
00049