Remove bogus assert
[supertux.git] / src / math / rect.hpp
1 //  SuperTux
2 //  Copyright (C) 2009 Ingo Ruhnke <grumbel@gmail.com>
3 //
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.
8 //
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.
13 //
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/>.
16
17 #ifndef HEADER_SUPERTUX_MATH_RECT_HPP
18 #define HEADER_SUPERTUX_MATH_RECT_HPP
19
20 #include "math/size.hpp"
21
22 class Rect
23 {
24 public:
25   int left;
26   int top;
27   int right;
28   int bottom;
29
30 public:
31   Rect() :
32     left(0),
33     top(0),
34     right(0),
35     bottom(0)
36   {}
37
38   Rect(int left_, int top_, int right_, int bottom_) :
39     left(left_),
40     top(top_),
41     right(right_),
42     bottom(bottom_)
43   {}
44
45   Rect(int left_, int top_, const Size& size) :
46     left(left_),
47     top(top_),
48     right(left_ + size.width),
49     bottom(top_ + size.height)
50   {}
51
52   int get_width()  const { return right - left; }
53   int get_height() const { return bottom - top; }
54 };
55
56 #endif
57
58 /* EOF */