-
Notifications
You must be signed in to change notification settings - Fork 0
/
rails.hpp
36 lines (26 loc) · 875 Bytes
/
rails.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
#ifndef __LOOPLINE_RAILS_HPP__
#define __LOOPLINE_RAILS_HPP__
#include <vector>
#include <SFML/Graphics.hpp>
#include "train.hpp"
namespace loopline
{
class Rails : public Updatable
{
private:
public:
enum Pathfinding{LINEAR, CUBIC};
Rails(std::vector<sf::Vector2f> const &pts = {}, Pathfinding path = CUBIC);
~Rails();
sf::Vector2f getWorldPosition(float railPosition) const;
void setControlPoints(std::vector<sf::Vector2f> const &pts);
virtual void update(sf::Time const &deltaTime);
virtual void fixedUpdate(sf::Time const &deltaTime);
virtual void draw(sf::RenderWindow& window) const;
Pathfinding path;
std::vector<sf::Vector2f> controlPoints;
std::vector<float> railLengths;
std::vector<Train> trains;
};
} // namespace loopline
#endif