-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTracks.hpp
More file actions
29 lines (25 loc) · 818 Bytes
/
Tracks.hpp
File metadata and controls
29 lines (25 loc) · 818 Bytes
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
#pragma once
#include <SFML/Graphics/Drawable.hpp>
#include "TrackChunk.hpp"
class Tracks : public sf::Drawable
{
public:
using Chunks = std::vector<TrackChunk>;
using ChunkIterator = Chunks::const_iterator;
Tracks();
sf::Vector2f getDirection(ChunkIterator chunk, float x) const;
sf::Vector2f getPointAt(ChunkIterator chunk, float x) const;
void update(float left, float right);
bool collidesWith(const sf::Shape& shape) const;
sf::Vector2f getStart() const;
ChunkIterator chunkAt(float x) const;
ChunkIterator end() const;
float top() const;
float bottom() const;
private:
void draw(sf::RenderTarget &target, sf::RenderStates states) const override;
float distancePossible() const;
void addNewChunk();
Chunks m_chunks;
sf::Vector2f m_right;
};