don't delete wrapper.cpp when doing jam clean
[supertux.git] / src / collision.h
index deee4b8..d4f5882 100644 (file)
@@ -1,50 +1,46 @@
-// C Interface: collision
+//  $Id$
+// 
+//  SuperTux
+//  Copyright (C) 2005 Matthias Braun <matze@braunis.de>
 //
-// Description: 
+//  This program is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU General Public License
+//  as published by the Free Software Foundation; either version 2
+//  of the License, or (at your option) any later version.
 //
-//
-// Author: Tobias Glaesser <tobi.web@web.de>, (C) 2004
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-//
-
-#ifndef SUPERTUX_COLLISION_H
-#define SUPERTUX_COLLISION_H
-
-#include "type.h"
-
-class Tile;
-class World;
-
-/* Collision objects */
-enum
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+// 
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+//  02111-1307, USA.
+
+#ifndef __COLLISION_H__
+#define __COLLISION_H__
+
+class Vector;
+class Rect;
+class AATriangle;
+class CollisionHit;
+
+class Collision
 {
-  CO_BULLET,
-  CO_BADGUY,
-  CO_PLAYER
-};
-
-enum CollisionType {
-    COLLISION_NORMAL,
-    COLLISION_BUMP,
-    COLLISION_SQUISH
+public:
+  /** does collision detection between 2 rectangles. Returns true in case of
+   * collision and fills in the hit structure then.
+   */
+  static bool rectangle_rectangle(CollisionHit& hit, const Rect& r1,
+      const Vector& movement, const Rect& r2);
+
+  /** does collision detection between a rectangle and an axis aligned triangle
+   * Returns true in case of a collision and fills in the hit structure then.
+   */                                                                         
+  static bool rectangle_aatriangle(CollisionHit& hit, const Rect& rect,
+      const Vector& movement, const AATriangle& triangle);                                            
 };
 
-bool rectcollision(base_type* one, base_type* two);
-bool rectcollision_offset(base_type* one, base_type* two, float off_x, float off_y);
-
-void collision_swept_object_map(base_type* old, base_type* current);
-bool collision_object_map(base_type* object);
-
-/** Return a pointer to the tile at the given x/y coordinates */
-Tile* gettile(float x, float y);
-
-// Some little helper function to check for tile properties
-bool  issolid(float x, float y);
-bool  isbrick(float x, float y);
-bool  isice(float x, float y);
-bool  isfullbox(float x, float y);
-
-#endif /*SUPERTUX_COLLISION_H*/
+#endif