-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTile.cpp
76 lines (62 loc) · 1003 Bytes
/
Tile.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
72
73
74
75
76
#include <SFML/Graphics.hpp>
#include "Tile.h"
Tile::Tile(int x, int y, int mur)
{
_tile.setSize(sf::Vector2f(24, 24));
_tile.setPosition(sf::Vector2f(x*24, y*24 + 72));
_type = mur;
switch (mur)
{
case 0:
case 4:
case 5:
_tile.setFillColor(sf::Color::Black);
break;
case 1:
_tile.setFillColor(sf::Color::Transparent);
break;
}
}
int Tile::getTileType() const
{
return _type;
}
int Tile::getParent(int i) const
{
return _parent[i];
}
bool Tile::getVisited() const
{
return _visited;
}
bool Tile::getPath() const
{
return _path;
}
sf::RectangleShape& Tile::getTile()
{
return _tile;
}
void Tile::setTileType(int type)
{
_type = type;
if (_type == 0)
_tile.setFillColor(sf::Color::Black);
}
void Tile::setVisited(const bool visited)
{
_visited = visited;
}
void Tile::setParent(const int x, const int y)
{
_parent[0] = x;
_parent[1] = y;
}
void Tile::setPath(const bool path)
{
_path = path;
}
void Tile::draw(sf::RenderWindow& window)
{
window.draw(_tile);
}