-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSegment.hpp
74 lines (53 loc) · 1.54 KB
/
Segment.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#pragma once
#include "Sprites.hpp"
#include "Cars.hpp"
#include "Point.hpp"
#include "Polygon.hpp"
#include "Colors.hpp"
#include <SFML/Graphics/RectangleShape.hpp>
#include <SFML/System/NonCopyable.hpp>
#include <list>
class Segment final : public sf::Drawable, public sf::Transformable, private sf::NonCopyable
{
public:
using Ptr = std::unique_ptr<Segment>;
private:
using SpritesContainer = std::vector<Sprites::Ptr>;
using CarsContainer = std::list<Cars::Ptr>;
public:
void setCurve(float i);
float getCurve() const;
Point& point1();
Point& point2();
const Point& point1() const;
const Point& point2() const;
void setSegmentColors(Colors::Type color);
void setIndex(std::size_t index);
std::size_t getIndex() const;
void setClip(float clip);
const float getClip() const;
const SpritesContainer& getSprites() const;
void addSprite(Sprites::Ptr sprite);
const CarsContainer& getCars() const;
void removeCar();
void addCar(Cars::Ptr car);
void setGrounds(float width, float fog);
private:
void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
private:
Point mPoint1{};
Point mPoint2{};
Polygon mRumbleSide1{};
Polygon mRumbleSide2{};
Polygon mLanes1{};
Polygon mLanes2{};
Polygon mMainRoad{};
sf::RectangleShape mLandscape{};
sf::RectangleShape mFog{};
SpritesContainer mSprites{};
CarsContainer mCars{};
std::size_t mIndex{};
Colors mColors{};
float mCurve{};
float mClip{};
};