fixed a warning in client (mac)
[twcon.git] / src / game / collision.h
blobd16f2d561817ecf6681a560ee930ccaf254d06de
1 /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
2 /* If you are missing that file, acquire a complete release at teeworlds.com. */
3 #ifndef GAME_COLLISION_H
4 #define GAME_COLLISION_H
6 #include <base/vmath.h>
8 class CCollision
10 class CTile *m_pTiles;
11 int m_Width;
12 int m_Height;
13 class CLayers *m_pLayers;
15 bool IsTileSolid(int x, int y);
16 int GetTile(int x, int y);
18 public:
19 enum
21 COLFLAG_SOLID=1,
22 COLFLAG_DEATH=2,
23 COLFLAG_NOHOOK=4,
26 CCollision();
27 void Init(class CLayers *pLayers);
28 bool CheckPoint(float x, float y) { return IsTileSolid(round(x), round(y)); }
29 bool CheckPoint(vec2 Pos) { return CheckPoint(Pos.x, Pos.y); }
30 int GetCollisionAt(float x, float y) { return GetTile(round(x), round(y)); }
31 int GetWidth() { return m_Width; };
32 int GetHeight() { return m_Height; };
33 int IntersectLine(vec2 Pos0, vec2 Pos1, vec2 *pOutCollision, vec2 *pOutBeforeCollision);
34 void MovePoint(vec2 *pInoutPos, vec2 *pInoutVel, float Elasticity, int *pBounces);
35 void MoveBox(vec2 *pInoutPos, vec2 *pInoutVel, vec2 Size, float Elasticity);
36 bool TestBox(vec2 Pos, vec2 Size);
39 #endif