src/object/anchor_point.hpp

Go to the documentation of this file.
00001 //  SuperTux
00002 //  Copyright (C) 2006 Matthias Braun <matze@braunis.de>
00003 //
00004 //  This program is free software: you can redistribute it and/or modify
00005 //  it under the terms of the GNU General Public License as published by
00006 //  the Free Software Foundation, either version 3 of the License, or
00007 //  (at your option) any later version.
00008 //
00009 //  This program is distributed in the hope that it will be useful,
00010 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 //  GNU General Public License for more details.
00013 //
00014 //  You should have received a copy of the GNU General Public License
00015 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
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 /* EOF */

Generated on Mon Jun 9 03:38:19 2014 for SuperTux by  doxygen 1.5.1