projects
/
supertux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Made Mr_Tree graphic smaller, from 99 to 85 pixels.
[supertux.git]
/
src
/
collision.cpp
diff --git
a/src/collision.cpp
b/src/collision.cpp
index
cce522d
..
be42268
100644
(file)
--- a/
src/collision.cpp
+++ b/
src/collision.cpp
@@
-19,21
+19,32
@@
// 02111-1307, USA.
#include <config.h>
// 02111-1307, USA.
#include <config.h>
-#include "collision.h"
+#include "collision.h
pp
"
#include <algorithm>
#include <iostream>
#include <stdio.h>
#include <float.h>
#include <math.h>
#include <algorithm>
#include <iostream>
#include <stdio.h>
#include <float.h>
#include <math.h>
-#include "math/vector.h"
-#include "math/aatriangle.h"
-#include "math/rect.h"
-#include "collision_hit.h"
+#include "math/vector.h
pp
"
+#include "math/aatriangle.h
pp
"
+#include "math/rect.h
pp
"
+#include "collision_hit.h
pp
"
static const float DELTA = .0001;
bool
static const float DELTA = .0001;
bool
+Collision::intersects(const Rect& r1, const Rect& r2)
+{
+ if(r1.p2.x < r2.p1.x || r1.p1.x > r2.p2.x)
+ return false;
+ if(r1.p2.y < r2.p1.y || r1.p1.y > r2.p2.y)
+ return false;
+
+ return true;
+}
+
+bool
Collision::rectangle_rectangle(CollisionHit& hit, const Rect& r1,
const Vector& movement, const Rect& r2)
{
Collision::rectangle_rectangle(CollisionHit& hit, const Rect& r1,
const Vector& movement, const Rect& r2)
{