-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinitialize.h
67 lines (57 loc) · 1.1 KB
/
initialize.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
#ifndef INITIALIZE_H
#define INITIALIZE_H
#include <QDebug>
// 定义了一些枚举变量,含义如其名
enum DIRECTION
{
UP, DOWN, RIGHT, LEFT
};
struct POINT
{
int x;
int y;
POINT(int X = 0, int Y = 0):x(X),y(Y){}
bool operator==(const POINT &p) const
{
if(x == p.x && y == p.y)
return true;
return false;
}
};
enum FOODTYPE
{
ADDLENGTH, ADDLIFE, ACCELERATE, DECELERATE, FROZEN
};
struct FOOD
{
POINT location;
FOODTYPE type;
int pressedTimes;
FOOD(POINT const &p, FOODTYPE t):location(p), type(t), pressedTimes(int(t)) {}
bool operator==(const FOOD &f) const
{
if(location == f.location && type == f.type)
return true;
return false;
}
};
enum DISPLAYMODE
{
START, CHOOSE, PAUSE, CUSTOMIZE, PLAY, GAMEOVER
};
enum PLAYMODE
{
SOLO, PVP, PVE
};
enum GAMESTATUS
{
GAMING, PAUSED, READY
};
struct LINE
{
POINT start;
POINT end;
LINE() {}
LINE(POINT s, POINT e):start(s), end(e) {}
};
#endif // INITIALIZE_H