-
Notifications
You must be signed in to change notification settings - Fork 0
/
gameMath.h
68 lines (42 loc) · 1.6 KB
/
gameMath.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/***************************************************************************
** gameCore é utilizado para tudo relacionado a matemática, isto é calc- **
** de colisão entre personage me cenário[...] **
** Criado por Lucas P. Stark **
** Nightmare Fiction Engine - NFE **
***************************************************************************/
#ifndef GAME_MATH_H
#define GAME_MATH_H
#include <iostream>
#include <algorithm>
#define Pow2(X) (X*X)
enum COLLISION_TYPE {
COLLISION_TYPE_RECTANGLE = 1,
COLLISION_TYPE_ELLIPSE = 3
};
struct rectangle {
int x;
int y;
int h;
int w;
};
class gameMath {
public:
gameMath();
~gameMath();
// Detector de Colisão
bool collisionDetect(unsigned int colType, signed int x_1, signed int z_1, signed int w, signed int h, signed int x, signed int z);
bool mapSwitch(signed int x, signed int z, signed int x1, signed int z1, signed int x2, signed int z2, signed int x3, signed int z3, signed int x4, signed int z4);
bool collisionRectangle(int px, int py, int pz,
int nx, int ny, int nz);
bool collisionRectangleHW(int px, int py, int pz,
int nx, int ny, int nz,
int h, int w);
bool collisionShoot(float px, float py, float pz,
float nx, float ny, float nz,
float angle) ;
float interpolation(float n1, float n2, float p);
float d2Point(float x1, float y1, float z1,
float x2, float y2, float z2);
private:
};
#endif