-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpath.hpp
More file actions
40 lines (30 loc) · 1.09 KB
/
path.hpp
File metadata and controls
40 lines (30 loc) · 1.09 KB
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
#ifndef PATH_HPP
#define PATH_HPP
#include <vector>
#include <array>
#include <algorithm>
#include <memory>
#include "templates.hpp"
#include "file.hpp"
#include "sprite.hpp"
namespace TerraNova {
class Path {
std::vector<std::array<unsigned int, 2>> steps; // each entry is the actual
// coords of a Tile, not increments
std::vector<Sprite*> sprites;
void SpritifyPath();
public:
Path() = delete;
Path(std::vector<std::array<unsigned int, 2>> steps): steps(steps) {}
std::array<unsigned int, 2> NextStep() const;
bool Advance(); // return true if you've arrived at your destination
Sprite* FetchPathSegment(const std::array<unsigned int, 2>& start,
const std::array<unsigned int, 2>& end, const bool endOfPath);
void RenderStartingFrom(const int spriteX, const int spriteY);
SDL_Rect StartingSpriteLayout(const int spriteX, const int spriteY);
void PathSpriteFromTo(SDL_Rect& layout, const int startX,
const int startY, const int startRow, const int startColm,
const int endRow, const int endColm, const bool firstSegment);
};
} // namespace TerraNova
#endif