-
Notifications
You must be signed in to change notification settings - Fork 0
/
TileGraph.h
49 lines (35 loc) · 914 Bytes
/
TileGraph.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
//
// Created by kevin on 25/12/17.
//
#ifndef OBOE_TILEGRAPH_H
#define OBOE_TILEGRAPH_H
#include <vector>
#include <limits>
#include <algorithm>
#include "Tile.h"
class TileGraph
{
public:
//create.
TileGraph(int gameWidth, int gameHeight);
TileGraph(std::vector<std::vector<Tile*>> tTiles);
//get the tiles.
Tile* getTileAtXY(int x, int y);
Tile* getPrevious(int x, int y);
void calculatePath(int srcX, int srcY);
void draw();
void drawPath(int destX, int destY);
void update();
bool pathsCalculated(){return m_pathsCalculated;}
private:
//2D vector to store the tile grid.
std::vector<std::vector<Tile*>> tiles;
// x and y of tilegraph.
int mX;
int mY;
// dijkstra vars
bool m_pathsCalculated;
std::vector<std::vector<Tile*>> previousTiles;
void drawPathElement(Tile* t, Tile* lastTile);
};
#endif //OBOE_TILEGRAPH_H