forked from stefanhendriks/Dune-II---The-Maker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCell.hpp
52 lines (38 loc) · 968 Bytes
/
Cell.hpp
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
#ifndef CELL_H
#define CELL_H
#include <SFML/Graphics/Drawable.hpp>
#include <SFML/Graphics/Texture.hpp>
#include <SFML/Graphics/Sprite.hpp>
#include <SFML/Graphics/RenderTarget.hpp>
#include <array>
enum class Terrain
{
Sand = 0,
Hill = 1,
Rock = 2,
Spice = 3,
Mountain = 4,
Spicehill = 5,
Slab = 6
};
class Cell {
public:
typedef std::array<sf::Vertex, 4> VertexQuad;
static const int TILE_SIZE = 32; // squared
Cell();
void init(int row, int col);
void setType(Terrain terrain_type);
void setIndex(int tileIndex);
void setShroudIndex(int tileIndex);
bool shouldSmoothWithTerrainType(Cell& other) const;
Terrain terrainType; // terrain type (sand, rock, etc)
bool shrouded;
const VertexQuad& getQuad() const;
const VertexQuad& getShroudQuad() const;
sf::FloatRect getBounds() const;
int x, y;
private:
VertexQuad vertices;
VertexQuad shroudVertices;
};
#endif // CELL_H