-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstation.cpp
More file actions
26 lines (21 loc) · 835 Bytes
/
station.cpp
File metadata and controls
26 lines (21 loc) · 835 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
#include "station.hpp"
namespace loopline
{
Station::Station(){}
Station::Station(sf::Vector2f const& pos, float r, int i)
: position(pos), radius(r), id(i)
{
}
Station::~Station()
{
}
void Station::drawInfo(sf::RenderWindow &window, sf::Font const &font) const
{
std::string infoText = std::to_string(waitingPassengers) + " / " + std::to_string(maxCapacity) + " waiting";
sf::Text info{infoText, font, 15U};
info.setOrigin(0.5f * sf::Vector2f{static_cast<float>(info.getLocalBounds().width), static_cast<float>(info.getLocalBounds().height)});
info.setPosition(position + sf::Vector2f{0.f, 100.f});
info.setFillColor(waitingPassengers == maxCapacity ? sf::Color::Red : sf::Color::White);
window.draw(info);
}
} // namespace loopline