fa165d7134388a09fbc2ad88b95ee65630625065
[supertux.git] / src / collision.h
1 // C Interface: collision
2 //
3 // Description: 
4 //
5 //
6 // Author: Tobias Glaesser <tobi.web@web.de>, (C) 2004
7 //
8 // Copyright: See COPYING file that comes with this distribution
9 //
10 //
11
12 #ifndef SUPERTUX_COLLISION_H
13 #define SUPERTUX_COLLISION_H
14
15 #include "type.h"
16
17 class Tile;
18
19 /* Collision objects */
20 enum
21 {
22   CO_BULLET,
23   CO_BADGUY,
24   CO_PLAYER
25 };
26
27 enum CollisionType {
28     COLLISION_NORMAL,
29     COLLISION_BUMP,
30     COLLISION_SQUISH
31 };
32
33 bool rectcollision(base_type* one, base_type* two);
34 bool rectcollision_offset(base_type* one, base_type* two, float off_x, float off_y);
35 void collision_swept_object_map(base_type* old, base_type* current);
36 bool collision_object_map(base_type* object);
37
38 /* Checks for all possible collisions.
39    And calls the collision_handlers, which the collision_objects provide for this case (or not). */
40 void collision_handler();
41
42 /** Return a pointer to the tile at the given x/y coordinates */
43 Tile* gettile(float x, float y);
44
45 // Some little helper function to check for tile properties
46 bool  issolid(float x, float y);
47 bool  isbrick(float x, float y);
48 bool  isice(float x, float y);
49 bool  isfullbox(float x, float y);
50
51 #endif /*SUPERTUX_COLLISION_H*/
52