projects
/
supertux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* Limit coins to 9999 so the displayed amount is correct.
[supertux.git]
/
src
/
math
/
rect.hpp
diff --git
a/src/math/rect.hpp
b/src/math/rect.hpp
index
0f8e6c2
..
1fd5dcb
100644
(file)
--- a/
src/math/rect.hpp
+++ b/
src/math/rect.hpp
@@
-25,8
+25,8
@@
/** This class represents a rectangle.
* (Implementation Note) We're using upper left and lower right point instead of
/** This class represents a rectangle.
* (Implementation Note) We're using upper left and lower right point instead of
- * upper left and width/height here, because that makes the collision de
c
tection
- * a little bit
efficienter
.
+ * upper left and width/height here, because that makes the collision detection
+ * a little bit
more efficient
.
*/
class Rect
{
*/
class Rect
{
@@
-83,7
+83,11
@@
public:
{
set_width(width);
set_height(height);
{
set_width(width);
set_height(height);
- }
+ }
+ Vector get_size()
+ {
+ return Vector(get_width(), get_height());
+ }
void move(const Vector& v)
{
void move(const Vector& v)
{
@@
-91,11
+95,11
@@
public:
p2 += v;
}
p2 += v;
}
- bool
inside
(const Vector& v) const
+ bool
contains
(const Vector& v) const
{
return v.x >= p1.x && v.y >= p1.y && v.x < p2.x && v.y < p2.y;
}
{
return v.x >= p1.x && v.y >= p1.y && v.x < p2.x && v.y < p2.y;
}
- bool
inside
(const Rect& other) const
+ bool
contains
(const Rect& other) const
{
if(p1.x >= other.p2.x || other.p1.x >= p2.x)
return false;
{
if(p1.x >= other.p2.x || other.p1.x >= p2.x)
return false;
@@
-104,8
+108,8
@@
public:
return true;
}
return true;
}
-
- // leave these
2 public to saf
e the headaches of set/get functions for such
+
+ // leave these
two public to sav
e the headaches of set/get functions for such
// simple things :)
/// upper left edge
// simple things :)
/// upper left edge
@@
-115,4
+119,3
@@
public:
};
#endif
};
#endif
-