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>
10 class CTile
*m_pTiles
;
13 class CLayers
*m_pLayers
;
15 bool IsTileSolid(int x
, int y
);
16 int GetTile(int x
, int y
);
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
);