-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcellule.cpp
71 lines (59 loc) · 1.34 KB
/
cellule.cpp
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
69
70
71
#include "cellule.h"
Cellule::Cellule(): x(0), y(0), state(WALKABLE){}
Cellule::Cellule(bool etat, unsigned xData, unsigned yData):
x(xData), y(yData), state(etat ? WALKABLE : UNWALKABLE){}
int Cellule::getState() const{
return state;
}
unsigned int Cellule::getX() const{
return x;
}
unsigned int Cellule::getY() const{
return y;
}
void Cellule::setX(unsigned xData) {
x=xData;
return;
}
void Cellule::setY(unsigned yData){
y=yData;
return;
}
void Cellule::setState(Statment etat){
state=etat;
return;
}
bool celluleIsState(const Cellule &cellule, Cellule::Statment etat){
if(cellule.getState() == etat)
return true;
else
return false;
}
std::string readCell(const Cellule &cellule){
std::string res;
switch (cellule.getState()) {
case Cellule::WALKABLE:
res = "\033[2;42m \033[0m "; //"vert";
break;
case Cellule::UNWALKABLE:
res = "\033[2;41m \033[0m ";//" rouge";
break;
case Cellule::LIFECELL:
res = "\033[2;45m \033[0m ";//"rose";
break;
case Cellule::DEADCELL:
res = "\033[2;43m \033[0m ";//"jaune";
break;
case Cellule::MONSTER:
res = "\033[2;37mM \033[0m ";
break;
case Cellule::PLAYER:
res = "\033[2;32mP \033[0m ";
break;
}
return res;
}
void testCell(const Cellule &cellule){
std::cout<<cellule.getState()<<std::endl;
return;
}