src/math/rect.hpp

Go to the documentation of this file.
00001 //  SuperTux
00002 //  Copyright (C) 2009 Ingo Ruhnke <grumbel@gmx.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_MATH_RECT_HPP
00018 #define HEADER_SUPERTUX_MATH_RECT_HPP
00019 
00020 #include "math/size.hpp"
00021 
00022 class Rect
00023 {
00024 public:
00025   int left;
00026   int top;
00027   int right;
00028   int bottom;
00029 
00030 public:
00031   Rect() :
00032     left(0),
00033     top(0),
00034     right(0),
00035     bottom(0)
00036   {}
00037 
00038   Rect(int left_, int top_, int right_, int bottom_) :
00039     left(left_),
00040     top(top_),
00041     right(right_),
00042     bottom(bottom_)
00043   {}
00044 
00045   Rect(int left_, int top_, const Size& size) :
00046     left(left_),
00047     top(top_),
00048     right(left_ + size.width),
00049     bottom(top_ + size.height)
00050   {}
00051 
00052   int get_width()  const { return right - left; }
00053   int get_height() const { return bottom - top; }
00054 };
00055 
00056 #endif
00057 
00058 /* EOF */

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